Note that there are some explanatory texts on larger screens.

plurals
  1. POYouTube JS API Breaking Change? Will no longer initialize without the videoid parameter as of 2/27/2013
    primarykey
    data
    text
    <p>To demonstrate the breaking change I discovered today I took the basic JS API sample page which can be found with link below and simply commented out the videoId parameter:</p> <p>YT Sample Code demonstrating initialization error: <a href="http://www.multitask123.com/fmgem/YT_Sample2.htm" rel="nofollow">http://www.multitask123.com/fmgem/YT_Sample2.htm</a></p> <p>With said removal of videoId parameter the player will now display/initialize with the following error message in the embedded player, "An error occurred. Please try later." This was not the case until this afternoon.</p> <p>For the past three months I could call onYouTubePlayerAPIReady as follows and there would be no error message:</p> <pre><code>function onYouTubePlayerAPIReady() { player = new YT.Player('player', { height: '390', width: '640', //videoId: 'JW5meKfy3fY', - COMMENTED OUT INTENTIONALLY! HARD REQUIREMENT! events: { 'onReady': onPlayerReady, 'onError': onPlayerError, 'onStateChange': onPlayerStateChange } }); } </code></pre> <p>The error is caught by the onPlayerError event handler during initialization and the error comes in with the "evt" parameter's data attribute. So onPlayerError(evt) is called on initialization and evt.data = 2. This value is documented as, "The request contains an invalid parameter value" which is clearly the API expecting a videoId.</p> <p>I do not want to go into too much detail but I spent countless hours getting the initialization of the player to work just right as there are numerous cross browser initialization issues. I need to hide the player until I actually need it to play something. </p> <p>I forget which browser is the culprit but one of them actually forces me to show the player even though no video is playing. </p> <p>I discovered I cannot lazy load/JIT the embedded player because it loads asynchronously so if I try to only load it when my users wish to actually view a video or there are other parameters of the URL involved that will load a playlist for example the player will balk because I cannot BOTH initialize the player and ask it to play a video. </p> <p>So the bottom line is the player NEEDS to be initialized when the page is loading but NOT with a videoId parameter because quite simply I have no idea what is going to be played in 90% of the circumstances and even if I did that would be the result of a different asynchronous call to a different API. I say this because the solution to initialize it with a videoid is unacceptable. </p> <p>The YouTube API is amazing and I love it so much so that I have spent 18 months developing <a href="http://www.fmgem.com" rel="nofollow">http://www.fmgem.com</a> and now this breaking change is ruining the first impression beta users will have of my app. So if the YT API team does indeed monitor this please change it back. Pretty please with sugar on top. :))</p> <p>Something similar happened a few weeks ago with the same function's wmode attribute on load.</p> <p>//wmode: 'opaque' //--- causes wicked bug in Chrome - And I was able to change opaque to transparent so no biggie there but this would require me to review my entire architecture and methodically handle apx 9 different asynchronous use-cases for load that again, have all had cross-browser quirks. </p> <p>So I cannot afford to be reactive and I have been forced to put in a "sneezing baby panda" videoId into the live code at <a href="http://www.fmgem.com" rel="nofollow">http://www.fmgem.com</a> but that looks quite unprofessional and it is merely a band-aid until I can review the entire architecture unless YT Team actually acknowledges this as a breaking change and then puts it back to its prior behavior.</p> <p>This was detected by some users sometime during the afternoon of 2/27/2013 and I have read on google groups that YouTube's developers monitor SO.</p> <p>Any answers, solutions, guidance or confirmation would be greatly appreciated.</p> <p>Thanks!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload