0

I found a related question here
But my question is how to do this with jPlayer ? Is there possible to play audio continuously without using ajax?

$(document).ready(function(){

    new jPlayerPlaylist({
        jPlayer: "#jquery_jplayer_1",
        cssSelectorAncestor: "#jp_container_1"
    }, [
        {
            title:"Lentement",
            artist:"Miaow",
            mp3:"http://www.jplayer.org/audio/mp3/Miaow-03-Lentement.mp3",
            oga:"http://www.jplayer.org/audio/ogg/Miaow-03-Lentement.ogg",
            poster: "http://www.jplayer.org/audio/poster/Miaow_640x360.png"
        }
    ], {
        swfPath: "../dist/jplayer",
        supplied: "oga, mp3",
        useStateClassSkin: true,
        autoBlur: false,
        smoothPlayBar: true,
        keyEnabled: true,
        audioFullScreen: true
    });

    $("#jplayer_inspector_1").jPlayerInspector({jPlayer:$("#jquery_jplayer_1")});
});
Community
  • 1
  • 1
userknowmore
  • 137
  • 2
  • 14

2 Answers2

2

Is there possible to play audio continuously without using ajax?

For audio to play continuously, uninterrupted, it needs a continuous, uninterrupted connection and page 'state'.

There are two basic ways to handle this:

  • load the player on to a page and have the rest of the content load as a person navigates via AJAX. This preserves a 'single page/single connection' for player.

  • Stick the player on a page and the rest of the site load into an iFrame. This does the same as the AJAX option but adds the inconveniences of iFrames to the experience.

DA.
  • 39,848
  • 49
  • 150
  • 213
  • I just want play continuously from last point after page load. you can see here example http://stackoverflow.com/questions/15612120/how-do-i-make-an-audio-file-play-continuously-on-all-pages but can you do this using jPlyer? – userknowmore Jul 04 '15 at 17:52
  • @userknowmore you mean you're OK with the audio cutting out as each page is loaded? – DA. Jul 04 '15 at 17:57
  • @userknowmore Well, bro, it looks like you can start playback at any time with the built in Method: http://jplayer.org/latest/developer-guide/#jPlayer-play as long as you can set the point where the player stops on the previous page (likely via cookies) then this might work. – DA. Jul 04 '15 at 18:40
  • @userknowmore an example of what? What part are you stuck on? – DA. Jul 04 '15 at 18:45
  • I don't know bro how to do this. I have small music band site and i want to add this on my site. I think jPlayer does not have – userknowmore Jul 04 '15 at 18:55
  • Sorry, I can't do it all for you. – DA. Jul 04 '15 at 19:00
0

If you insist on not opening jPlayer in a popup, then I recommend you achieve continuous audio between pages by not actually loading a new page when navigated to. This may be easier than you think, with new front end JavaScript libraries such as Ember.js

Dan Mantyla
  • 1,840
  • 1
  • 22
  • 33