Ver código fonte

音视频切换

bayi 1 ano atrás
pai
commit
57716687b4

+ 2 - 2
components/videoPreview/index.wxml

@@ -38,7 +38,7 @@
     </view>
   </view>
   <!-- 视频 -->
-  <view class="workContent" wx:if="{{else}}">
+  <view class="workContent" wx:if="{{!videoInfoCopy.userReadExtend}}">
     <!-- 审核中遮罩 -->
     <view class="videoBox" wx:if="{{videoInfoCopy.userRead.status=='CHECK'&&videoInfoCopy.userRead.id!=currentId}}">
       <view class="maskBg"></view>
@@ -57,7 +57,7 @@
     </video>
   </view>
   <!-- 音频 -->
-  <view class="workContent" >
+  <view class="workContent" wx:else>
     <view class="audioBox">
       <image src="{{videoInfoCopy.userRead.coverImg}}" class="audioBg" mode="" />
       <view class="mask"></view>

+ 2 - 9
pages/reading/index.js

@@ -333,9 +333,7 @@ Page({
     })
   },
   videoPlay() {
-    console.log('触发');
     if (this.data.readingReset) {
-      console.log('触发2');
       this.resultAudioContext = wx.createInnerAudioContext();
       this.resultAudioContext.src = this.data.readDetail.tempFilePath; // 这里可以是录音的临时路径
       this.resultAudioContext.play();
@@ -352,8 +350,7 @@ Page({
   },
   // 控制视频或音频的播放状态
   playMediaState() {
-    // if(videoInfo.userReadExtend){
-    if (false) {
+    if (this.data.videoInfo.userReadExtend) {
       this.videoContext.play()
     } else {
       this.innerAudioContext.play();
@@ -361,8 +358,7 @@ Page({
   },
   // 控制视频或音频的暂停状态
   stopMediaState() {
-    // if(videoInfo.userReadExtend){
-    if (false) {
+    if (this.data.videoInfo.userReadExtend) {
       this.videoContext.stop()
       this.videoContext.seek(0)
     } else {
@@ -393,7 +389,4 @@ Page({
     clearTimeout(this.setTimeoutObj)
     clearInterval(this.stl)
   },
-  onShareAppMessage() {
-
-  }
 })

+ 3 - 3
pages/reading/index.wxml

@@ -1,10 +1,10 @@
 <view class="readingBox">
-  <!--  <block>
+  <block wx:if="{{!videoInfo.userReadExtend}}">
     <image src="{{videoInfo.userRead.coverImg}}" class='poster' wx:if="{{!state&&!readingReset}}" />
     <video id="myVideo" src="{{videoInfo.userRead.originVideo}}" bindended='videoEnd' controls="{{false}}"
       show-center-play-btn="{{readingReset}}" bindplay='videoPlay'></video>
-  </block> -->
-  <view class="audio" wx:if="{{true}}">
+  </block>
+  <view class="audio" wx:else>
     <image src="{{videoInfo.userRead.coverImg}}" class="audioBg" mode="" />
     <view class="mask"></view>
     <view class="audioPlay">