7
votes

Very strange thing. Last few days i noticed that on my Firefox v22 the youtube iframe api im using on few sites started to give errors like: "TypeError: Value not an object" and "Error: Bad NPObject as private data!". both in file: http://s.ytimg.com/yts/jsbin/www-embed-player-vflX1WAR4.js and my youtube player is not working stable now. Have someone else noticed this issue last days and what can cause this problem? On all other browsers thia youtube api works fine for me as it was befoe (i didn't do any changes to my sites)

3
I'm getting the same error in FireFox, but in Chrome I am getting the following error: "Blocked a frame with origin "youtube.com" from accessing a frame with origin "XXXX.localhost". Protocols, domains, and ports must match." It seems to be an issue on YouTubes end. - supajb
I am also having this problem in Firefox. TypeError: Value not an object. in http://s.ytimg.com/yts/jsbin/www-embed-player-vfl7jE1l_.js. Video plays for 6 seconds, then stops. - showdev
See the bug report on Google Code. - showdev
I still get the JS error, but I noticed that the video stopping after 6 seconds is the intended functionality of the code sample I was using: "// the player should play for six seconds and then stop." - showdev

3 Answers

1
votes

If the player element is hidden when you call player.loadVideoById(vid), it will throw error "Error: Bad NPObject as private data" in firefox

See the difference in http://jsfiddle.net/eyx4M/7/ This will work in chrome with a warning "Unsafe JavaScript attempt to access frame with Url", but in firefox it will throw "Error: Bad NPObject as private data".

0
votes

The source of iframe should contain ORIGIN - domain. Domain should be reachable from outside localhost/local network.

http://www.youtube.com/embed/<VIDEO_ID>?origin=http://DOMAIN

Solved the problem for me.

-1
votes

I had the same problem.

This script fixed it:

<object width="640" height="390">
  <param name="movie"
       value="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1"
       type="application/x-shockwave-flash"
       allowscriptaccess="always"
       width="640" height="390"></embed>
</object>

the source https://developers.google.com/youtube/player_parameters