shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
239 stars 62 forks source link

Tracks are preserved until new load for HLS stream #168

Closed kareljuricka closed 3 years ago

kareljuricka commented 3 years ago

When I load manifest with

self.player.load(url) {..
  print(self.player.getVariantTracks())
  print(self.player.getTextTracks())
}

and later do it again, getVariantTracks() or getTextTracks() returns duplicit tracks. It seems like every call of load will append tracks to tracks array. So in the end there can be multiple same tracks.

I tried to call unload before new load and it didn't help.

Also I tried to destroy player instance with self.player.destroy(); Tracks stopped to duplicate, but new tracks ID aren't indexed from 0, bud they start incrementing tracks ids from previous instance. Same happened when I destroy whole ShakaPlayerViewController and removed it also from view.

It seems like something is not cleared property.

Expected behaviour: On each load of manifest tracks items aren't multiplied and I always see only available tracks.

Im using swift 5 and master version of shaka-player-embedded

EDIT: I've tested if on HLS stream with testing manifest https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8 and problem happened.

EDIT2: After more debugging I Found out only when using HLS, so when the AV player is used instead of shaka.