如何使用HTML5音频标签创建自动播放列表? [英] How can you create an auto playlist with the HTML5 Audio tag?

查看:709
本文介绍了如何使用HTML5音频标签创建自动播放列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用HTML5中的音频标签创建自动播放列表?

How can you create an auto playlist with the audio tag from HTML5?

我想要实现的是只有播放/暂停按钮大的播放器30x25像素,播放器在页面加载时自动播放,当歌曲结束时,它将自动播放下一首歌曲。试图在播放列表中播放3-4首歌曲。

What I'm trying to achieve is a player with only the play/pause button big 30x25 px, the player autoplays when the page loads and when the song ends it'll play the next song automatically. Trying to have 3-4 songs in a playlist.

推荐答案

查看此帖子:使用jquery +< audio> w / php / mysql循环播放时间

var sfx = new Audio('sfx.wav');
var sounds = a.addTextTrack('metadata');

// add sounds we care about
sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));

function playSound(id) {
  sfx.currentTime = sounds.getCueById(id).startTime;
  sfx.play();
}

我刚刚使用这里指定的使用提示的更好示例更新了这个:< a href =http://dev.w3.org/html5/spec/Overview.html =nofollow noreferrer> http://dev.w3.org/html5/spec/Overview.html

I just updated this with a better example of using cues as specified here: http://dev.w3.org/html5/spec/Overview.html

这篇关于如何使用HTML5音频标签创建自动播放列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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