mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
Merge pull request #519 from dhartung/fix-#518
Fix subtitle display from previous file in queue
This commit is contained in:
commit
6208f2b1c3
@ -30,6 +30,7 @@
|
|||||||
- [Nickbert7](https://github.com/Nickbert7)
|
- [Nickbert7](https://github.com/Nickbert7)
|
||||||
- [ferferga](https://github.com/ferferga)
|
- [ferferga](https://github.com/ferferga)
|
||||||
- [bilde2910](https://github.com/bilde2910)
|
- [bilde2910](https://github.com/bilde2910)
|
||||||
|
- [Daniel Hartung](https://github.com/dhartung)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
@ -1192,24 +1192,26 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
var trackElement = null;
|
var trackElement = null;
|
||||||
var expectedId = 'manualTrack' + track.Index;
|
if (videoElement.textTracks && videoElement.textTracks.length > 0) {
|
||||||
|
trackElement = videoElement.textTracks[0];
|
||||||
|
|
||||||
// get list of tracks
|
// This throws an error in IE, but is fine in chrome
|
||||||
var allTracks = videoElement.textTracks;
|
// In IE it's not necessary anyway because changing the src seems to be enough
|
||||||
for (var i = 0; i < allTracks.length; i++) {
|
try {
|
||||||
|
trackElement.mode = 'showing';
|
||||||
|
while (trackElement.cues.length) {
|
||||||
|
trackElement.removeCue(trackElement.cues[0]);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error removing cue from textTrack');
|
||||||
|
}
|
||||||
|
|
||||||
var currentTrack = allTracks[i];
|
trackElement.mode = 'disabled';
|
||||||
|
|
||||||
if (currentTrack.label === expectedId) {
|
|
||||||
trackElement = currentTrack;
|
|
||||||
break;
|
|
||||||
} else {
|
} else {
|
||||||
currentTrack.mode = 'disabled';
|
// There is a function addTextTrack but no function for removeTextTrack
|
||||||
|
// Therefore we add ONE element and replace its cue data
|
||||||
|
trackElement = videoElement.addTextTrack('subtitles', 'manualTrack', 'und');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!trackElement) {
|
|
||||||
trackElement = videoElement.addTextTrack('subtitles', 'manualTrack' + track.Index, track.Language || 'und');
|
|
||||||
|
|
||||||
// download the track json
|
// download the track json
|
||||||
fetchSubtitles(track, item).then(function (data) {
|
fetchSubtitles(track, item).then(function (data) {
|
||||||
@ -1227,9 +1229,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||||||
});
|
});
|
||||||
trackElement.mode = 'showing';
|
trackElement.mode = 'showing';
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
trackElement.mode = 'showing';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSubtitleText(timeMs) {
|
function updateSubtitleText(timeMs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user