Skip to content

Commit

Permalink
fix: programatic text-tracks in Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
tsi committed Dec 8, 2024
1 parent 8a896fe commit 58a1cb1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default {
allowUsageReport: true,
playedEventPercents: [25, 50, 75, 100],
html5: {
nativeTextTracks: !videojs?.browser?.IS_SAFARI
nativeTextTracks: false
}
};
4 changes: 0 additions & 4 deletions src/plugins/chapters/chapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ const ChaptersPlugin = (function () {
default: true
});

// required for Safari to display the captions
// https://github.com/videojs/video.js/issues/8519
await new Promise(resolve => setTimeout(resolve, 100));

const end = this.player.duration();
Object.entries(this.options).forEach((entry, index, arr) => {
const cue = new VTTCue(
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/paced-transcript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ function pacedTranscript(config) {
mode: options.default ? 'showing' : 'disabled'
});

// required for Safari to display the captions
// https://github.com/videojs/video.js/issues/8519
await new Promise(resolve => setTimeout(resolve, 100));

captions.forEach(caption => {
captionsTrack.track.addCue(new VTTCue(caption.startTime, caption.endTime, caption.text));
});
Expand Down
6 changes: 1 addition & 5 deletions src/plugins/srt-text-tracks/srt-text-tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ function srtTextTracks(config, player) {
mode: config.default ? 'showing' : 'disabled'
});

// required for Safari to display the captions
// https://github.com/videojs/video.js/issues/8519
await new Promise(resolve => setTimeout(resolve, 100));

// Add the WebVTT data to the track
webvttCues.forEach(cue => {
if (cue) {
Expand All @@ -47,7 +43,7 @@ function srtTextTracks(config, player) {
// SRT parser
const srt2webvtt = data => {
const SRTParser = new srtParser2();

const cues = SRTParser.fromSrt(data);

return cues.map(cue => ({
Expand Down

0 comments on commit 58a1cb1

Please sign in to comment.