1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update hls subtitles

This commit is contained in:
Luke Pulverenti 2016-03-07 13:50:58 -05:00
parent 053fd6388e
commit d0afade8ed
4 changed files with 14 additions and 11 deletions

View file

@ -513,7 +513,10 @@
function enableNativeTrackSupport(track) {
if (browserInfo.safari) {
return false;
if (navigator.userAgent.toLowerCase().indexOf('os x') == -1) {
// Leave it to apple to have different behavior between safari on ios vs osx
return false;
}
}
if (browserInfo.firefox) {
@ -594,13 +597,13 @@
trackElement.label = 'manualTrack' + track.index;
// download the track json
fetchSubtitles(track).then(function(data) {
fetchSubtitles(track).then(function (data) {
// show in ui
console.log('downloaded ' + data.TrackEvents.length + ' track events');
// add some cues to show the text
// in safari, the cues need to be added before setting the track mode to showing
data.TrackEvents.forEach(function(trackEvent) {
data.TrackEvents.forEach(function (trackEvent) {
trackElement.addCue(new VTTCue(trackEvent.StartPositionTicks / 10000000, trackEvent.EndPositionTicks / 10000000, trackEvent.Text.replace(/\\N/gi, '\n')));
});
trackElement.mode = 'showing';