How to repeat current song playing?

716 views
Skip to first unread message

refresh

unread,
Apr 5, 2014, 12:58:37 PM4/5/14
to jpl...@googlegroups.com
Hi, guys.

2.5 jplayer have a repeat button for repeat the all playlist over again. How can i create or/and edit that it will repeat the current song playing? 

Thank u all.

Radet Hong

unread,
Apr 7, 2014, 10:00:41 PM4/7/14
to jpl...@googlegroups.com
if you use jplayer.playlist.min.js you can edit it in function as below:
b(this.cssSelector.jPlayer).bind(b.jPlayer.event.ended,function(){e.next()});
above is the original function and then you can replace it as my code below. It will repeat the current song of your playing.

b(this.cssSelector.jPlayer).bind(b.jPlayer.event.ended,function(){e.loop==1?e.play():e.next()});
hope it will work for you. :D

Hong Radet
IRG
Web Developer
ra...@myirg.com
Phone: +855 17 570 917 | +855 93 882 645
Tel: +855 23 995 725
Website: www.myirg.com



--
You received this message because you are subscribed to the Google Groups "jPlayer: HTML5 Audio & Video for jQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jplayer+u...@googlegroups.com.
To post to this group, send email to jpl...@googlegroups.com.
Visit this group at http://groups.google.com/group/jplayer.
For more options, visit https://groups.google.com/d/optout.

refresh

unread,
Apr 8, 2014, 3:47:45 AM4/8/14
to jpl...@googlegroups.com
Hong Radet, it's worked man! Great job, thanks!!! :)

Radet Hong

unread,
Apr 8, 2014, 3:51:28 AM4/8/14
to jpl...@googlegroups.com
sound good and glad to help you.

Hong Radet
IRG
Web Developer
ra...@myirg.com
Phone: +855 17 570 917 | +855 93 882 645
Tel: +855 23 995 725
Website: www.myirg.com



On Tue, Apr 8, 2014 at 2:47 PM, refresh <kobilg...@gmail.com> wrote:
Hong Radet, it's worked man! Great job, thanks!!! :)

--

refresh

unread,
Apr 8, 2014, 8:22:22 AM4/8/14
to jpl...@googlegroups.com
Radet Hong, I assume that you understand jPlayer better than me :)
Could you help with one nuance of this player, please. Issue about adding tracks to playlist.

I'm getting playlist via Ajax (JSON-response). Is it possible to add more than one track in playlist?  myPlaylist.setPlaylist() working perfect, but it's refreshing my playlist. I want just add tracks to current playlist not refresh whole. I'm using myPlaylist.add(), but it adds just one track. Or maybe i'm doing sth wrong...
So what i'm doing:
$.ajax({
  url: "ajax.php?my_track=1",
  dataType: 'json',
  success:    function(data){
  //myPlaylist.add(data); --> undefined, not working
  myPlaylist.setPlaylist(data); --> Working, but i need just add
 }
});

Radet Hong

unread,
Apr 8, 2014, 9:42:42 PM4/8/14
to jpl...@googlegroups.com
Good question. unfortunately the function add in jPlayer can add only one track. If you want to add multiple track to playlist by this function there are only one way. You can use loop in your ajax function as example below:
$.ajax({
  url: "ajax.php?my_track=1",
  dataType: 'json',
  success:    function(data){
$(data).each(function(){
myPlaylist.add(this);
});
  //myPlaylist.add(data); --> undefined, not working
 }
});
I hope your json data should have format like my click function.
$(".add_song").click(function(){
        var list=[];
        list[0]={
            title:"Your Face",
            artist:"The Stark Palace",
            mp3:"http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3",
            oga:"http://www.jplayer.org/audio/ogg/TSP-05-Your_face.ogg",
            poster: "http://www.jplayer.org/audio/poster/The_Stark_Palace_640x360.png"
        };
        list[1]={
            title:"Cyber Sonnet",
            artist:"The Stark Palace",
            mp3:"http://www.jplayer.org/audio/mp3/TSP-07-Cybersonnet.mp3",
            oga:"http://www.jplayer.org/audio/ogg/TSP-07-Cybersonnet.ogg",
            poster: "http://www.jplayer.org/audio/poster/The_Stark_Palace_640x360.png"   
        };
        $(list).each(function(){
            //console.log(this);
            myPlaylist.add(this);   
        });
    });
hope you will understand it.


Hong Radet
IRG
Web Developer
ra...@myirg.com
Phone: +855 17 570 917 | +855 93 882 645
Tel: +855 23 995 725
Website: www.myirg.com



--

refresh

unread,
Apr 8, 2014, 11:31:06 PM4/8/14
to jpl...@googlegroups.com
Radet Hong, sure my json data has format like yours and it works! Great :) 

Thanks, Radet Hong!
Reply all
Reply to author
Forward
0 new messages