是否可以获取当前jwplayer加载文件的文件名?
jwplayer('player_1').setup({
width: 640,
height: 480,
file: "http://domain.com/filename.mp4"
});
我遇到了这个http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference#playlist,但不确定这是否适用于我的情况。
alert(jwplayer('player_1').getPlaylistItem().index);
答案 0 :(得分:4)
没关系。想出来了:
var theFile;
if(jwplayer('player_1').config.levels){
theFile = jwplayer('player_1').getPlaylistItem()['levels'][0]['file'];
}
else {
theFile = jwplayer('player_1').getPlaylistItem()['file'];
}
alert(theFile);
答案 1 :(得分:0)
jwplayer('player_1').onPlaylistItem(function(event){
index = jwplayer('player_1').getPlaylistIndex();
item = jwplayer('player_1').getPlaylistItem(index);
theFile = item.file;
alert(theFile);
});