sampotts / plyr

A simple HTML5, YouTube and Vimeo player
https://plyr.io
MIT License
26.51k stars 2.93k forks source link

Change video on button click #2002

Open sebastiano75 opened 3 years ago

sebastiano75 commented 3 years ago

Expected behaviour

I need to change video by pressing a button

Actual behaviour

The video don't change

Steps to reproduce

I tried with these line codes $('#video').source = {type : 'video/mp4', src : '../videolibrary/001.mp4', size: '480' }; player.play();

nothing happened

Environment

Console errors (if any)

Link to where the bug is happening

anilsonlopes-zz commented 3 years ago

Você precisa usar os métodos do player instanciado, algo como:

var plyr = new Plyr('#plyr')

plyr.source = {
    type: 'video/mp4',
    sources: [{
      src: '../videolibrary/001.mp4',
      size: '480'
    }]
  }

Quando as coisas não estiverem funcionando como esperado, tente ler a documentação com atenção e paciência.