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

224
Views
Usando youtube-iframe-api, el método playVideo() inicia el video en Chrome (funciona en Safari y FF)

El problema se puede ver aquí: https://www.wgbh.org/news/local-news/2022/06/07/housing-is-in-short-supply-heres-why-that-matters

Al hacer clic en el botón de reproducción de la imagen del póster, la imagen del póster desaparece y el video debería comenzar a reproducirse (activado por <player>.playVideo() de la API).

Sin embargo, en Chrome (y en Brave), el usuario también debe hacer clic en el botón de reproducción nativo de YT. No se muestran errores del método playVideo() .

El clic del usuario activa la función play() en este fragmento de código (no en vivo), llamo a playVideo() cada medio segundo. El estado inicial del video es "video con clave", pero después de eso, el estado nunca cambia de "sin iniciar" y el video nunca se reproduce.

 play () { console.log('Received play signal from poster') let playerState = this.player.getPlayerState().toString() const thePlayer = this.player console.log('Pre-play-signal state: ', PLAYER_STATES[playerState]) let waitForPlay = setInterval(function () { thePlayer.playVideo() playerState = thePlayer.getPlayerState().toString() console.log('Interval play state: ', PLAYER_STATES[playerState]) if (playerState === '1') { clearInterval(waitForPlay) console.log('Final play state: ', PLAYER_STATES[playerState]) } }, 500) }

Encabezados de respuesta de las solicitudes de playVideo() :

 accept-ranges: bytes access-control-allow-credentials: true access-control-allow-origin: https://www.youtube.com access-control-expose-headers: Client-Protocol, Content-Length, Content-Type, X-Bandwidth-Est, X-Bandwidth-Est2, X-Bandwidth-Est3, X-Bandwidth-App-Limited, X-Bandwidth-Est-App-Limited, X-Bandwidth-Est-Comp, X-Bandwidth-Avg, X-Head-Time-Millis, X-Head-Time-Sec, X-Head-Seqnum, X-Response-Itag, X-Restrict-Formats-Hint, X-Sequence-Num, X-Segment-Lmt, X-Walltime-Ms alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" cache-control: private, max-age=21248 client-protocol: quic content-length: 2097152 content-type: video/webm cross-origin-resource-policy: cross-origin date: Wed, 08 Jun 2022 20:19:21 GMT expires: Wed, 08 Jun 2022 20:19:21 GMT last-modified: Tue, 07 Jun 2022 13:41:59 GMT server: gvs 1.0 timing-allow-origin: https://www.youtube.com vary: Origin x-content-type-options: nosniff x-restrict-formats-hint: None

He intentado esto con un navegador abierto con el indicador --disable-web-security , pero no hay diferencia.

Cualquier ayuda sería apreciada. Gracias.

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!