mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Only load subtitle when direct play/remux
This commit is contained in:
parent
0dbd659bc4
commit
2d12aec9b4
1 changed files with 44 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
import DOMPurify from 'dompurify';
|
||||
|
||||
import browser from '../../scripts/browser';
|
||||
import appSettings from '../../scripts/settings/appSettings';
|
||||
import { appHost } from '../../components/apphost';
|
||||
import loading from '../../components/loading/loading';
|
||||
import dom from '../../scripts/dom';
|
||||
|
@ -1566,15 +1567,50 @@ export class HtmlVideoPlayer {
|
|||
return t.Index === streamIndex;
|
||||
})[0];
|
||||
|
||||
this.setTrackForDisplay(this.#mediaElement, track, targetTextTrackIndex);
|
||||
if (enableNativeTrackSupport(this._currentPlayOptions?.mediaSource, track)) {
|
||||
if (streamIndex !== -1) {
|
||||
this.setCueAppearance();
|
||||
}
|
||||
// This play method can only check if it is real direct play, and will mark Remux as Transcode as well
|
||||
const isDirectPlay = this._currentPlayOptions.playMethod === "DirectPlay";
|
||||
const burnInWhenTranscoding = appSettings.alwaysBurnInSubtitleWhenTranscoding();
|
||||
|
||||
if (!isDirectPlay && burnInWhenTranscoding) {
|
||||
const apiClient = ServerConnections.getApiClient(this._currentPlayOptions.item.ServerId);
|
||||
const sessionPromise = apiClient.getSessions({
|
||||
deviceId: apiClient.deviceId()
|
||||
}).then(function (sessions) {
|
||||
return sessions[0] || {};;
|
||||
}, function () {
|
||||
return Promise.resolve({});
|
||||
});
|
||||
|
||||
const player = this;
|
||||
|
||||
sessionPromise.then((s) => {
|
||||
if (!s.TranscodingInfo || s.TranscodingInfo?.IsVideoDirect) {
|
||||
player.setTrackForDisplay(player.#mediaElement, track, targetTextTrackIndex);
|
||||
if (enableNativeTrackSupport(player._currentPlayOptions?.mediaSource, track)) {
|
||||
if (streamIndex !== -1) {
|
||||
player.setCueAppearance();
|
||||
}
|
||||
} else {
|
||||
// null these out to disable the player's native display (handled below)
|
||||
streamIndex = -1;
|
||||
track = null;
|
||||
}
|
||||
} else {
|
||||
// unset stream when switching to transcode
|
||||
player.setTrackForDisplay(player.#mediaElement, null, -1);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// null these out to disable the player's native display (handled below)
|
||||
streamIndex = -1;
|
||||
track = null;
|
||||
this.setTrackForDisplay(this.#mediaElement, track, targetTextTrackIndex);
|
||||
if (enableNativeTrackSupport(this._currentPlayOptions?.mediaSource, track)) {
|
||||
if (streamIndex !== -1) {
|
||||
this.setCueAppearance();
|
||||
}
|
||||
} else {
|
||||
// null these out to disable the player's native display (handled below)
|
||||
streamIndex = -1;
|
||||
track = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue