Skip to content

Commit

Permalink
Warn and detach media if attempting to attach while when media is alr…
Browse files Browse the repository at this point in the history
…eady attached
  • Loading branch information
robwalch committed Nov 19, 2024
1 parent 5f76328 commit 793bab2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ export default class Hls implements HlsEventEmitter {
return;
}
this.logger.log(`attachMedia`);
if (this._media) {
this.logger.warn(`media must be detached before attaching`);
this.detachMedia();
}
const attachMediaSource = 'media' in data;
const media = attachMediaSource ? data.media : data;
const attachingData = attachMediaSource ? data : { media };
Expand Down

0 comments on commit 793bab2

Please sign in to comment.