video.js - How do you get the list of existing markers on the videojs-markers plugin? -
i feel silly question apologize, have little experience javascripting in general.
i have application want allow users annotate (mark) video, using https://github.com/spchuang/videojs-markers plugin videojs, , looks need.
but after allowing user add markers, want record them on database, need able raw markers structure (i.e. time , text each mark).
the code below shows have. recordmarks
function having trouble with. want marks in order me post them on database via ajax
//load marker plugin myplayer.markers({ ... markers: [ ] }); function marktime() { currenttime = gettime('mark'); myplayer.markers.add([{ time: currenttime, text: currenttime, overlaytext: 'tag', class: 'special-blue' }]); console.log('marked: ' + currenttime) } function recordmarks() { console.log(myplayer.markers.markers); // shows undefined // try way for(var =0; < myplayer.markers.length; i++){ console.log('mark ' + + ' ' + myplayer.markers[i].text); } }
given lack of solutions, ended declaring global array of markers, such every time add marker, add both global array, , player.
Comments
Post a Comment