ソースを参照

去除弹窗、优化音频声音输出

leo 1 年間 前
コミット
efae7dd3be
共有2 個のファイルを変更した15 個の追加11 個の削除を含む
  1. 4 4
      static/rtcEngine/WXtrialInterface.html
  2. 11 7
      static/rtcEngine/js/WXtrialInterface.js

+ 4 - 4
static/rtcEngine/WXtrialInterface.html

@@ -32,12 +32,12 @@
             <!-- 云机位置 -->
             <!-- 云机位置 -->
             <div class="layout-view" v-cloak>
             <div class="layout-view" v-cloak>
                 <video ref="rtcMediaPlayer" :style="rtcMediaPlayerStyle" width="100%" height="100%" autoplay
                 <video ref="rtcMediaPlayer" :style="rtcMediaPlayerStyle" width="100%" height="100%" autoplay
-                    id="playerVideo" class="videoRotate" x5-playsinline playsinline webkit-playsinline :controls="false"
-                    @touchmove.prevent="(event) => {engine.touchClick(event, 2)}"
+                    webkit-playsinline="true" playsinline x-webkit-airplay="allow" x5-video-player-type="h5"
+                    x5-video-player-fullscreen="true" x5-video-orientation="portraint" id="playerVideo"
+                    class="videoRotate" :controls="false" @touchmove.prevent="(event) => {engine.touchClick(event, 2)}"
                     @touchstart.prevent="(event) => {engine.touchClick(event, 0)}"
                     @touchstart.prevent="(event) => {engine.touchClick(event, 0)}"
                     @touchend.prevent="touchendRtcMediaPlayer" v-show="isShowVideo">
                     @touchend.prevent="touchendRtcMediaPlayer" v-show="isShowVideo">
-                    当前浏览器暂不支持、请使用谷歌浏览器或前往双子星客户端使用
-                </video>
+                    当前浏览器暂不支持、请使用谷歌浏览器或前往双子星客户端使用</video>
             </div>
             </div>
             <!-- 底部按钮 -->
             <!-- 底部按钮 -->
             <div class="layout-footer" v-cloak>
             <div class="layout-footer" v-cloak>

+ 11 - 7
static/rtcEngine/js/WXtrialInterface.js

@@ -101,7 +101,7 @@ const app = new Vue({
         layoutViewWidth: null,
         layoutViewWidth: null,
         layoutViewHeight: null,
         layoutViewHeight: null,
         // 是否显示video
         // 是否显示video
-        isShowVideo: false
+        isShowVideo: false,
 
 
     },
     },
     created() {
     created() {
@@ -238,7 +238,15 @@ const app = new Vue({
                     if (event.val === "connected") {
                     if (event.val === "connected") {
                         Toast.clear();
                         Toast.clear();
                         this.doConnectDirectives()
                         this.doConnectDirectives()
-                        playOnBtn.bind(this)()
+                        this.isShowVideo = true
+                        this.$refs.rtcMediaPlayer.volume = 0
+                        this.$refs.rtcMediaPlayer.play().then(() => {
+                            this.$refs.rtcMediaPlayer.volume = 1
+                        }).catch(error => {
+                            // Toast('如需声音,可调高音量使用')
+                            console.error('自动播放失败', error);
+                        });
+                        this.definitionFun(this.definitionValue)
                         this.pushflowPopup()
                         this.pushflowPopup()
                         this.getResidueTime()
                         this.getResidueTime()
                         return
                         return
@@ -759,11 +767,7 @@ function playOnBtn() {
         confirmButtonColor: '#3cc51f',
         confirmButtonColor: '#3cc51f',
         beforeClose: (action, done) => {
         beforeClose: (action, done) => {
             if (action === 'confirm') {
             if (action === 'confirm') {
-                this.isShowVideo = true
-                this.$refs.rtcMediaPlayer.play()
-                setTimeout(() => {
-                    this.definitionFun(this.definitionValue)
-                })
+
                 done()
                 done()
             }
             }
         }
         }