videojs / videojs-playlist

Playlist plugin for videojs
Other
361 stars 123 forks source link

How do I get the name of the currently playing video #252

Closed jkirkcaldy closed 11 months ago

jkirkcaldy commented 11 months ago

My playlist is created dynamically and I need to get the name of the current playing video, not the source of the file. playlist looks like:

{
    name: "{{ video.clip }}",
    sources: [{
        src: "{{ video.filepath }}",
        type: "application/x-mpegURL"
      }],
},
jkirkcaldy commented 11 months ago

nevermind, goit it with:

    var index = player.playlist.currentIndex()
    var playlist = player.playlist()
    document.getElementById("clip_name").innerHTML = playlist[index].name;