admin管理员组文章数量:1023085
I am after a very basic music player, I have the following basics working now, however;
1) How to make both the Play and Pause buttons in one button? That appears first as Pause and on click It toggles Play and on click again it Toggle Pause?
2) Also Is there anyway to add a progress counter? not a bar, but numbers i.e. 0.3/4.0min
Here is the fiddle: www.jsfiddle/tjHhY And here is the code as well here:
var audio = new Audio("/02%20Cherry%20Blossom%20Girl.mp3");
$(".play").click(function () {
audio.play();
})
$(".pause").click(function () {
audio.pause();
})
I am after a very basic music player, I have the following basics working now, however;
1) How to make both the Play and Pause buttons in one button? That appears first as Pause and on click It toggles Play and on click again it Toggle Pause?
2) Also Is there anyway to add a progress counter? not a bar, but numbers i.e. 0.3/4.0min
Here is the fiddle: www.jsfiddle/tjHhY And here is the code as well here:
var audio = new Audio("http://dp0169.free.fr/Musique/Air/Air%20-%20Talkie%20Walkie/02%20Cherry%20Blossom%20Girl.mp3");
$(".play").click(function () {
audio.play();
})
$(".pause").click(function () {
audio.pause();
})
Share
Improve this question
edited Oct 30, 2013 at 17:29
asked Oct 30, 2013 at 17:19
user2756554user2756554
1
-
The play and pause button should also be reference by ID not class. I.E.
$("#play").click....
<input type="button" id="play" />
– James McNee Commented Dec 20, 2016 at 10:53
2 Answers
Reset to default 1I'd remend you to use JQueryUI. It have nice variety of widgets to create clean interface :)
Also check this demo it shows how to create toggle play & pause button.
Hope it helps.
Why don't you check this Demo. Hope it helps :)
I am after a very basic music player, I have the following basics working now, however;
1) How to make both the Play and Pause buttons in one button? That appears first as Pause and on click It toggles Play and on click again it Toggle Pause?
2) Also Is there anyway to add a progress counter? not a bar, but numbers i.e. 0.3/4.0min
Here is the fiddle: www.jsfiddle/tjHhY And here is the code as well here:
var audio = new Audio("/02%20Cherry%20Blossom%20Girl.mp3");
$(".play").click(function () {
audio.play();
})
$(".pause").click(function () {
audio.pause();
})
I am after a very basic music player, I have the following basics working now, however;
1) How to make both the Play and Pause buttons in one button? That appears first as Pause and on click It toggles Play and on click again it Toggle Pause?
2) Also Is there anyway to add a progress counter? not a bar, but numbers i.e. 0.3/4.0min
Here is the fiddle: www.jsfiddle/tjHhY And here is the code as well here:
var audio = new Audio("http://dp0169.free.fr/Musique/Air/Air%20-%20Talkie%20Walkie/02%20Cherry%20Blossom%20Girl.mp3");
$(".play").click(function () {
audio.play();
})
$(".pause").click(function () {
audio.pause();
})
Share
Improve this question
edited Oct 30, 2013 at 17:29
asked Oct 30, 2013 at 17:19
user2756554user2756554
1
-
The play and pause button should also be reference by ID not class. I.E.
$("#play").click....
<input type="button" id="play" />
– James McNee Commented Dec 20, 2016 at 10:53
2 Answers
Reset to default 1I'd remend you to use JQueryUI. It have nice variety of widgets to create clean interface :)
Also check this demo it shows how to create toggle play & pause button.
Hope it helps.
Why don't you check this Demo. Hope it helps :)
本文标签: javascriptToggle PlayPause Buttons in HTML Audio PlayerStack Overflow
版权声明:本文标题:javascript - Toggle PlayPause Buttons in HTML Audio Player - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745547647a2155470.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论