mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into jassub
This commit is contained in:
commit
8848b75be0
101 changed files with 793 additions and 560 deletions
|
@ -30,8 +30,10 @@ import ServerConnections from '../../components/ServerConnections';
|
|||
import profileBuilder, { canPlaySecondaryAudio } from '../../scripts/browserDeviceProfile';
|
||||
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
|
||||
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../components/backdrop/backdrop';
|
||||
import { PluginType } from '../../types/plugin.ts';
|
||||
import Events from '../../utils/events.ts';
|
||||
import { includesAny } from '../../utils/container.ts';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
|
||||
/**
|
||||
* Returns resolved URL.
|
||||
|
@ -106,6 +108,9 @@ function tryRemoveElement(elem) {
|
|||
|
||||
function requireHlsPlayer(callback) {
|
||||
import('hls.js').then(({default: hls}) => {
|
||||
hls.DefaultConfig.lowLatencyMode = false;
|
||||
hls.DefaultConfig.backBufferLength = Infinity;
|
||||
hls.DefaultConfig.liveBackBufferLength = 90;
|
||||
window.Hls = hls;
|
||||
callback();
|
||||
});
|
||||
|
@ -166,7 +171,7 @@ function tryRemoveElement(elem) {
|
|||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
type = 'mediaplayer';
|
||||
type = PluginType.MediaPlayer;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
|
@ -378,7 +383,7 @@ function tryRemoveElement(elem) {
|
|||
|
||||
this.#currentTime = null;
|
||||
|
||||
this.resetSubtitleOffset();
|
||||
if (options.resetSubtitleOffset !== false) this.resetSubtitleOffset();
|
||||
|
||||
return this.createMediaElement(options).then(elem => {
|
||||
return this.updateVideoUrl(options).then(() => {
|
||||
|
@ -571,7 +576,12 @@ function tryRemoveElement(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
setSubtitleOffset(offset) {
|
||||
setSubtitleOffset = debounce(this._setSubtitleOffset, 100);
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_setSubtitleOffset(offset) {
|
||||
const offsetValue = parseFloat(offset);
|
||||
|
||||
// if .ass currently rendering
|
||||
|
@ -620,6 +630,41 @@ 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 end time of the new offset's instance of the track.
|
||||
*/
|
||||
requiresHidingActiveCuesOnOffsetChange() {
|
||||
return !!browser.firefox;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
hideTextTrackWithActiveCues(currentTrack) {
|
||||
if (currentTrack.activeCues) {
|
||||
currentTrack.mode = 'hidden';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the active cue to clear by disabling then re-enabling the track.
|
||||
* The track mode is reverted inside of a 0ms timeout to free up the track
|
||||
* and allow it to disable and clear the active cue.
|
||||
* @private
|
||||
*/
|
||||
forceClearTextTrackActiveCues(currentTrack) {
|
||||
if (currentTrack.activeCues) {
|
||||
currentTrack.mode = 'disabled';
|
||||
setTimeout(() => {
|
||||
currentTrack.mode = 'showing';
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -629,11 +674,21 @@ function tryRemoveElement(elem) {
|
|||
if (offsetValue === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const shouldClearActiveCues = this.requiresHidingActiveCuesOnOffsetChange();
|
||||
if (shouldClearActiveCues) {
|
||||
this.hideTextTrackWithActiveCues(currentTrack);
|
||||
}
|
||||
|
||||
Array.from(currentTrack.cues)
|
||||
.forEach(function (cue) {
|
||||
cue.startTime -= offsetValue;
|
||||
cue.endTime -= offsetValue;
|
||||
});
|
||||
|
||||
if (shouldClearActiveCues) {
|
||||
this.forceClearTextTrackActiveCues(currentTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,6 +826,8 @@ function tryRemoveElement(elem) {
|
|||
}
|
||||
|
||||
destroy() {
|
||||
this.setSubtitleOffset.cancel();
|
||||
|
||||
destroyHlsPlayer(this);
|
||||
destroyFlvPlayer(this);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue