我使用jPlayer和Popcorn jPlayer插件创建了一个播放器。设置如下:
var $player = Popcorn
.jplayer('#jquery_jplayer_1', {
media: {
m4v: Content.videoURL,
poster: Content.posterURL
},
options: {
swfPath: "swf",
supplied: "m4v",
size: {
width: "640px",
height: "360px",
cssClass: "jp-video-360p"
},
smoothPlayBar: true,
keyEnabled: true
}
});
媒体准备好后,如何自动启动播放器?我可以使用$ player参考吗?
答案 0 :(得分:0)
想出来。将ready函数属性添加到选项:
var $player = Popcorn
.jplayer('#jquery_jplayer_1', {
media: {
m4v: Content.videoURL,
poster: Content.posterURL
},
options: {
ready: function() {
$player.play();
},
swfPath: "swf",
supplied: "m4v",
size: {
width: "640px",
height: "360px",
cssClass: "jp-video-360p"
},
smoothPlayBar: true,
keyEnabled: true
}
});