|
@@ -27,7 +27,7 @@ export default class CusVideo extends React.Component {
|
|
|
resizeMode: "stretch",
|
|
|
duration: 0.0,
|
|
|
currentTime: 0.0,
|
|
|
- paused: true,
|
|
|
+ paused: false,
|
|
|
wheel: false
|
|
|
};
|
|
|
|
|
@@ -39,7 +39,12 @@ export default class CusVideo extends React.Component {
|
|
|
source={{
|
|
|
uri: this.props.uri
|
|
|
}}
|
|
|
+ ref={ref => {
|
|
|
+ this.player = ref;
|
|
|
+ }}
|
|
|
+
|
|
|
resizeMode={this.state.resizeMode}
|
|
|
+
|
|
|
rate={this.state.rate}
|
|
|
paused={this.state.paused}
|
|
|
volume={this.state.volume}
|
|
@@ -52,6 +57,9 @@ export default class CusVideo extends React.Component {
|
|
|
onAudioBecomingNoisy={this.onAudioBecomingNoisy}
|
|
|
onAudioFocusChanged={this.onAudioFocusChanged}
|
|
|
repeat={this.state.wheel}
|
|
|
+ onError={this.onError}
|
|
|
+ playInBackground={false}
|
|
|
+ playWhenInactive={true}
|
|
|
/>
|
|
|
<View style={[styles.player_controller]}>
|
|
|
<View
|
|
@@ -106,13 +114,22 @@ export default class CusVideo extends React.Component {
|
|
|
{formatTime(this.state.duration)}
|
|
|
</Text>
|
|
|
</View>
|
|
|
+ <TouchableOpacity
|
|
|
+ style={{ flex: 1 }}
|
|
|
+ onPress={() => this.presentFullscreenPlayer()}
|
|
|
+ >
|
|
|
+ <View style={{ flex: 1 }}>
|
|
|
+ {}
|
|
|
+ <Image style={[styles.player_pause_icon]} />
|
|
|
+ </View>
|
|
|
+ </TouchableOpacity>
|
|
|
</View>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
loadStart() {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
onLoad = data => {
|
|
|
|
|
@@ -123,6 +140,13 @@ export default class CusVideo extends React.Component {
|
|
|
currentTime: data.currentTime
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ onError() {
|
|
|
+ alert("播放器异常");
|
|
|
+ }
|
|
|
+ onEnd() {
|
|
|
+ alert("播放结束");
|
|
|
+ }
|
|
|
play() {
|
|
|
if (this.state.paused) {
|
|
|
this.start();
|
|
@@ -142,6 +166,11 @@ export default class CusVideo extends React.Component {
|
|
|
|
|
|
ToastExample.show(params, ToastExample.SHORT);
|
|
|
}
|
|
|
+ presentFullscreenPlayer() {
|
|
|
+
|
|
|
+ this.props.videofullScreenPlayer();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
refreshVideo() {
|
|
|
this.setState({
|
|
@@ -158,8 +187,7 @@ const styles = StyleSheet.create({
|
|
|
width: "100%",
|
|
|
height: 50,
|
|
|
alignItems: "center",
|
|
|
- bottom: 0,
|
|
|
- backgroundColor: "powderblue"
|
|
|
+ bottom: 0
|
|
|
},
|
|
|
player_pause_icon: {
|
|
|
width: "100%",
|
|
@@ -170,8 +198,8 @@ const styles = StyleSheet.create({
|
|
|
backgroundColor: "blue"
|
|
|
},
|
|
|
player_time: {
|
|
|
- backgroundColor: "red",
|
|
|
- fontSize: 30,
|
|
|
+ fontSize: 18,
|
|
|
+ color: "white",
|
|
|
alignItems: "center",
|
|
|
justifyContent: "center",
|
|
|
textAlignVertical: "center",
|