2

是否可以获取当前 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);
4

2 回答 2

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);
于 2013-05-21T01:56:56.473 回答
0
jwplayer('player_1').onPlaylistItem(function(event){

     index = jwplayer('player_1').getPlaylistIndex();
     item = jwplayer('player_1').getPlaylistItem(index);

     theFile = item.file;
     alert(theFile);
 });
于 2015-03-11T13:51:58.827 回答