简体   繁体   English

如何在网页上播放.mp3或.m4a音频并同时显示嵌入式专辑封面? (使用Javascript,HTML5或Flash)

[英]How to play a .mp3 or .m4a audio on a webpage and show the embedded album art at the same time? (using Javascript, HTML5, or Flash)

There are ways to play a .m4a audio on a webpage using jPlayer or SoundManager2 , but it seems that they will not show the cover art (automatically for each song). 有几种方法可以使用jPlayer或SoundManager2在网页上播放.m4a音频,但似乎它们不会显示封面(自动为每首歌曲显示)。

Is there a way to automatically play the .m4a audio, as well as showing the cover art on a webpage, using Javascript, HTML5, or Flash? 是否可以使用Javascript,HTML5或Flash自动播放.m4a音频,以及在网页上显示封面? I think possibly for many .m4a , the cover art picture is already embedded in the .m4a file, as downloaded from the iTunes store. 我认为对于许多.m4a ,封面图片已经嵌入到.m4a文件中,可以从iTunes商店下载。 Or in the event that no cover art is there, is there a way to dynamically pull one? 或者,如果没有封面,那么有没有办法动态拉动封面? (Note: this is for any number of .m4a files automatically, such as 2, or 3, rather than just tailoring for one song. So this is similar to Yahoo Mediaplayer or Yahoo Webplayer ... the new one supports album art, but seems to only support one static image) (请注意:这自动适用于任意数量的.m4a文件,例如2或3,而不仅仅是为一首歌曲量身定制。因此,这类似于Yahoo MediaplayerYahoo Webplayer ...新的文件支持专辑封面,但是似乎仅支持一个静态图片)

http://musicplayer.sourceforge.net/ xspf播放器显示艺术家和专辑信息,它需要xspf播放列表,但不确定是否支持m4a格式。

Extract the cover art from the file first, server-side. 首先在服务器端从文件中提取封面。 Don't leave it up to the player. 不要把它留给玩家。

There are many ways to do this. 有很多方法可以做到这一点。 If you are hosting on Windows, you can use the MediaInfo DLL . 如果您在Windows上托管,则可以使用MediaInfo DLL

jPlayer has a poster property which can be set when you setMedia, or work with your playlist using the jPlayer playlist plugin. jPlayer具有一个发帖人属性,可以在setMedia时设置它,也可以使用jPlayer播放列表插件处理播放列表。

Granted the jPlayer poster is a static image you provide, it will probably be the easiest route. 授予jPlayer海报是您提供的静态图像,它可能是最简单的方法。 However.. 然而..

Embedded album art I do believe is contained within ID3v1, ID3v2 comments or Vorbis comments depending on the media format your using and when it was created. 我相信嵌入式专辑封面包含在ID3v1,ID3v2注释或Vorbis注释中,具体取决于您使用的媒体格式以及创建时的媒体格式。 There is a JavaScript library for reading ID3 data from media files https://github.com/aadsm/JavaScript-ID3-Reader 有一个JavaScript库,用于从媒体文件https://github.com/aadsm/JavaScript-ID3-Reader中读取ID3数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM