如何在jplayer中自动播放广播流

时间:2018-07-12 04:12:29

标签: javascript jplayer

这是我从Codepen获得的jplayer代码,我想在页面打开后立即自动播放音频流,但是还没有解决方案。

$(document).ready(function(){

var stream = {
    title: "Capital Fm",
    mp3: "http://144.217.203.226:8316/live"
},
ready = false;

$("#jquery_jplayer_1").jPlayer({
    ready: function (event) {
        ready = true;
        $(this).jPlayer("setMedia", stream);
    },
    pause: function() {
        $(this).jPlayer("clearMedia");
    },
    error: function(event) {
        if(ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
            // Setup the media stream again and play it.
            $(this).jPlayer("setMedia", stream).jPlayer("play");
        }
    },
    swfPath: "js",
    supplied: "mp3",
    preload: "none",
    wmode: "window",
    useStateClassSkin: true,
    autoBlur: false,
    keyEnabled: true
});

}); 

0 个答案:

没有答案