如何设置/更改专辑封面? [英] How to set/change album art?

查看:327
本文介绍了如何设置/更改专辑封面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个具有chromecast支持的Cordova icecast应用程序。到目前为止,我得到了它的工作,感谢一个插件,模仿官方的Chrome api非常密切。

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.

事情是:我想设置Styled Media Receiver的专辑封面但我无法让它工作.. anybode有这样的例子吗?

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?

我当前的代码(片段)

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()之前添加'new',而不是它有帮助但是这是应该如何完成的:)

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

编辑2:现在我们讨论使用Chrome API设置图像的问题:我可以在世界上如何更新没有调用loadMedia的图像?我认为我需要使用sendMessage但我不知道如何格式化消息。有一个页面讨论发送消息并提及图像,但它没有举例 - 这基本上使它无用: https://developers.google.com/cast/docs/reference/messages

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:您可以退房这个项目: https://code.google.com/p/icerrr/

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

推荐答案

事实证明我使用的cordova插件实际上并没有对我存储在mediaInfo对象中的元数据做任何事情。它可能有点令人困惑,因为它很好地模仿Chrome API,以至于你忘记它实际上是使用Android API与chromecast进行通信。

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.

所以我想我会fork那个项目并尝试自己修复它。感谢所有回复等。

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

这篇关于如何设置/更改专辑封面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆