开发者

How do I create an audio player in HTML5 from an audio?

开发者 https://www.devze.com 2023-01-26 08:32 出处:网络
i found a couple HTML5 audio examples: jQuery plugin: http://www.happyworm.com/jquery/jplayer/latest/demo-01.htm

i found a couple HTML5 audio examples:

jQuery plugin:

http://www.happyworm.com/jquery/jplayer/latest/demo-01.htm

This site uses the above jQuery plugin for a stream:

http://wfmu.org/html5/player.php

This one uses streams from scratch:

http://www.trygve-lie.com/blog/entry/html_5_audio_element_and

Another tutorial:

http://html5doctor.com/native-audio-in-the-browser/

As long as the stream has Ogg Vorbis source and MP3, it should be good.

How could I use Java开发者_运维问答Script to create a channel-picker that would use a different source for the audio stream upon changing the channel?


You should be able to simply use jquery or regular javascript to remove the old tag from the dom, and create a new tag, set the source to the new mp3 file (from your track listing selector), and start it playing. i.e.

var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'loading.ogg');
audioElement.play();

Some pretty decent examples here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号