|  |  |  | 
|---|
|  |  |  | this.playerStyle["height"] = this.winHeight + "px"; | 
|---|
|  |  |  | this.chooseDate = moment().format('YYYY-MM-DD') | 
|---|
|  |  |  | this.dateChange(); | 
|---|
|  |  |  | window.addEventListener('beforeunload', this.stopPlayRecord) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | destroyed() { | 
|---|
|  |  |  | this.$destroy('recordVideoPlayer'); | 
|---|
|  |  |  | window.removeEventListener('beforeunload', this.stopPlayRecord) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | dateChange(){ | 
|---|
|  |  |  | 
|---|
|  |  |  | this.detailFiles = []; | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/gb_record/query/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' + this.endTime | 
|---|
|  |  |  | url: '/api/gb_record/query/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' + this.endTime | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | this.recordsLoading = false; | 
|---|
|  |  |  | if(res.data.code === 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' + | 
|---|
|  |  |  | url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' + | 
|---|
|  |  |  | this.endTime | 
|---|
|  |  |  | }).then((res)=> { | 
|---|
|  |  |  | if (res.data.code === 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log('前端控制:播放'); | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/playback/resume/' + this.streamId | 
|---|
|  |  |  | url: '/api/playback/resume/' + this.streamId | 
|---|
|  |  |  | }).then((res)=> { | 
|---|
|  |  |  | this.$refs["recordVideoPlayer"].play(this.videoUrl) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log('前端控制:暂停'); | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/playback/pause/' + this.streamId | 
|---|
|  |  |  | url: '/api/playback/pause/' + this.streamId | 
|---|
|  |  |  | }).then(function (res) {}); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | gbScale(command){ | 
|---|
|  |  |  | console.log('前端控制:倍速 ' + command); | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: `./api/playback/speed/${this.streamId }/${command}` | 
|---|
|  |  |  | url: `/api/playback/speed/${this.streamId }/${command}` | 
|---|
|  |  |  | }).then(function (res) {}); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | downloadRecord: function (row) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/gb_record/download/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' + | 
|---|
|  |  |  | url: '/api/gb_record/download/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' + | 
|---|
|  |  |  | row.endTime + '&downloadSpeed=4' | 
|---|
|  |  |  | }).then( (res)=> { | 
|---|
|  |  |  | if (res.data.code === 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.videoUrl = ''; | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.streamId | 
|---|
|  |  |  | url: '/api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.streamId | 
|---|
|  |  |  | }).then((res)=> { | 
|---|
|  |  |  | if (callback) callback(res) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | stopPlayRecord: function (callback) { | 
|---|
|  |  |  | this.$refs["recordVideoPlayer"].pause(); | 
|---|
|  |  |  | this.videoUrl = ''; | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: './api/playback/stop/' + this.deviceId + "/" + this.channelId + "/" + this.streamId | 
|---|
|  |  |  | }).then(function (res) { | 
|---|
|  |  |  | if (callback) callback() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | console.log("停止录像回放") | 
|---|
|  |  |  | if (this.streamId !== "") { | 
|---|
|  |  |  | this.$refs["recordVideoPlayer"].pause(); | 
|---|
|  |  |  | this.videoUrl = ''; | 
|---|
|  |  |  | this.$axios({ | 
|---|
|  |  |  | method: 'get', | 
|---|
|  |  |  | url: '/api/playback/stop/' + this.deviceId + "/" + this.channelId + "/" + this.streamId | 
|---|
|  |  |  | }).then(function (res) { | 
|---|
|  |  |  | if (callback) callback() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getDataWidth(item){ | 
|---|
|  |  |  | let timeForFile = this.getTimeForFile(item); | 
|---|
|  |  |  | 
|---|
|  |  |  | return hStr + ":" + mStr + ":" + sStr | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | goBack(){ | 
|---|
|  |  |  | // 如果正在进行录像回放则,发送停止 | 
|---|
|  |  |  | if (this.streamId !== "") { | 
|---|
|  |  |  | this.stopPlayRecord(()=> { | 
|---|
|  |  |  | this.streamId = ""; | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | window.history.go(-1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | </script> | 
|---|