mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
add showingSubtitle control
This commit is contained in:
parent
b3716dc20b
commit
275fd078e2
@ -188,6 +188,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
var currentAssRenderer;
|
||||
var customTrackIndex = -1;
|
||||
|
||||
var showTrackOffset = false;
|
||||
var currentTrackOffset;
|
||||
|
||||
var videoSubtitlesElem;
|
||||
@ -545,6 +546,18 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
setCurrentTrackElement(index);
|
||||
};
|
||||
|
||||
self.enableShowingSubtitleOffset = function() {
|
||||
showTrackOffset = true;
|
||||
}
|
||||
|
||||
self.disableShowingSubtitleOffset = function() {
|
||||
showTrackOffset = false;
|
||||
}
|
||||
|
||||
self.isShowingSubtitleOffsetEnabled = function() {
|
||||
return showTrackOffset;
|
||||
}
|
||||
|
||||
self.setSubtitleOffset = function(offset) {
|
||||
|
||||
var offsetValue = parseFloat(offset);
|
||||
@ -552,7 +565,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
var mediaStreamTextTracks = getMediaStreamTextTracks(self._currentPlayOptions.mediaSource);
|
||||
|
||||
Array.from(videoElement.textTracks)
|
||||
.filter(trackElement => {
|
||||
.filter((trackElement) => {
|
||||
if (customTrackIndex === -1 ) {
|
||||
// get showing .vtt textTacks
|
||||
return trackElement.mode === 'showing';
|
||||
@ -563,7 +576,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
})
|
||||
.forEach(trackElement => {
|
||||
|
||||
var track = mediaStreamTextTracks.filter(stream => {
|
||||
var track = mediaStreamTextTracks.filter((stream) => {
|
||||
return ("textTrack" + stream.Index) === trackElement.id;
|
||||
})[0];
|
||||
|
||||
@ -596,7 +609,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
|
||||
if(currentTrack.cues) {
|
||||
Array.from(currentTrack.cues)
|
||||
.forEach(cue => {
|
||||
.forEach((cue) => {
|
||||
cue.startTime -= offsetValue;
|
||||
cue.endTime -= offsetValue;
|
||||
});
|
||||
@ -604,6 +617,10 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
|
||||
}
|
||||
|
||||
self.getSubtitleOffset = function() {
|
||||
return currentTrackOffset;
|
||||
}
|
||||
|
||||
function isAudioStreamSupported(stream, deviceProfile) {
|
||||
|
||||
var codec = (stream.Codec || '').toLowerCase();
|
||||
|
Loading…
Reference in New Issue
Block a user