2014-09-13 65 views
0

我正在構建一個具有Chromecast支持的科爾多瓦icecast應用程序。到目前爲止,我得到它的工作感謝一個插件模仿官方Chrome API的密切關係。如何設置/更改專輯封面?

事情是:我想設置風格媒體接收器的專輯藝術,但我不能得到它的工作..是否anybode有一個這樣的例子?

我當前的代碼(段)

var mediaInfo = new chrome.cast.media.MediaInfo(station.station_url); 
mediaInfo.contentType = "audio/mpeg"; 
mediaInfo.metadata = new chrome.cast.media.MusicTrackMediaMetadata(); 
mediaInfo.metadata.title = station.station_name; 
mediaInfo.metadata.images = [ 
    new chrome.cast.Image(station.station_icon), // ex: http://www.thestation.com/icon.png 
    new chrome.cast.Image("img/web_hi_res_512_001.png") // fallback 
]; 

編輯1:添加「新」前chrome.cast.Image(),而不是它有助於但這是它是如何應該做:)

編輯2:現在我們討論使用Chrome API設置圖像的主題:如何在不調用loadMedia的情況下更新圖像?我認爲我需要使用sendMessage,但我不知道如何格式化消息。還有就是談論發送郵件的頁面,並將其提到的圖像,但它並沒有給出一個例子 - 這基本上使得它沒用:https://developers.google.com/cast/docs/reference/messages

PS:你可以看看這裏的項目:https://code.google.com/p/icerrr/

+0

嗯我覺得第二個問題基本上和這個一樣:http://stackoverflow.com/questions/23416648/what-payload-to-send-to-the-chromecast-default-media-receiver-via -cast-castapi-S – REJH 2014-09-22 13:42:00

回答

0

匝我用的cordova插件實際上並沒有對存儲在mediaInfo對象中的元數據做任何事情。它可能有點令人困惑,它很好地模仿了Chrome API,以至於你忘記了它實際上使用Android API與Chromecast進行通信。

所以我想我會分叉該項目,並嘗試自己修復它。感謝所有答覆等。