Jwplayer v7.xx _.getVideoData is not a function problem

From today, I have the following problem with YouTube videos when I want to dynamically change videos 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 la (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 KfI (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www- widgetapi.js:66) at Wfl (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www- widgetapi.js:114) at WfJ (s.ytimg.com/yts/jsbin/www-widgetapi-vflnzpyZ4/www- widgetapi.js:127) at Sg (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. (Jwplayer 8 version shows the same problem)

+5
source share
3 answers

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

The source for the JW Player Youtube provider can be found and broken here:

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

And this problem is tracked in the project here:

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

+1
source

I tried the plugin plugin, but get the terror: failed to execute 'postMessage' in 'DOMWindow': the given start of the target (' https://www.youtube.com ') does not match the recipient

UPDATE:

If you are compiling from the 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]; 
+1
source

While you are waiting for a word from Google, I created a plugin to fix it. Download it here:

https://www.dev.powered-by-haiku.co.uk/solutions/getvideodata/code/getvideodata.js

(NOTE: You need to copy and paste the URL into the browser to get the code because hotlinking is not allowed)

Apply it just like any other JW plugin:

 "plugins":{ "getvideodata.js":{} } 

EDIT: Now this update has been updated to serve the autorun script: true. Please note that the latest versions of Chrome now block multimedia playback that does not start using user gestures, and since the JW Player does not process the received error state gracefully (when trying to autostart YouTube, for example), the player will get into a visible endless buffering state. This plugin resolves this by canceling the autorun request in Chrome and leaving it to the user to start playback.

0
source

Source: https://habr.com/ru/post/1273350/


All Articles