Skip to content

Commit

Permalink
fix: programatic text-tracks in Safari (#747)
Browse files Browse the repository at this point in the history
* fix: programatic text-tracks in Safari

* chore: bundlewatch

* fix: programatic text-tracks in Safari
  • Loading branch information
tsi authored Dec 8, 2024
1 parent ac0688f commit f549240
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"path": "./dist/cld-video-player.light.min.js",
"maxSize": "131kb"
"maxSize": "135kb"
},
{
"path": "./lib/cld-video-player.js",
Expand Down
5 changes: 4 additions & 1 deletion src/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ export default {
analytics: false,
cloudinaryAnalytics: true,
allowUsageReport: true,
playedEventPercents: [25, 50, 75, 100]
playedEventPercents: [25, 50, 75, 100],
html5: {
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 f549240

Please sign in to comment.