mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Fix subtitle sync for .ass
This commit is contained in:
parent
029e015068
commit
bccb1e6147
@ -575,35 +575,34 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
self.setSubtitleOffset = function(offset) {
|
||||
|
||||
var offsetValue = parseFloat(offset);
|
||||
var videoElement = self._mediaElement;
|
||||
var mediaStreamTextTracks = getMediaStreamTextTracks(self._currentPlayOptions.mediaSource);
|
||||
|
||||
Array.from(videoElement.textTracks)
|
||||
.filter(function(trackElement) {
|
||||
// get showing .vtt textTacks
|
||||
var isVttTrackShowing = trackElement.mode === 'showing';
|
||||
// get current .ass textTrack
|
||||
var isAssTrackShowing = ("textTrack" + customTrackIndex) === trackElement.id;
|
||||
// if .ass currently rendering
|
||||
if(currentAssRenderer){
|
||||
updateCurrentTrackOffset(offsetValue);
|
||||
} else {
|
||||
var videoElement = self._mediaElement;
|
||||
var mediaStreamTextTracks = getMediaStreamTextTracks(self._currentPlayOptions.mediaSource);
|
||||
|
||||
return isVttTrackShowing || isAssTrackShowing;
|
||||
})
|
||||
.forEach(function(trackElement) {
|
||||
Array.from(videoElement.textTracks)
|
||||
.filter(function(trackElement) {
|
||||
// get showing .vtt textTacks
|
||||
return trackElement.mode === 'showing';
|
||||
})
|
||||
.forEach(function(trackElement) {
|
||||
|
||||
var track = customTrackIndex === -1 ? null : mediaStreamTextTracks.filter(function (t) {
|
||||
return t.Index === customTrackIndex;
|
||||
})[0];
|
||||
var track = customTrackIndex === -1 ? null : mediaStreamTextTracks.filter(function (t) {
|
||||
return t.Index === customTrackIndex;
|
||||
})[0];
|
||||
|
||||
if(track) {
|
||||
offsetValue = updateCurrentTrackOffset(offsetValue);
|
||||
var format = (track.Codec || '').toLowerCase();
|
||||
if (format !== 'ass' && format !== 'ssa') {
|
||||
if(track) {
|
||||
offsetValue = updateCurrentTrackOffset(offsetValue);
|
||||
setVttSubtitleOffset(trackElement, offsetValue);
|
||||
} else {
|
||||
console.log("No available track, cannot apply offset : " + offsetValue);
|
||||
}
|
||||
} else {
|
||||
console.log("No available track, cannot apply offset : " + offsetValue);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function updateCurrentTrackOffset(offsetValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user