Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
fix: prevent adding 2 main video tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Dec 17, 2023
1 parent 5bd0b91 commit 24a16f1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hls-video-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ const HlsVideoMixin = (superclass) => {
this.api.on(Hls.Events.MANIFEST_PARSED, (event, data) => {
removeAllMediaTracks();

const videoTrack = this.addVideoTrack('main');
videoTrack.selected = true;
let videoTrack = this.videoTracks.getTrackById('main');

if (!videoTrack) {
videoTrack = this.addVideoTrack('main');
videoTrack.id = 'main';
videoTrack.selected = true;
}

for (const [id, level] of data.levels.entries()) {
const videoRendition = videoTrack.addRendition(
Expand Down

0 comments on commit 24a16f1

Please sign in to comment.