我試圖讓我的Chrome發件人應用程序將元數據發送到默認媒體接收器應用程序,但默認媒體接收器不顯示元數據。我找不到文檔或示例。有誰知道如何實現這個?下面的代碼播放音頻,但播放器不顯示任何圖像或其他元數據。Google演員:如何在默認媒體播放器中顯示元數據?
初始化:
var sessionRequest = new chrome.cast.SessionRequest(chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID);
var apiConfig = new chrome.cast.ApiConfig(sessionRequest,
sessionListener,
receiverListener);
chrome.cast.initialize(apiConfig, onInitSuccess, onError);
chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);
...
加載介質
url = "url-to-media"
var mediaInfo = new chrome.cast.media.MediaInfo(url, 'audio/aac');
mediaInfo.metadata = new chrome.cast.media.MusicTrackMediaMetadata()
mediaInfo.metadata.albumName = 'This is the name of the album'
mediaInfo.metadata.artistName = 'This is the name of the artist'
mediaInfo.metadata.songName = 'This is the name of the song'
im = chrome.cast.Image('http://m1.behance.net/rendition/modules/575407/disp/822271229466847.png')
mediaInfo.metadata.images = new Array(im)
var request = new chrome.cast.media.LoadRequest(mediaInfo);
session.loadMedia(request,onMediaDiscovered.bind(this, 'loadMedia'), onMediaError())
謝謝!你知道這是否記錄在某個地方嗎? –
有沒有辦法在默認接收器上獲取媒體圖像? –
對於圖片,試試這個 - var image = new chrome.cast.Image(imageUrl); mediaInfo.metadata.images = [image];'在此處找到[https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata] –