redxtech / vue-plyr

A Vue component for the plyr (https://github.com/sampotts/plyr) video & audio player.
Other
768 stars 136 forks source link

Add subtitles to a Youtube iframe #479

Open gamaliny opened 2 years ago

gamaliny commented 2 years ago

Hello,

I had succesfully change dynamically the youtube id of a video by doing this: this.$refs.plyr.player.media.src = this.urlVideo; But unfortunately I don't know how to enable captions for this video, I don't have the option shown in my controls and even if I do: this.$refs.plyr.player.captions = { active: true, language: 'FR', update: true, currentTrack: this.urlSubtitles}; It's not working. I'm not sure if currentTrack is the correct attribute to set the url of the subtitles, maybe I misunderstood its purpose.

I can't create a track element dynamically because it is an iframe, if anybody can help me to enable the captions button in the controls and add the url of a subtitles file dynamically it would be great !

Thanks, Have a nice day,