mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix: clear stuck subtitle track cues
This commit is contained in:
parent
417539eea9
commit
f2fd96aced
1 changed files with 25 additions and 0 deletions
|
@ -620,6 +620,28 @@ function tryRemoveElement(elem) {
|
|||
return relativeOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* These browsers will not clear the existing active cue when setting an offset
|
||||
* for native TextTracks.
|
||||
* Any previous text tracks that are on the screen when the offset changes will
|
||||
* remain next to the new tracks until they reach the new offset's instance of the track.
|
||||
*/
|
||||
requiresHidingActiveCuesOnOffsetChange() {
|
||||
return !!browser.firefox;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
hideTextTrackActiveCues(currentTrack) {
|
||||
if (currentTrack.activeCues) {
|
||||
Array.from(currentTrack.activeCues).forEach((cue) => {
|
||||
cue.text = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -629,6 +651,9 @@ function tryRemoveElement(elem) {
|
|||
if (offsetValue === 0) {
|
||||
return;
|
||||
}
|
||||
if (this.requiresHidingActiveCuesOnOffsetChange()) {
|
||||
this.hideTextTrackActiveCues(currentTrack);
|
||||
}
|
||||
Array.from(currentTrack.cues)
|
||||
.forEach(function (cue) {
|
||||
cue.startTime -= offsetValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue