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 :)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745547649a4632415.html
评论列表(0条)