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

190
Views
Reproducir automáticamente el siguiente video para la página de inercia js y vue

¿Cómo puedo mantener el componente Player (vue-plyr), página reactiva?

reproducción automática similar a youtube/netflix, avance el video al siguiente cambiando la página, también en pantalla completa.

Mostrar.vue

 methods: { nextVideo() { console.log("next video"); Inertia.visit("/videos/" + this.plyr.next, { preserveScroll: false, preserveState: true, }); }, },

Agregué setInterval y clearInterval, pero avanzar el video funciona 1 primera vez, la segunda vez funciona, pero después de eso ya no funciona

solo funciona la primera vez

Player.vue

 <template> <vue-plyr ref="plyr"> <video crossorigin playsinline data-poster=""></video> </vue-plyr> </template> <script> import Ply from "plyr"; export default { name: "Player", props: { src: { type: String, }, poster: { type: String, }, markers: { type: Array, }, title: { type: String, }, subtitles: { type: Array, }, }, data() { return { player: null, isEnded: false, octopus: null, timerCircular: 0, timerLabel: 5, }; }, mounted() { this.player = this.$refs.plyr.player; this.player.source = { type: "video", sources: [ { src: this.src, type: "video/mp4", }, ], }; this.player.on("playing", () => console.log("player started")); this.player.on("pause", () => console.log("player paused")); this.player.on("ended", this.ended); }, beforeDestroy() { this.player.destroy(); }, watch: { src() { this.player.source = { type: "video", sources: [ { src: this.src, type: "video/mp4", }, ], }; this.player.on("ready", () => { this.player.play(); }); }, }, methods: { ended() { this.isEnded = true; const timerLabel = setInterval(() => { console.log(this.timerLabel); this.timerLabel -= 1; if (this.timerLabel == 0) { clearInterval(timerLabel); clearInterval(timerCircular); this.$parent.$parent.nextVideo(); this.isEnded = false; this.timerCircular = 0; this.timerLabel = 5; } }, 1000); const timerCircular = setInterval(() => { this.timerCircular += 5; }, 200); }, }, }; </script> <style lang="scss" scoped> </style>
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!