Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
Vue and videojs: how reload video

In Vue (3) how can i reload the videojs?

I have the following code:

<template>
  <video-js controls="true" preload="auto" ref="video_player" class="video-js vjs-big-play-centered">
  </video-js>
</template>


<script>

    import videojs from 'video.js'

    export default {
       data() {
         return {
          player: null
         };
       },


       mounted() {
          const element = this.$refs.video_player;
          console.log(element);

          this.player = videojs(element, {
             fluid: true,
             responsive: true,
             playbackRates: [0.5, 1, 1.5, 2],
             sources: [
             {
               src: 'url',
               type: 'application/x-mpegURL'
             }]
           })

</script>

The first time i call the component it works.

The second time, because the url is the same (change only the param id) the component is reused. I need to force the component reload because videojs on dispose method destroy the dom.

So, how can i reuse the video player with vue js or force the component to re-render (so calling again creating and mounting)?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Let's call your component videoComponent

<VideoComponent></VideoComponent>

You can add key attribute to your component.

Thanks to that it will be re-rendered when key is changed

<VideoComponent :key="someUniqueParamId"></VideoComponent>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda