Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jwplayer v7.xx _.getVideoData is not a function issue

From today I have the following issue on youtube hosted videos when I want to change dynamically the video on my site.

_.getVideoData is not a function

Uncaught TypeError: _.getVideoData is not a function
at M (ssl.p.jwpcdn.com/player/v/7.12.11/provider.youtube.js:1)
at load (ssl.p.jwpcdn.com/player/v/7.12.11/provider.youtube.js:1)
at l.a (ssl.p.jwpcdn.com/player/v/7.12.11/provider.youtube.js:1)
at l.<anonymous> 
(ssl.p.jwpcdn.com/player/v/7.12.11/provider.youtube.js:1)
at P (ssl.p.jwpcdn.com/player/v/7.12.11/provider.youtube.js:1)
at K.f.I (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www-
widgetapi.js:66)
at W.f.l (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www-
widgetapi.js:114)
at W.f.J (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www-
widgetapi.js:127)
at S.g (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www-
widgetapi.js:143)
at g (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www-
widgetapi.js:95)

Until today it worked fine. (The jwplayer 8 version show the same issue)

like image 593
janosdupai Avatar asked Oct 29 '22 23:10

janosdupai


2 Answers

JW Player 7.12.x uses the youtube-iframe-api. The getVideoData method was removed without warning, and we would like Google to put it back to restore functionality to integrations that use it.

The source to the JW Player Youtube provider can be found and forked here:

https://github.com/jwplayer/jwplayer/blob/v7.12.x/src/js/providers/youtube.js

And this issue is being tracked in the project here:

https://github.com/jwplayer/jwplayer/issues/2525

like image 138
funrob Avatar answered Nov 15 '22 05:11

funrob


Tried the patch plugin but get anerror: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient

UPDATE:

If you compile from source/git v7.12;

In src/js/providers/youtube.js

Replace:

var videoData = _youtubePlayer.getVideoData();
var currentVideoId = videoData && videoData.video_id;

With:

var videoData = _youtubePlayer.getVideoUrl();
videoData = videoData.split('=');
var currentVideoId = videoData[1];
like image 32
Douglas Rhiner Avatar answered Nov 15 '22 06:11

Douglas Rhiner