Start a new topic

Help with metadata: stopping+starting in Firefox

I have a problem that when stopping play and starting it again, I lose the metadata events in Firefox.  (I believe it was the same in Chrome a while ago, but it works in the latest version).

After 1 to 4 stops+starts, the metadata stops coming.

I stop the live audio stream using viblast(aud).stop(). There are metadata issues also when pausing it for a longer time, but I do not want to pause.

Each time I hit play, I run viblast(aud).setup() and aud.textTracks.addEventListener(). I'm thinking if I could destroy some viblast objects and recreate them, it would fix the issue. textTracks.removeEventListener did nothing useful.

Demo project, based on your demo player with metadata, without videojs. (The php code does nothing special).

Any tips for me?


The issue is in your js:


aud.textTracks.addEventListener('addtrack', function(addTrackEvent) {
var track = aud.textTracks[0];


Replace the second line with:

var track = addTrackEvent.track;

in this way you will get the actual track added to the dom element.

By pressing  stop/play, a new text track is created and added to the end of the track list. This is really strange how it works with Chrome, but the reason to see the issue with Firefox is that on "addtrack" event,  you add listener to the first track created, which is never changed after the second one is created.

The patch above is tested and seems to work as expected.

It's working. Thank you so much!

I found the event code on your site long ago, but it appears fixed there too.

Login to post a comment