How to set/change album art?

I'm building a Cordova icecast app that has chromecast support. So far I got it working thanks to a plugin that mimmicks the official Chrome api quite closely.

The thing is: I want to set the album art of the Styled Media Receiver but I can't get it to work.. Does anybode have an example of this?

My current code (snippet)

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
];

EDIT 1: added 'new' before chrome.cast.Image(), not that it helps but this is how it's supposed to be done :)

EDIT 2: now we're on the subject of setting images using the Chrome API: how in the world can I update the image without calling loadMedia? I think that I need to use sendMessage but I don't know how to format the message. There is a page that talks about sending messages and it mentions images, but it doesn't give an example - which basically makes it useless: https://developers.google.com/cast/docs/reference/messages

PS: You can check out the project here: https://code.google.com/p/icerrr/

Answers:

Answer

Turns out that the cordova plugin I use doesn't actually do anything with the metadata I stored in the mediaInfo object. It can be a bit confusing that it mimics the Chrome API so well that you forget it's actually using the Android API to communicate with the chromecast.

So I guess I'll fork that project and try to fix it myself. Thanks for all the replies and such.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.