gajus / react-youtube-player

React component that encapsulates YouTube IFrame Player API and exposes player controls using the component properties.
Other
40 stars 17 forks source link

http vs https? #9

Open samblyon opened 8 years ago

samblyon commented 8 years ago

Hi, I'm getting the following error whenever I use playbackState='playing', though the video is playing: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin

This post on SO suggests it's an issue of http vs https in the api call. How can I configure the call to make sure it is using the correct url?

gajus commented 8 years ago

react-youtube-player is using youtube-player library, which abstracts the YouTube Iframe API. youtube-player loads Iframe API here, https://github.com/gajus/youtube-player/blob/bf77f9b8f0604f04a3127625e0b0fd45c359a861/src/loadYouTubeIframeAPI.js#L30.

The URL is hardcoded to use HTTPS. To make it work with HTTP, you'd need to raise a Pull Request to update https://github.com/gajus/youtube-player to load Iframe API over HTTP or HTTPS depending on the window in which the YouTube player is being loaded.