Changing songs on jPlayer by clicking a link, hosted on Amazon S3

前端 未结 2 353
不思量自难忘°
不思量自难忘° 2020-12-17 01:05

Hello all and thanks for any help in advance.

I have a ruby on rails application in which I am attempting to stream audio through jPlayer, which is hosted on S3. So

相关标签:
2条回答
  • 2020-12-17 01:24

    After Searching a lot it could be one of the solutions too.

     function songs(json1) {
    $("#jquery_jplayer_1").jPlayer("destroy"); //this will destroy previous jplayer content and then if you again call this function it will add the new url of you audio song to the jplayer
    var audio_url_inside = json1.audio_url;
    $('#jquery_jplayer_1').jPlayer({
    ready:function (event) {
    $(this).jPlayer("setMedia", {
    mp3:audio_url_inside,
    oga:audio_url_inside
    }).jPlayer("play"); //attemp to play media
    },
    swfPath:"http://www.jplayer.org/2.1.0/js",
    supplied:"mp3, oga"
    });
    }

    :Hope it will help.

    0 讨论(0)
  • 2020-12-17 01:27

    Well it appears that the only issue was a lack of brackets around the mp3: url part of jPlayer("setMedia"....

    so it should have been (...).jPlayer("setMedia", {mp3: url}).(...)

    0 讨论(0)
提交回复
热议问题