-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ios): fix sideloading external subtitles (#3690)
* fix(ios): fix subtitles side loading * update example * Update examples/basic/src/VideoPlayer.tsx Co-authored-by: Olivier Bouillet <[email protected]> * Update examples/basic/src/VideoPlayer.tsx Co-authored-by: Olivier Bouillet <[email protected]> --------- Co-authored-by: Olivier Bouillet <[email protected]>
- Loading branch information
1 parent
b5ccc48
commit efa1c52
Showing
2 changed files
with
20 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,8 +134,10 @@ class VideoPlayer extends Component { | |
uri: 'https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8', | ||
}, | ||
{ | ||
description: 'sintel with sideLoaded subtitles', | ||
uri: 'https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8', // this is sample video, my actual video file is MP4 | ||
description: 'BigBugBunny sideLoaded subtitles', | ||
// sideloaded subtitles wont work for streaming like HLS on ios | ||
// mp4 | ||
uri: 'https://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4', | ||
textTracks: [ | ||
{ | ||
title: 'test', | ||
|
@@ -195,7 +197,7 @@ class VideoPlayer extends Component { | |
description: 'rtsp big bug bunny', | ||
uri: 'rtsp://rtspstream:[email protected]/movie', | ||
type: 'rtsp', | ||
} | ||
}, | ||
]; | ||
|
||
// poster which can be displayed | ||
|
@@ -237,23 +239,23 @@ class VideoPlayer extends Component { | |
|
||
updateSeeker = () => { | ||
// put this code in timeout as because it may be put just after a setState | ||
setTimeout(()=> { | ||
setTimeout(() => { | ||
const position = this.calculateSeekerPosition(); | ||
this.setSeekerPosition(position); | ||
}, 1) | ||
} | ||
}, 1); | ||
}; | ||
|
||
onProgress = (data: OnProgressData) => { | ||
this.setState({currentTime: data.currentTime}); | ||
if (!this.state.seeking) { | ||
this.updateSeeker() | ||
this.updateSeeker(); | ||
} | ||
}; | ||
|
||
onSeek = (data: OnSeekData) => { | ||
this.setState({currentTime: data.currentTime}); | ||
this.updateSeeker() | ||
} | ||
this.updateSeeker(); | ||
}; | ||
|
||
onVideoLoadStart = () => { | ||
console.log('onVideoLoadStart'); | ||
|
@@ -363,11 +365,11 @@ class VideoPlayer extends Component { | |
|
||
onPlaybackRateChange = (data: OnPlaybackRateChangeData) => { | ||
console.log('onPlaybackRateChange', data); | ||
} | ||
}; | ||
|
||
onPlaybackStateChanged = (data: OnPlaybackStateChangedData) => { | ||
console.log('onPlaybackStateChanged', data); | ||
} | ||
}; | ||
|
||
toggleFullscreen() { | ||
this.setState({fullscreen: !this.state.fullscreen}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters