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,17 +575,18 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
self.setSubtitleOffset = function(offset) {
|
||||
|
||||
var offsetValue = parseFloat(offset);
|
||||
|
||||
// if .ass currently rendering
|
||||
if(currentAssRenderer){
|
||||
updateCurrentTrackOffset(offsetValue);
|
||||
} else {
|
||||
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;
|
||||
|
||||
return isVttTrackShowing || isAssTrackShowing;
|
||||
return trackElement.mode === 'showing';
|
||||
})
|
||||
.forEach(function(trackElement) {
|
||||
|
||||
@ -595,15 +596,13 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
|
||||
if(track) {
|
||||
offsetValue = updateCurrentTrackOffset(offsetValue);
|
||||
var format = (track.Codec || '').toLowerCase();
|
||||
if (format !== 'ass' && format !== 'ssa') {
|
||||
setVttSubtitleOffset(trackElement, offsetValue);
|
||||
}
|
||||
} else {
|
||||
console.log("No available track, cannot apply offset : " + offsetValue);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function updateCurrentTrackOffset(offsetValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user