Browse Source

1.修改视频和课程表界面

zhangmengjie 5 years ago
parent
commit
4ae35d3a3e
2 changed files with 16 additions and 9 deletions
  1. 15 8
      pages/components/CusVideo.js
  2. 1 1
      pages/components/SchedulePage.js

+ 15 - 8
pages/components/CusVideo.js

@@ -124,15 +124,19 @@ export default class CusVideo extends React.Component {
     });
   };
   play() {
-    this.setState({ paused: false });
-    // if (this.state.paused) {
-    //   this.player_icon_index = 1;
-    // } else {
-    //   this.player_icon_index = 0;
-    // }
+    if (this.state.paused) {
+      this.start();
+    } else {
+      this.pause();
+    }
   }
   pause() {
     this.setState({ paused: true });
+    this.player_icon_index = 1;
+  }
+  start() {
+    this.setState({ paused: false });
+    this.player_icon_index = 0;
   }
   showToast(params) {
     // ToastExample.message(params);
@@ -140,7 +144,10 @@ export default class CusVideo extends React.Component {
   }
 
   refreshVideo() {
-    this.setState({ duration: 0, currentTime: 0 });
+    this.setState({
+      duration: 0,
+      currentTime: 0
+    });
   }
 }
 
@@ -160,7 +167,7 @@ const styles = StyleSheet.create({
     height: "80%",
     justifyContent: "center",
     alignItems: "center",
-    backgroundColor: "red"
+    backgroundColor: "blue"
   },
   player_time: {
     backgroundColor: "red",

+ 1 - 1
pages/components/SchedulePage.js

@@ -218,6 +218,6 @@ export default class SchedulePage extends BasePage {
       video_uri: url
     });
     this.video.refreshVideo();
-    this.video.play();
+    this.video.start();
   }
 }