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

299
Visualizações
"VIDEOJS: WARN: Player "media" is already initialized" when it is not

I currently experience a small issue where I receive a warning from video.js which is as following:

VIDEOJS: WARN: Player "media" is already initialized. Options will not be applied.

The bizarre thing is that it has not been initialized. But rather it is within a jQuery's $(document).ready.

The relevant code is:

<script src="//vjs.zencdn.net/5.19.1/video.min.js"></script>

<script>
    $(document).ready(function() {
        var player = videojs('media', {
            fluid: true,
            playbackRates: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]
        });
    });
<script>

It know it has something to do with when how fast these resources get loaded, because every now and then the warning will not appear and the options are applied.

I do need this the player initialized once the "document is ready", though. How can I go about this issue?

Any help I would greatly appreciate!

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I had the same problem. Videojs gets automatically initialized when the data-setup attribute is present in the <video> tag.

Remove data-setup and the player will not initialize by itself, the warning will not show up anymore when you execute the JS code now:

var player = videojs('media', options);

Now you can define the options and simply do ("media" is the id of your videoplayer):

var options = {
    "playbackRates": [1, 1.5, 2],
};

var video = videojs('media', options);

video.ready(function() {
    // …
});
over 4 years ago · Santiago Trujillo Relatório

0

I also face the same problem. Videojs gets automatically initialized

Just Remove "data-setup" and the player will not initialize by itself

remove data-setup

over 4 years ago · Santiago Trujillo Relatório

0

use this code after mounted() in vue

beforeDestroy() {
    if (this.player) {
        this.player.dispose()
    }
}
over 4 years ago · Santiago Trujillo 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