Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jwplayer: get video URL onComplete

Tags:

jwplayer

I'm trying to get the URL of the video via jwplayer().getPlaylistItem().file; onComplete callback, but it's returning nothing.

jwplayer().onComplete(function(e) {
    var videoURL = this.getPlaylistItem().file;
    console.log('Completed = ' + videoURL);
});
like image 992
Blexy Avatar asked Jul 18 '14 21:07

Blexy


2 Answers

It should be this:

var videoURL = jwplayer().getPlaylistItem()['file'];
like image 167
emaxsaun Avatar answered Jan 03 '23 10:01

emaxsaun


Your code seems to work.

jwplayer("container").setup({
  playlist: "http://content.jwplatform.com/feeds/13ShtP5m.rss",
  displaytitle: false,
  width: 640,
  height: 360
});

jwplayer().onComplete(function(e) {
    var videoURL = this.getPlaylistItem().file;
    console.log('Completed = ' + videoURL);
});

See this example:

http://jsfiddle.net/rDs4P/

If it still doesn't work, please provide link where you run the player.

like image 23
Ben Avatar answered Jan 03 '23 10:01

Ben