Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
Error al ejecutar 'postMessage', problema con la reproducción automática de la API de YouTube

Estoy tratando de reproducir automáticamente los videos de YT y recibí el siguiente mensaje:

Error al ejecutar 'postMessage' en 'DOMWindow': el origen de destino proporcionado ('https://www.youtube.com') no coincide con el origen de la ventana del destinatario ('http://localhost:8000').

 // 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an <iframe> (and YouTube player) // after the API code downloads. var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '360', width: '640', videoId: 'M7lc1UVf-VE', playerVars: { 'autoplay': 1, 'controls': 0, 'Origin': 'http://localhost:8000' }, events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange, 'onError': onPlayerError }, host: 'https://www.youtube.com' }); }

Intenté seguir los consejos en Internet usando https, usando playerVars {origen u Origin}, host, pero nada fue efectivo... Recibo una solicitud de origen cruzado bloqueada. Habilité en httpd.conf con:

 Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, X-Token-Auth, Authorization"

pero sigue sin funcionar.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!