ExoPlayer (#426)
This commit is contained in:
committed by
Matt Apperson
parent
cd53e389a0
commit
9a936c9e8f
@@ -19,6 +19,7 @@ class VideoPlayer extends Component {
|
||||
super(props);
|
||||
this.onLoad = this.onLoad.bind(this);
|
||||
this.onProgress = this.onProgress.bind(this);
|
||||
this.onBuffer = this.onBuffer.bind(this);
|
||||
}
|
||||
state = {
|
||||
rate: 1,
|
||||
@@ -29,7 +30,8 @@ class VideoPlayer extends Component {
|
||||
currentTime: 0.0,
|
||||
controls: false,
|
||||
paused: true,
|
||||
skin: 'custom'
|
||||
skin: 'custom',
|
||||
isBuffering: false,
|
||||
};
|
||||
|
||||
onLoad(data) {
|
||||
@@ -41,6 +43,10 @@ class VideoPlayer extends Component {
|
||||
this.setState({currentTime: data.currentTime});
|
||||
}
|
||||
|
||||
onBuffer({ isBuffering }: { isBuffering: boolean }) {
|
||||
this.setState({ isBuffering });
|
||||
}
|
||||
|
||||
getCurrentTimePercentage() {
|
||||
if (this.state.currentTime > 0) {
|
||||
return parseFloat(this.state.currentTime) / parseFloat(this.state.duration);
|
||||
@@ -116,6 +122,7 @@ class VideoPlayer extends Component {
|
||||
muted={this.state.muted}
|
||||
resizeMode={this.state.resizeMode}
|
||||
onLoad={this.onLoad}
|
||||
onBuffer={this.onBuffer}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={() => { AlertIOS.alert('Done!') }}
|
||||
repeat={true}
|
||||
@@ -175,6 +182,7 @@ class VideoPlayer extends Component {
|
||||
muted={this.state.muted}
|
||||
resizeMode={this.state.resizeMode}
|
||||
onLoad={this.onLoad}
|
||||
onBuffer={this.onBuffer}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={() => { AlertIOS.alert('Done!') }}
|
||||
repeat={true}
|
||||
|
Reference in New Issue
Block a user