Skip to content

Commit f549240

Browse files
authored
fix: programatic text-tracks in Safari (#747)
* fix: programatic text-tracks in Safari * chore: bundlewatch * fix: programatic text-tracks in Safari
1 parent ac0688f commit f549240

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
},
6262
{
6363
"path": "./dist/cld-video-player.light.min.js",
64-
"maxSize": "131kb"
64+
"maxSize": "135kb"
6565
},
6666
{
6767
"path": "./lib/cld-video-player.js",

src/config/defaults.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ export default {
2727
analytics: false,
2828
cloudinaryAnalytics: true,
2929
allowUsageReport: true,
30-
playedEventPercents: [25, 50, 75, 100]
30+
playedEventPercents: [25, 50, 75, 100],
31+
html5: {
32+
nativeTextTracks: false
33+
}
3134
};

src/plugins/chapters/chapters.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ const ChaptersPlugin = (function () {
100100
default: true
101101
});
102102

103-
// required for Safari to display the captions
104-
// https://github.com/videojs/video.js/issues/8519
105-
await new Promise(resolve => setTimeout(resolve, 100));
106-
107103
const end = this.player.duration();
108104
Object.entries(this.options).forEach((entry, index, arr) => {
109105
const cue = new VTTCue(

src/plugins/paced-transcript/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ function pacedTranscript(config) {
6464
mode: options.default ? 'showing' : 'disabled'
6565
});
6666

67-
// required for Safari to display the captions
68-
// https://github.com/videojs/video.js/issues/8519
69-
await new Promise(resolve => setTimeout(resolve, 100));
70-
7167
captions.forEach(caption => {
7268
captionsTrack.track.addCue(new VTTCue(caption.startTime, caption.endTime, caption.text));
7369
});

src/plugins/srt-text-tracks/srt-text-tracks.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ function srtTextTracks(config, player) {
2727
mode: config.default ? 'showing' : 'disabled'
2828
});
2929

30-
// required for Safari to display the captions
31-
// https://github.com/videojs/video.js/issues/8519
32-
await new Promise(resolve => setTimeout(resolve, 100));
33-
3430
// Add the WebVTT data to the track
3531
webvttCues.forEach(cue => {
3632
if (cue) {
@@ -47,7 +43,7 @@ function srtTextTracks(config, player) {
4743
// SRT parser
4844
const srt2webvtt = data => {
4945
const SRTParser = new srtParser2();
50-
46+
5147
const cues = SRTParser.fromSrt(data);
5248

5349
return cues.map(cue => ({

0 commit comments

Comments
 (0)