You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
Vue
57 lines
1.9 KiB
Vue
<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>
|
|
<a-button @click="takePhoto">拍照</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');
|
|
};
|
|
const takePhoto = () => {
|
|
liveStreamPlugin.takePicture((res) => {
|
|
console.log(res);
|
|
});
|
|
};
|
|
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>
|