Browse Source

1.修改播放器界面隐藏controller
2.查找安卓物理按键监听

zhangmengjie 5 years ago
parent
commit
7726fdcf6f
2 changed files with 25 additions and 11 deletions
  1. 10 10
      pages/components/CusVideo.js
  2. 15 1
      pages/components/SchedulePage.js

+ 10 - 10
pages/components/CusVideo.js

@@ -189,16 +189,6 @@ export default class CusVideo extends React.Component {
         return false;
       }
     });
-    if (this.state.show_controller) {
-      this.time_hideController = setTimeout(() => {
-        this.setState({
-          show_controller: false
-          // needback: false
-        });
-        this.bottomcontroller.setBottom(-50);
-        this.topcontroller.setTop(-50);
-      }, 5000);
-    }
   }
 
   loadStart() {
@@ -253,6 +243,16 @@ export default class CusVideo extends React.Component {
       player_status_icon: require("../images/video/pause.png")
     });
     this.player_icon_index = 0;
+    if (this.state.show_controller) {
+      this.time_hideController = setTimeout(() => {
+        this.setState({
+          show_controller: false
+          // needback: false
+        });
+        this.bottomcontroller.setBottom(-50);
+        this.topcontroller.setTop(-50);
+      }, 5000);
+    }
   }
 
   seekTo(progress) {

+ 15 - 1
pages/components/SchedulePage.js

@@ -120,7 +120,11 @@ export default class SchedulePage extends BasePage {
               }}
             />
           </View>
-          <View style={{ height: this.state.seat_height }} />
+          <View
+            style={{
+              height: this.state.seat_height
+            }}
+          />
           <View
             style={{
               height: this.state.flatlist_height,
@@ -256,8 +260,18 @@ export default class SchedulePage extends BasePage {
       />
     );
   }
+
+  componentWillMount() {
+    // BackAndroid.addEventListener("hardwareBackPress", this.onBackAndroid);
+  }
+  onBackAndroid() {
+    alert("返回");
+  }
   onError() {
     alert("播放器异常");
+    this.setState({
+      video_show: false
+    });
   }
   onEnd() {
     alert("播放结束");