Browse Source

增加sip的录音播放功能

vothin 1 year ago
parent
commit
aaddc614f0
1 changed files with 65 additions and 54 deletions
  1. 65 54
      src/views/ncs-interaction/index.vue

+ 65 - 54
src/views/ncs-interaction/index.vue

@@ -61,63 +61,61 @@
         @current-change="handlePageCurrentChange"
       />
     </ag-grid-layout>
-      <el-dialog :v-loading="this.loading" :title="this.$t('interaction.recordPlay')" :visible.sync="dialogVisible" :before-close="stop" width="70%">
-        <template>
-          <el-row v-if="this.streamingType">
-            <el-col :span="12">
-              <video
+    <el-dialog :v-loading="this.loading" :title="this.$t('interaction.recordPlay')" :visible.sync="dialogVisible" :before-close="stop" :width="this.streaming2Show ? '70%' : '40%'">
+      <template>
+        <el-row v-if="this.streamingType">
+          <el-col :span="this.streaming2Show ? 12 : 24">
+            <video
+              :src="this.srcStreaming1"
+              autoplay="autoplay"
+              controls="controls"
+              ref="video1"
+              style="width: 98%"
+            >
+            </video>
+          </el-col>
+
+          <el-col :span="12" v-show="this.streaming2Show">
+            <video
+              :src="this.srcStreaming2"
+              autoplay="autoplay"
+              controls="controls"
+              ref="video2"
+              style="width: 98%"
+            >
+            </video>
+          </el-col>
+        </el-row>
+
+        <el-row v-else>
+          <el-col :span="this.streaming2Show ? 12 : 24">
+            <audio
                 :src="this.srcStreaming1"
                 autoplay="autoplay"
                 controls="controls"
-                ref="video1"
+                ref="audio1"
                 style="width: 98%"
-              >
-              </video>
-            </el-col>
+            >
+            </audio>
+          </el-col>
 
-            <el-col :span="12">
-              <video
+          <el-col :span="12" v-show="streaming2Show">
+            <audio
                 :src="this.srcStreaming2"
                 autoplay="autoplay"
                 controls="controls"
-                ref="video2"
+                ref="audio2"
                 style="width: 98%"
-              >
-              </video>
-            </el-col>
-          </el-row>
-
-          <el-row v-else>
-
-            <el-col :span="12">
-              <audio
-                  :src="this.srcStreaming1"
-                  autoplay="autoplay"
-                  controls="controls"
-                  ref="audio1"
-                  style="width: 98%"
-              >
-              </audio>
-            </el-col>
-
-            <el-col :span="12">
-              <audio
-                  :src="this.srcStreaming2"
-                  autoplay="autoplay"
-                  controls="controls"
-                  ref="audio2"
-                  style="width: 98%"
-              >
-              </audio>
-            </el-col>
-          </el-row>
-
-          <div slot="footer" class="dialog-footer" style="text-align: center">
-            <el-button ref="play" type="primary" @click="onclick('onclick')"> {{ this.buttonStr }} </el-button>
-          </div>
-        </template>
-      </el-dialog>
+            >
+            </audio>
+          </el-col>
+        </el-row>
 
+        <div slot="footer" class="dialog-footer" style="text-align: center">
+          <el-button ref="play" type="primary" @click="onclick('onclick')"> {{ this.buttonStr }} </el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -132,6 +130,7 @@ import RecordButtonCellRender from "@/components/AgGridCellRender/RecordButtonCe
 import RadioFilter from "@/components/AgGridCustomFilter/RadioFilter";
 import ListFilter from "@/components/AgGridCustomFilter/ListFilter";
 import * as API_Part from "@/api/ncs_partInfo";
+import * as API_ServiceInfo from "@/api/ncs_service_info";
 const DeviceUrl = domain.DeviceUrl
 
 export default {
@@ -198,8 +197,9 @@ export default {
       beginSeconds: 0,
       buttonStr: this.$t('action.play'),
       dialogVisible: false,
+      streaming2Show: false,
       streamingType: true,
-      recordDir: '',
+      recordDir: ''
     }
   },
   computed: {
@@ -611,13 +611,24 @@ export default {
             this.streamingType = true
           } else if (res[0].endsWith("opus")) {
             this.streamingType = false
+          } else if (res[0].endsWith("wav")) {
+            this.streamingType = false
           }
 
-          this.srcStreaming1 = DeviceUrl + res[0]
-          this.srcStreaming2 = DeviceUrl + res[1]
-          console.log(this.srcStreaming1)
-          console.log(this.srcStreaming2)
-          this.dialogVisible = true
+          if (res.length === 2) {
+            this.streaming2Show = true
+            this.srcStreaming1 = DeviceUrl + res[0]
+            this.srcStreaming2 = DeviceUrl + res[1]
+            console.log(this.srcStreaming1)
+            console.log(this.srcStreaming2)
+            this.dialogVisible = true
+          }
+          else {
+            this.streaming2Show = false
+            this.srcStreaming1 = DeviceUrl + res[0]
+            console.log(this.srcStreaming1)
+            this.dialogVisible = true
+          }
         } else {
           this.$message(this.$t('action.noFile'))
         }
@@ -664,7 +675,7 @@ export default {
         this.$refs.audio2.pause()
       }
       this.dialogVisible = false
-    },
+    }
   }
 }
 </script>