Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

383
Visualizações
Youtube iframe is not working in Chrome browser on Mobile

Note: It also works fine in the incognito window of Chrome browser and other browsers (like Mozilla) on Mobile.

It loads the video data successfully but when I try to play the video it shows me an error.

Run this code using local environment like vs-code etc.

This snippet works on a computer browser properly, but when I open the same page using IP on my mobile Chrome browser, I got an error, but it works in the incognito mode and other browsers too.

I don't know why it is behaving like this, It would be really helpful if anyone can rid of this.

Computer Chrome Browser[Working fine] enter image description here

Mobile Chrome Browser [Not Playing the video] enter image description here

//YouTube embed with YouTube Iframe API
var tag = document.createElement("script");
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// YouTube embed player details
var player;
function onYouTubeIframeAPIReady() {
  player = new YT.Player("player", {
    height: "390",
    width: "640",
    videoId: "668nUCeBHyY",

    //Features
    playerVars: {
      controls: 0,
      rel: 0,
      disablekb: 1,
    },
  });
}

//functions
function playYT() {
  player.playVideo();
}

function pauseYT() {
  player.pauseVideo();
}
<div style="pointer-events:none" id="player"></div><br><br>
<button onclick="playYT()">Play</button>
<button onclick="pauseYT()">Pause</button>

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I am using Live Preview extension for the previews in browser. You need change default(127.0.0.1) IP address in the extension settings to be able see the pages on other devices: enter image description here


If you are using Live Server extension then change following setting: enter image description here


If you just want to host the files without VSCode then you can use http-server tool. It is a simple, zero-configuration command-line static HTTP server. All you have to do is provide it the folder path and it'll host all the files in it.

If you are facing any other issue then let us know the exact error and the browser you are using on mobile.

about 4 years ago · Juan Pablo Isaza Relatório

0

Disable all of your browser extensions

I known is sounds like a simple answer but try it. This happens to me all the time. Probably one or more of you browser extensions is blocking the Youtube imbedded iframe from showing for more security or privacy. I know that Blocksi extension for Chrome blocks Youtube embeds. enter image description here

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda