Search code examples
jqueryaudiojplayer

How to play audio continuously on all pages using jPlayer?


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")});
});

Solution

  • 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.