videojs / videojs-youtube

YouTube playback technology for Video.js
1.12k stars 549 forks source link

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>'). #527

Open gold2ragon opened 5 years ago

gold2ragon commented 5 years ago

I'm showing youtube videos using javascript youtube iframe api. (https://developers.google.com/youtube/iframe_api_reference)

html:

<div id="main_player"></div>

js:

main_player = new YT.Player('main_player', {
    height: '640',
    width: '1024',
    videoId: 'HBp43hgKG5M'
});

But there are some errors like this in chrome console. "Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('') does not match the recipient window's origin ('')." And sometimes the page is blank. What's the reason of this? how to solve it? I hope someone's willing help, who has experience.

gkatsev commented 5 years ago

So, this is likely an issue on youtube's side and shouldn't affect playback but it's also nothing that we can do about it. There's more information about it in the last few comments here https://github.com/videojs/videojs-youtube/issues/67#issuecomment-405951335

gold2ragon commented 5 years ago

Thank you for your answer but what can we do about the blank page when iframeapi isn't ready? only have to reload it?

gkatsev commented 5 years ago

I haven't seen any issues with a blank page. Does it happen with the video above? How often does that happen?

gold2ragon commented 5 years ago

Oh, I'm developing now. so I often reload to check updated code. Then sometimes it happens.

rodrigo-arias commented 3 years ago

Hi, did anyone find a solution for this?

video.js@7.11.4 videojs-youtube@2.6.1

javierjaraya commented 3 years ago

Alguien ya ha podido resolver este error? a la fecha (Septiembre 2021) aun esta sucediendo, es un error intermitente, aveces es capas de reproducir el video, pero en otras ocaciones queda en un loop infinito mostrando el error por consola.

rodrigo-arias commented 3 years ago

El error todavía sucede en video.js@7.14.3 y videojs-youtube@2.6.1, no impide reproducir el video pero se muestra el error en consola.

Yooololo commented 2 years ago

I've found that this issue is only on chrome, non-chromium browser don't throw these errors