jwplayer: get video URL onComplete
Asked Answered
M

3

6

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);
});
Mailer answered 18/7, 2014 at 21:24 Comment(0)
I
8

It should be this:

var videoURL = jwplayer().getPlaylistItem()['file'];
Imprint answered 18/7, 2014 at 22:34 Comment(2)
Regardless of using dot or bracket notation, I'm still not getting the video's URL.Mailer
We use this on - support.jwplayer.com/customer/portal/articles/…, and it works fine.Imprint
I
3

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.

Invite answered 19/7, 2014 at 19:15 Comment(0)
W
0

I'm not sure about onComplete but it worth to try:

var fileName = jwplayer().config.file
var baseUrl = jwplayer().config.streamer
var videoUrl = baseUrl + "/" + fileName
Wilfordwilfred answered 1/7, 2016 at 18:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.