视频插件优化
parent
aa3669e16e
commit
23909f26bb
|
|
@ -2,11 +2,22 @@
|
|||
"name": "@it/docklivestreamplugin",
|
||||
"version": "1.0.0",
|
||||
"description": "该插件js插件包。功能包含SDK初始化、设置视频直播画面控件、发起和结束直播、拍照、视频录制、资源释放。",
|
||||
"main": "index.js",
|
||||
"main": "@it/docklivestreamplugin.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.0",
|
||||
"ant-design-vue": "^4.0.0-rc.6",
|
||||
"axios": "^1.10.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mqtt": "^5.13.3",
|
||||
"path": "^0.12.7",
|
||||
"qs": "^6.14.0",
|
||||
"tcplayer.js": "^5.3.4",
|
||||
"vue": "^3.5.17"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
} from '@/api/workmanagement/droneDock';
|
||||
import TCPlayer from 'tcplayer.js';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { errorName } from '@/utils/debugging/remote';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const bid = buildGUID();
|
||||
|
|
@ -113,8 +114,28 @@ class LiveStreamPlugin {
|
|||
client.on('message', (topic, message) => {
|
||||
const rs = JSON.parse(message);
|
||||
if (rs.bid == bid) {
|
||||
console.log(rs);
|
||||
console.log('LiveStreamPlugin liveStartPush', rs);
|
||||
if (rs.method == 'camera_recording_start') {
|
||||
if (rs.data.result == 0) {
|
||||
createMessage.success('开始录像成功');
|
||||
} else {
|
||||
createMessage.error('开始录像失败,' + errorName(rs.data.result));
|
||||
}
|
||||
}
|
||||
if (rs.method == 'live_start_push') {
|
||||
if (rs.data.result == 0) {
|
||||
createMessage.success('发起视频直播成功');
|
||||
} else {
|
||||
createMessage.error('发起视频直播失败,' + errorName(rs.data.result));
|
||||
}
|
||||
}
|
||||
if (rs.method == 'live_stop_push') {
|
||||
if (rs.data.result == 0) {
|
||||
createMessage.success('结束视频直播成功');
|
||||
} else {
|
||||
createMessage.error('结束视频直播失败,' + errorName(rs.data.result));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -175,6 +196,13 @@ class LiveStreamPlugin {
|
|||
return new Promise((resolve, reject) => {
|
||||
client.on('message', async (topic, message) => {
|
||||
const rs = JSON.parse(message);
|
||||
if (rs.method == 'camera_photo_take') {
|
||||
if (rs.data.result == 0) {
|
||||
createMessage.success('拍照成功');
|
||||
} else {
|
||||
createMessage.error('拍照失败,' + errorName(rs.data.result));
|
||||
}
|
||||
}
|
||||
if (
|
||||
rs.method == 'flighttask_progress' &&
|
||||
rs.data.output.status == 'in_progress' &&
|
||||
|
|
@ -265,6 +293,13 @@ class LiveStreamPlugin {
|
|||
return new Promise((resolve, reject) => {
|
||||
client.on('message', async (topic, message) => {
|
||||
const rs = JSON.parse(message);
|
||||
if (rs.method == 'camera_recording_stop') {
|
||||
if (rs.data.result == 0) {
|
||||
createMessage.success('结束录像成功');
|
||||
} else {
|
||||
createMessage.error('结束录像失败,' + errorName(rs.data.result));
|
||||
}
|
||||
}
|
||||
if (
|
||||
rs.method == 'flighttask_progress' &&
|
||||
rs.data.output.status == 'in_progress' &&
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
<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="viewLive">展示机场直播</a-button>
|
||||
<a-button @click="uavLive">展示无人机直播</a-button>
|
||||
<a-button @click="takePhoto">拍照</a-button>
|
||||
<div id="live-div"> </div>
|
||||
</div>
|
||||
|
|
@ -39,6 +40,9 @@
|
|||
console.log(document.getElementById('live-div'));
|
||||
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '1');
|
||||
};
|
||||
const uavLive = () => {
|
||||
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '0');
|
||||
};
|
||||
const takePhoto = () => {
|
||||
liveStreamPlugin.takePicture((res) => {
|
||||
console.log(res);
|
||||
|
|
|
|||
Loading…
Reference in New Issue