直播插件
parent
752c869865
commit
bdd8aef058
@ -0,0 +1,14 @@
|
||||
import { defHttp } from '@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
VerifyToken = '/api/DroneDock/VerifyToken',
|
||||
GetDroneDockflightInfos = '/api/DroneDock/GetDroneDockflightInfos',
|
||||
}
|
||||
|
||||
export function getVerifyToken(token) {
|
||||
return defHttp.get({ url: Api.VerifyToken + '?token=' + token });
|
||||
}
|
||||
|
||||
export function getDroneDockflightInfos(id) {
|
||||
return defHttp.get({ url: Api.GetDroneDockflightInfos + '?taskid=' + id });
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
export const airport = {
|
||||
camera_index: '165-0-7',
|
||||
video_index: 'normal-0',
|
||||
};
|
||||
export const uav = {
|
||||
camera_index: '99-0-0',
|
||||
video_index: 'normal-0',
|
||||
};
|
||||
export const liveInfo = {
|
||||
rtmp: 'rtmp://box.wisestcity.com:1935/live/',
|
||||
url: 'http://box.wisestcity.com:8081/live/',
|
||||
};
|
||||
const hexList: string[] = [];
|
||||
for (let i = 0; i <= 15; i++) {
|
||||
hexList[i] = i.toString(16);
|
||||
}
|
||||
export function buildGUID(): string {
|
||||
let guid = '';
|
||||
for (let i = 1; i <= 36; i++) {
|
||||
if (i === 9 || i === 14 || i === 19 || i === 24) {
|
||||
guid += '-';
|
||||
} else if (i === 15) {
|
||||
guid += 4;
|
||||
} else if (i === 20) {
|
||||
guid += hexList[(Math.random() * 4) | 8];
|
||||
} else {
|
||||
guid += hexList[(Math.random() * 16) | 0];
|
||||
}
|
||||
}
|
||||
return guid;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-button @click="starAirpot">开启机场直播</a-button>
|
||||
<a-button @click="startUAV">开启无人机直播</a-button>
|
||||
<a-button @click="startRecording">开始录像</a-button>
|
||||
<a-button @click="endRecording">结束录像</a-button>
|
||||
<a-button @click="liveStreamPlugin.disposeSDK">释放资源</a-button>
|
||||
<a-button @click="getTask">获取航线任务</a-button>
|
||||
<a-button @click="viewLive">展示视频直播</a-button>
|
||||
<div id="live-div"> </div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import LiveStreamPlugin from '@/plugin/video/index';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const liveStreamPlugin = new LiveStreamPlugin();
|
||||
const starAirpot = () => {
|
||||
liveStreamPlugin.startLiveStreamCall('8UUXN5400A079H', 1);
|
||||
};
|
||||
const startUAV = () => {
|
||||
liveStreamPlugin.startLiveStreamCall('1581F8HGX254V00A0BUY', 0);
|
||||
};
|
||||
const startRecording = () => {
|
||||
liveStreamPlugin.startVideoRecording();
|
||||
};
|
||||
const endRecording = () => {
|
||||
liveStreamPlugin.endVideoRecording((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
const getTask = async () => {
|
||||
await liveStreamPlugin.getFlightTaskInfo('8UUXN5400A079H').then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
const viewLive = () => {
|
||||
console.log(document.getElementById('live-div'));
|
||||
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '1');
|
||||
};
|
||||
onMounted(async () => {
|
||||
const token =
|
||||
'API32_HENJOZMPBYKEXNVLFMY3Y5W5SQ.1751622229582.fmCjIucQYyq4YZe4CnSStN/rHcwjZTxUsDuXeXJfrYn0bwoaV1/IW8mcFwtLw8JHjowvMJrmPyy/QZAhssxQCQ==';
|
||||
const status = await liveStreamPlugin.initSDK(token);
|
||||
console.log(status);
|
||||
if (!status) {
|
||||
console.log('初始化失败');
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue