Jwplayer: get url of video onComplete

I am trying to get the url of a video through an jwplayer().getPlaylistItem().file;onComplete callback, but it does not return anything.

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

It should be like this:

var videoURL = jwplayer().getPlaylistItem()['file'];
+8
source

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 does not work, indicate the link in which you will launch the player.

+3
source

I'm not sure about onComplete, but worth a try:

var fileName = jwplayer().config.file
var baseUrl = jwplayer().config.streamer
var videoUrl = baseUrl + "/" + fileName
0
source

All Articles