Commit dda68ac0441a9197fe5accc70e7a8e9e20715f88

Authored by 648540858
1 parent 0199676a

优化录像下载,避免wvp代理使用双份流量

web_src/src/components/CloudRecord.vue
... ... @@ -6,7 +6,9 @@
6 6 </el-header>
7 7 <el-main>
8 8 <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
9   - <span style="font-size: 1rem; font-weight: bold;">云端录像</span>
  9 + <span v-if="!recordDetail" >云端录像</span>
  10 + <el-page-header v-if="recordDetail" @back="backToList" content="云端录像">
  11 + </el-page-header>
10 12 <div style="position: absolute; right: 5rem; top: 0.3rem;">
11 13 节点选择:
12 14 <el-select size="mini" @change="chooseMediaChange" style="width: 16rem; margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" :disabled="recordDetail">
... ... @@ -20,7 +22,6 @@
20 22 </div>
21 23 <div style="position: absolute; right: 1rem; top: 0.3rem;">
22 24 <el-button v-if="!recordDetail" icon="el-icon-refresh-right" circle size="mini" :loading="loading" @click="getRecordList()"></el-button>
23   - <el-button v-if="recordDetail" icon="el-icon-arrow-left" circle size="mini" @click="backToList()"></el-button>
24 25 </div>
25 26 </div>
26 27 <div v-if="!recordDetail">
... ... @@ -53,7 +54,7 @@
53 54 :total="total">
54 55 </el-pagination>
55 56 </div>
56   - <cloud-record-detail ref="cloudRecordDetail" v-if="recordDetail" :recordFile="chooseRecord" :mediaServerId="mediaServerId" ></cloud-record-detail>
  57 + <cloud-record-detail ref="cloudRecordDetail" v-if="recordDetail" :recordFile="chooseRecord" :mediaServerId="mediaServerId" :mediaServerPath="mediaServerPath" ></cloud-record-detail>
57 58 </el-main>
58 59 </el-container>
59 60 </div>
... ... @@ -72,6 +73,7 @@
72 73 return {
73 74 mediaServerList: [], // 滅体节点列表
74 75 mediaServerId: null, // 媒体服务
  76 + mediaServerPath: null, // 媒体服务地址
75 77 recordList: [], // 设备列表
76 78 chooseRecord: null, // 媒体服务
77 79  
... ... @@ -115,6 +117,11 @@
115 117 that.mediaServerList = data.data;
116 118 if (that.mediaServerList.length > 0) {
117 119 that.mediaServerId = that.mediaServerList[0].id
  120 + let port = that.mediaServerList[0].httpPort;
  121 + if (location.protocol === "https:" && that.mediaServerList[0].httpSSlPort) {
  122 + port = that.mediaServerList[0].httpSSlPort
  123 + }
  124 + that.mediaServerPath = location.protocol + "//" + that.mediaServerList[0].streamIp + ":" + port
118 125 that.getRecordList();
119 126 }
120 127 })
... ...
web_src/src/components/CloudRecordDetail.vue
... ... @@ -15,7 +15,8 @@
15 15 <i class="el-icon-video-camera" ></i>
16 16 {{ item.substring(0,17)}}
17 17 </el-tag>
18   - <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/${mediaServerId}/record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" download />
  18 +<!-- <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/${mediaServerId}/record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" download />-->
  19 + <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/download.html?url=${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" />
19 20 </li>
20 21 </ul>
21 22 </div>
... ... @@ -75,7 +76,7 @@
75 76 <li class="task-list-item" v-for="item in taskListEnded">
76 77 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;">
77 78 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
78   - <a class="el-icon-download download-btn" :href="basePath + '/' + item.recordFile" download >
  79 + <a class="el-icon-download download-btn" :href="basePath + '/download.html?url=../' + item.recordFile" target="_blank">
79 80 </a>
80 81 </div>
81 82 </li>
... ... @@ -111,10 +112,10 @@
111 112 components: {
112 113 uiHeader, player
113 114 },
114   - props: ['recordFile', 'mediaServerId', 'dateFiles'],
  115 + props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'],
115 116 data() {
116 117 return {
117   - basePath: process.env.NODE_ENV === 'development'?`${location.origin}/debug/zlm/${this.mediaServerId}`:`${location.origin}/zlm/${this.mediaServerId}`,
  118 + basePath: `${this.mediaServerPath}/record`,
118 119 dateFilesObj: [],
119 120 detailFiles: [],
120 121 chooseDate: null,
... ... @@ -264,7 +265,7 @@
264 265 this.videoUrl = "";
265 266 }else {
266 267 // TODO 控制列表滚动条
267   - this.videoUrl = `${this.basePath}/${this.mediaServerId}/record/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}`
  268 + this.videoUrl = `${this.basePath}/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}`
268 269 console.log(this.videoUrl)
269 270 }
270 271  
... ...
web_src/src/components/dialog/devicePlayer.vue
... ... @@ -287,11 +287,13 @@ export default {
287 287 // return `http://${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
288 288 if (location.protocol === "https:") {
289 289 if (streamInfo.wss_flv === null) {
290   - this.$message({
291   - showClose: true,
292   - message: '媒体服务器未配置ssl端口',
293   - type: 'error'
294   - });
  290 + console.error("媒体服务器未配置ssl端口, 使用http端口")
  291 + // this.$message({
  292 + // showClose: true,
  293 + // message: '媒体服务器未配置ssl端口, ',
  294 + // type: 'error'
  295 + // });
  296 + return streamInfo.ws_flv
295 297 }else {
296 298 return streamInfo.wss_flv;
297 299 }
... ...