brandly / angular-youtube-embed

:tv: Embed a YouTube player with a simple directive
http://brandly.github.io/angular-youtube-embed/
MIT License
510 stars 147 forks source link

Specify YTConfig host as https #116

Closed windkomo closed 8 years ago

windkomo commented 8 years ago

Hello, I've encountered the

failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin error referenced in #62.

I seems that the YouTube iframe API randomly returns http or https.

If you execute curl -s http://www.youtube.com/iframe_api | grep http you can see the following code :

if (!window['YTConfig']) {var YTConfig = {'host': 'http://www.youtube.com'};}

So I overrode the host option. Now it returns an https URL everytime.

Looking forward to feedback !

brandly commented 8 years ago

oh, interesting!

since createPlayer gets called for each and every player that's created, i think we can move that code somewhere like here. there's nothing truly wrong about where you placed it, but i think it'd be better to move it 💯

is there any way this could break anything? this seems like a minor update, but i'd like to be sure. any thoughts? cc @konsumer @qubird

thanks for finding this @windkomo

windkomo commented 8 years ago

@brandly oh right, that seems like a good idea, I moved it !

konsumer commented 8 years ago

:thumbsup:

brandly commented 8 years ago

v1.2.0

thanks again for the help! 💫

windkomo commented 8 years ago

No problem, glad to help, thanks a lot for the fast release 👍