oskarrough/ember-youtube

Switching between multiple videos triggers a widget api error

jordanjoecooper opened this issue · 3 comments

I had experienced this within a code base I am currently working on and noticed it in the demo example here, to recreate in the demo:

  1. Play a video on the main page.
  2. Select the link at the bottom that states 'heres another video'
  3. The above triggers the following Message in the console:
    www-widgetapi.js:100 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://ember-youtube.surge.sh').

Unsure as to what causes this I have seen other frameworks with the same problem and multiple solutions proposed for each but nothing definitive.

Thanks, I also see that all the time… quite annoying.

I did a quick test, which seems to remove the warning once deployed. Note, it'll still show up in localhost although it doesn't seem to do anything.

playerVars = {
  origin: 'https://emberyoutube.now.sh'
}

@T4JC can you verify on https://emberyoutube.now.sh?

@oskarrough

Can confirm that fixes it on the demo site, awesome, thank you!

I added it to the readme, cheers!