mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
1.优化代码
This commit is contained in:
@@ -59,13 +59,6 @@ export function getStreaminfo(deviceId, channelId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function playback(deviceId, channelId, query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/player/playback/' + deviceId + "/" + channelId,
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function closeStream(deviceId, channelId, streamId){
|
export function closeStream(deviceId, channelId, streamId){
|
||||||
return request({
|
return request({
|
||||||
@@ -74,32 +67,3 @@ export function closeStream(deviceId, channelId, streamId){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function playbackPause(deviceId, channelId, streamId) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/player/playbackPause/' + deviceId + "/" + channelId + "/" + streamId,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function playbackReplay(deviceId, channelId, streamId) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/player/playbackReplay/' + deviceId + "/" + channelId + "/" + streamId,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function playbackSeek(deviceId, channelId, streamId, query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/player/playbackSeek/' + deviceId + "/" + channelId + "/" + streamId,
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function playbackSpeed(deviceId, channelId, streamId, query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/player/playbackSpeed/' + deviceId + "/" + channelId + "/" + streamId,
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
export function getDevRecord(deviceId,channelId,query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/devquery/' + deviceId + "/" + channelId,
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getRecord(channelId,sn) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/query/' + channelId + "/" + sn,
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecord(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecordByDate(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/date/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecordByStream(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/stream/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecordByApp(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/app/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecordByFile(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/file/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerRecordByDevice(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/serverRecord/device/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function startPlayRecord(deviceId, channelId) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/play/' + deviceId + "/" + channelId,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function startDownloadRecord(deviceId, channelId, query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/download/' + deviceId + "/" + channelId,
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function uploadRecord(query) {
|
|
||||||
return request({
|
|
||||||
url: '/sip/record/upload',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
<span style="margin: 10px 10px 10px 30px">开启拉流:</span>
|
<span style="margin: 10px 10px 10px 30px">开启拉流:</span>
|
||||||
<el-switch v-model="pushStream" active-color="#13ce66" inactive-color="#c4c6c9" style="border-radius: 10px" :disabled="channelId === ''" @change="startPushStream"></el-switch>
|
<el-switch v-model="pushStream" active-color="#13ce66" inactive-color="#c4c6c9" style="border-radius: 10px" :disabled="channelId === ''" @change="startPushStream"></el-switch>
|
||||||
<span style="margin: 10px 10px 10px 30px">开启直播录像:</span>
|
|
||||||
<el-switch v-model="playrecord" active-color="#13ce66" inactive-color="#c4c6c9" style="border-radius: 10px" :disabled="channelId === ''" @change="startPlayRecord"></el-switch>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<player ref="player" :playerinfo="playinfo" class="components-container"></player>
|
<player ref="player" :playerinfo="playinfo" class="components-container"></player>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,7 +14,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import player from '@/views/components/player/player.vue';
|
import player from '@/views/components/player/player.vue';
|
||||||
import { startPlay, closeStream, listChannel } from '@/api/iot/channel';
|
import { startPlay, closeStream, listChannel } from '@/api/iot/channel';
|
||||||
import { startPlayRecord } from '@/api/iot/record';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'device-live-stream',
|
name: 'device-live-stream',
|
||||||
@@ -52,8 +49,6 @@ export default {
|
|||||||
ssrc: '',
|
ssrc: '',
|
||||||
playurl: '',
|
playurl: '',
|
||||||
playinfo: {},
|
playinfo: {},
|
||||||
playrecord: false,
|
|
||||||
playrecording: false,
|
|
||||||
playing: false,
|
playing: false,
|
||||||
pushStream: false,
|
pushStream: false,
|
||||||
retrycount: 0,
|
retrycount: 0,
|
||||||
@@ -136,23 +131,18 @@ export default {
|
|||||||
if (!this.$refs.player.isInit) {
|
if (!this.$refs.player.isInit) {
|
||||||
this.$refs.player.init();
|
this.$refs.player.init();
|
||||||
}
|
}
|
||||||
// this.$refs.player.registercallback('loadingTimeout', this.TimeoutCallback);
|
this.$refs.player.registercallback('loadingTimeout', this.TimeoutCallback);
|
||||||
// this.$refs.player.registercallback('delayTimeout', this.TimeoutCallback);
|
this.$refs.player.registercallback('delayTimeout', this.TimeoutCallback);
|
||||||
// this.$refs.player.play("https://sample-videos.com/video321/flv/480/big_buck_bunny_480p_1mb.flv");
|
// this.$refs.player.play("https://sample-videos.com/video321/flv/480/big_buck_bunny_480p_1mb.flv");
|
||||||
if (this.playrecord) {
|
startPlay(this.deviceId, this.channelId).then((response) => {
|
||||||
|
const res = response.data;
|
||||||
} else {
|
this.streamId = res.streamId;
|
||||||
startPlay(this.deviceId, this.channelId).then((response) => {
|
this.playurl = res.playurl;
|
||||||
const res = response.data;
|
console.log('开始推流: [' + this.streamId + ']');
|
||||||
this.streamId = res.streamId;
|
this.$refs.player.play(res.playurl);
|
||||||
this.playurl = res.playurl;
|
this.playing = true;
|
||||||
console.log('开始推流: [' + this.streamId + ']');
|
this.pushStream = true;
|
||||||
this.$refs.player.play(res.playurl);
|
});
|
||||||
this.playing = true;
|
|
||||||
this.playrecording = false;
|
|
||||||
this.pushStream = true;
|
|
||||||
});;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
closeStream(force) {
|
closeStream(force) {
|
||||||
if (force) {
|
if (force) {
|
||||||
@@ -165,12 +155,8 @@ export default {
|
|||||||
this.pushStream = false;
|
this.pushStream = false;
|
||||||
});
|
});
|
||||||
this.playing = false;
|
this.playing = false;
|
||||||
this.playrecording = false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.playrecording === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.playing && this.streamId) {
|
if (this.playing && this.streamId) {
|
||||||
console.log('关闭推流3: [' + this.streamId + ']');
|
console.log('关闭推流3: [' + this.streamId + ']');
|
||||||
closeStream(this.deviceId, this.channelId, this.streamId).then((res) => {
|
closeStream(this.deviceId, this.channelId, this.streamId).then((res) => {
|
||||||
@@ -180,7 +166,6 @@ export default {
|
|||||||
this.pushStream = false;
|
this.pushStream = false;
|
||||||
});
|
});
|
||||||
this.playing = false;
|
this.playing = false;
|
||||||
this.playrecording = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,9 +39,6 @@
|
|||||||
<el-select v-model="mediaServerForm.protocol" style="width: 100%">
|
<el-select v-model="mediaServerForm.protocol" style="width: 100%">
|
||||||
<el-option key="http" label="http" value="http"></el-option>
|
<el-option key="http" label="http" value="http"></el-option>
|
||||||
<el-option key="https" label="https" value="https"></el-option>
|
<el-option key="https" label="https" value="https"></el-option>
|
||||||
<el-option key="ws" label="ws" value="ws"></el-option>
|
|
||||||
<el-option key="rtmp" label="rtmp" value="rtmp"></el-option>
|
|
||||||
<el-option key="rtsp" label="rtsp" value="rtsp"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="HookUrl" prop="hookurl">
|
<el-form-item label="HookUrl" prop="hookurl">
|
||||||
|
|||||||
Reference in New Issue
Block a user