视频插件优化
parent
aa3669e16e
commit
23909f26bb
|
|
@ -2,11 +2,22 @@
|
||||||
"name": "@it/docklivestreamplugin",
|
"name": "@it/docklivestreamplugin",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "该插件js插件包。功能包含SDK初始化、设置视频直播画面控件、发起和结束直播、拍照、视频录制、资源释放。",
|
"description": "该插件js插件包。功能包含SDK初始化、设置视频直播画面控件、发起和结束直播、拍照、视频录制、资源释放。",
|
||||||
"main": "index.js",
|
"main": "@it/docklivestreamplugin.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"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';
|
} from '@/api/workmanagement/droneDock';
|
||||||
import TCPlayer from 'tcplayer.js';
|
import TCPlayer from 'tcplayer.js';
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
|
import { errorName } from '@/utils/debugging/remote';
|
||||||
|
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
const bid = buildGUID();
|
const bid = buildGUID();
|
||||||
|
|
@ -113,8 +114,28 @@ class LiveStreamPlugin {
|
||||||
client.on('message', (topic, message) => {
|
client.on('message', (topic, message) => {
|
||||||
const rs = JSON.parse(message);
|
const rs = JSON.parse(message);
|
||||||
if (rs.bid == bid) {
|
if (rs.bid == bid) {
|
||||||
console.log(rs);
|
|
||||||
console.log('LiveStreamPlugin liveStartPush', 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) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.on('message', async (topic, message) => {
|
client.on('message', async (topic, message) => {
|
||||||
const rs = JSON.parse(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 (
|
if (
|
||||||
rs.method == 'flighttask_progress' &&
|
rs.method == 'flighttask_progress' &&
|
||||||
rs.data.output.status == 'in_progress' &&
|
rs.data.output.status == 'in_progress' &&
|
||||||
|
|
@ -265,6 +293,13 @@ class LiveStreamPlugin {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.on('message', async (topic, message) => {
|
client.on('message', async (topic, message) => {
|
||||||
const rs = JSON.parse(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 (
|
if (
|
||||||
rs.method == 'flighttask_progress' &&
|
rs.method == 'flighttask_progress' &&
|
||||||
rs.data.output.status == 'in_progress' &&
|
rs.data.output.status == 'in_progress' &&
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
<a-button @click="endRecording">结束录像</a-button>
|
<a-button @click="endRecording">结束录像</a-button>
|
||||||
<a-button @click="liveStreamPlugin.disposeSDK">释放资源</a-button>
|
<a-button @click="liveStreamPlugin.disposeSDK">释放资源</a-button>
|
||||||
<a-button @click="getTask">获取航线任务</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>
|
<a-button @click="takePhoto">拍照</a-button>
|
||||||
<div id="live-div"> </div>
|
<div id="live-div"> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -39,6 +40,9 @@
|
||||||
console.log(document.getElementById('live-div'));
|
console.log(document.getElementById('live-div'));
|
||||||
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '1');
|
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '1');
|
||||||
};
|
};
|
||||||
|
const uavLive = () => {
|
||||||
|
liveStreamPlugin.setLiveStreamControl(document.getElementById('live-div'), '0');
|
||||||
|
};
|
||||||
const takePhoto = () => {
|
const takePhoto = () => {
|
||||||
liveStreamPlugin.takePicture((res) => {
|
liveStreamPlugin.takePicture((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue