Browse Source

1.设置播放器不自动播放

zhangmengjie 5 years ago
parent
commit
a1f52b3bc9
2 changed files with 21 additions and 14 deletions
  1. 20 13
      pages/components/CusVideo.js
  2. 1 1
      pages/components/SchedulePage.js

+ 20 - 13
pages/components/CusVideo.js

@@ -42,7 +42,7 @@ export default class CusVideo extends React.Component {
     resizeMode: "stretch",
     duration: 0.0,
     currentTime: 0.0,
-    paused: false,
+    paused: true,
     wheel: false,
     isFull: false,
     needback: this.props.needback,
@@ -141,6 +141,9 @@ export default class CusVideo extends React.Component {
   }
 
   componentWillMount() {
+    if (this.state.pause) {
+    }
+
     this.videotouch = PanResponder.create({
       onStartShouldSetPanResponder: (evt, gestureState) => true,
       onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
@@ -561,18 +564,22 @@ const styles = StyleSheet.create({
 
 /**
   使用方法
-  <CusVideo
-      uri={this.state.video_uri}
-       ref={view => (this.video = view)}
-       needback={true} //(是否需要小窗口的返回按钮)
-       videoback={this.clickVideoBack.bind(this)}//(小窗口返回按钮的事件)
-       videofullScreenPlayer={this.fullScreenPlayer.bind(this)}//(点击全屏按钮的事件)
-       style={{
-       flex: this.state.video_flex,
-         width: this.state.video_width,
-         height: this.state.video_height
-         }}
-   />
+    <CusVideo
+          show={this.state.video_show} //是否显示
+          uri={this.state.video_uri}  //播放路径
+          ref={view => (this.video = view)} //设置ID
+          needback={false}
+          videoback={() => alert("videoback")}
+          videofullScreenPlayer={this.fullScreenPlayer.bind(this)}
+          style={{
+            left: this.state.x,
+            top: this.state.y,
+            width: this.state.video_width,
+            height: this.state.video_height,
+            overflow: "hidden",
+            position: "absolute"
+          }}
+        />
 
 
  */

+ 1 - 1
pages/components/SchedulePage.js

@@ -50,7 +50,7 @@ export default class SchedulePage extends BasePage {
       videoImage_x: 0.0,
       videoImage_y: 0.0,
       video_uri:
-        "http://efunvideo.ai160.com/vs2m/056/05602002/05602002001/05602002001.m3u8",
+        "https://www.apple.com/105/media/cn/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-cn-20170912_1280x720h.mp4",
       title_height: "6%",
       video_frame_height: "32%",
       seat_height: "2%",