feat: 添加监控相关功能
This commit is contained in:
parent
d7c5ad4102
commit
88b512aa7f
@ -2,9 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
@ -15,14 +13,6 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["**/*.js", "**/*.jsx", "**/*.vue", "pages/p2p/p2pPlayer.nvue"],
|
||||||
"**/*.js",
|
"exclude": ["node_modules", "unpackage", "dist"]
|
||||||
"**/*.jsx",
|
}
|
||||||
"**/*.vue"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"unpackage",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|||||||
211
manifest.json
211
manifest.json
@ -1,111 +1,110 @@
|
|||||||
{
|
{
|
||||||
"name" : "星星锁Lite",
|
"name": "星星锁Lite",
|
||||||
"appid" : "__UNI__933D519",
|
"appid": "__UNI__933D519",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.3.0",
|
"versionName": "1.3.0",
|
||||||
"versionCode" : "37",
|
"versionCode": "37",
|
||||||
"mp-weixin" : {
|
"mp-weixin": {
|
||||||
"appid" : "wx9829a39e65550757",
|
"appid": "wx9829a39e65550757",
|
||||||
"setting" : {
|
"setting": {
|
||||||
"urlCheck" : true,
|
"urlCheck": true,
|
||||||
"minified" : true
|
"minified": true
|
||||||
},
|
|
||||||
"permission" : {
|
|
||||||
"scope.bluetooth" : {
|
|
||||||
"desc" : "蓝牙将用于控制和管理您的智能门锁"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"requiredPrivateInfos" : [ "getLocation" ],
|
|
||||||
"usingComponents" : true,
|
|
||||||
"lazyCodeLoading" : "requiredComponents",
|
|
||||||
"optimization" : {
|
|
||||||
"subPackages" : true
|
|
||||||
},
|
|
||||||
"plugins" : {
|
|
||||||
"wmpf-voip" : {
|
|
||||||
"version" : "latest",
|
|
||||||
"provider" : "wxf830863afde621eb",
|
|
||||||
"genericsImplementation" : {
|
|
||||||
"call-page-plugin" : {
|
|
||||||
"custombox" : "pages/main/customBox"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"vueVersion" : "3",
|
"permission": {
|
||||||
"app-plus" : {
|
"scope.bluetooth": {
|
||||||
"distribute" : {
|
"desc": "蓝牙将用于控制和管理您的智能门锁"
|
||||||
"icons" : {
|
}
|
||||||
"android" : {
|
},
|
||||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
"usingComponents": true,
|
||||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
"lazyCodeLoading": "requiredComponents",
|
||||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
"optimization": {
|
||||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
"subPackages": true
|
||||||
},
|
},
|
||||||
"ios" : {
|
"plugins": {
|
||||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
"wmpf-voip": {
|
||||||
"ipad" : {
|
"version": "latest",
|
||||||
"app" : "unpackage/res/icons/76x76.png",
|
"provider": "wxf830863afde621eb",
|
||||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
"genericsImplementation": {
|
||||||
"notification" : "unpackage/res/icons/20x20.png",
|
"call-page-plugin": {
|
||||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
"custombox": "pages/main/customBox"
|
||||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
}
|
||||||
"settings" : "unpackage/res/icons/29x29.png",
|
|
||||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
|
||||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
|
||||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
|
||||||
},
|
|
||||||
"iphone" : {
|
|
||||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
|
||||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
|
||||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
|
||||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
|
||||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
|
||||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
|
||||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
|
||||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"android" : {
|
|
||||||
"permissions" : [
|
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
|
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
|
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"ios" : {
|
|
||||||
"dSYMs" : false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"modules" : {
|
|
||||||
"Bluetooth" : {},
|
|
||||||
"VideoPlayer" : {},
|
|
||||||
"LivePusher" : {},
|
|
||||||
"Camera" : {},
|
|
||||||
"Record" : {}
|
|
||||||
},
|
|
||||||
"splashscreen" : {
|
|
||||||
"waiting" : false
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"vueVersion": "3",
|
||||||
|
"app-plus": {
|
||||||
|
"distribute": {
|
||||||
|
"icons": {
|
||||||
|
"android": {
|
||||||
|
"hdpi": "unpackage/res/icons/72x72.png",
|
||||||
|
"xhdpi": "unpackage/res/icons/96x96.png",
|
||||||
|
"xxhdpi": "unpackage/res/icons/144x144.png",
|
||||||
|
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
||||||
|
},
|
||||||
|
"ios": {
|
||||||
|
"appstore": "unpackage/res/icons/1024x1024.png",
|
||||||
|
"ipad": {
|
||||||
|
"app": "unpackage/res/icons/76x76.png",
|
||||||
|
"app@2x": "unpackage/res/icons/152x152.png",
|
||||||
|
"notification": "unpackage/res/icons/20x20.png",
|
||||||
|
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||||
|
"proapp@2x": "unpackage/res/icons/167x167.png",
|
||||||
|
"settings": "unpackage/res/icons/29x29.png",
|
||||||
|
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||||
|
"spotlight": "unpackage/res/icons/40x40.png",
|
||||||
|
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
||||||
|
},
|
||||||
|
"iphone": {
|
||||||
|
"app@2x": "unpackage/res/icons/120x120.png",
|
||||||
|
"app@3x": "unpackage/res/icons/180x180.png",
|
||||||
|
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||||
|
"notification@3x": "unpackage/res/icons/60x60.png",
|
||||||
|
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||||
|
"settings@3x": "unpackage/res/icons/87x87.png",
|
||||||
|
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
||||||
|
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"android": {
|
||||||
|
"permissions": [
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ios": {
|
||||||
|
"dSYMs": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules": {
|
||||||
|
"Bluetooth": {},
|
||||||
|
"VideoPlayer": {},
|
||||||
|
"LivePusher": {},
|
||||||
|
"Camera": {},
|
||||||
|
"Record": {}
|
||||||
|
},
|
||||||
|
"splashscreen": {
|
||||||
|
"waiting": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,13 +38,6 @@
|
|||||||
"navigationBarTitleText": "门锁记录",
|
"navigationBarTitleText": "门锁记录",
|
||||||
"disableScroll": true
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "appPlayer",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "监控",
|
|
||||||
"disableScroll": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
|||||||
@ -310,12 +310,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const jumpToPlayer = () => {
|
const jumpToPlayer = () => {
|
||||||
// #ifdef MP
|
|
||||||
$basic.routeJump({ name: 'p2pPlayer' })
|
$basic.routeJump({ name: 'p2pPlayer' })
|
||||||
// #endif
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
$basic.routeJump({ name: 'appPlayer' })
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDoorOperate = async type => {
|
const openDoorOperate = async type => {
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<video v-if="url" autoplay :src="url" :is-live="true" :controls="false" class="w-full" />
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
import { onMounted, ref } from 'vue'
|
|
||||||
import { passthrough } from '@/api/sdk'
|
|
||||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
|
||||||
import { useBasicStore } from '@/stores/basic'
|
|
||||||
import { startService, getLiveUrl } from '@/uni_modules/xhj-tencent-xp2p'
|
|
||||||
|
|
||||||
const $bluetooth = useBluetoothStore()
|
|
||||||
const $basic = useBasicStore()
|
|
||||||
|
|
||||||
const deviceInfo = ref()
|
|
||||||
|
|
||||||
const url = ref()
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
// const callback = new XP2PCallback1()
|
|
||||||
// setCallback(callback)
|
|
||||||
|
|
||||||
const { code, data, message } = await passthrough({
|
|
||||||
request_method: 'GET',
|
|
||||||
request_uri: '/api/v1/tencentYun/getDeviceDetailData',
|
|
||||||
post_args: {
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (code === 0) {
|
|
||||||
deviceInfo.value = data
|
|
||||||
console.log(1)
|
|
||||||
const result = await startService({
|
|
||||||
appKey: 'aanuJXFtISXFYVVsd',
|
|
||||||
appSecret: 'SsnOMHJUcazCvpULSVWY',
|
|
||||||
productId: deviceInfo.value.productId,
|
|
||||||
deviceName: deviceInfo.value.deviceName,
|
|
||||||
xp2pInfo: deviceInfo.value.xp2pInfo
|
|
||||||
})
|
|
||||||
if (result.code === 0) {
|
|
||||||
setTimeout(async () => {
|
|
||||||
const urlResult = await getLiveUrl({
|
|
||||||
id: `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
|
||||||
})
|
|
||||||
console.log(12, urlResult)
|
|
||||||
if (urlResult.code === 0) {
|
|
||||||
uni.request({
|
|
||||||
url: urlResult.data.url,
|
|
||||||
method: 'GET',
|
|
||||||
success: res => {
|
|
||||||
console.log(13, res)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
url.value = urlResult.data.url
|
|
||||||
}
|
|
||||||
}, 200)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$basic.backAndToast(message)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// #endif
|
|
||||||
</script>
|
|
||||||
@ -1,48 +1,67 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<iot-p2p-player-with-mjpg
|
<view>
|
||||||
v-if="deviceInfo"
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
id="playerRef"
|
<iot-p2p-player-with-mjpg
|
||||||
:deviceInfo="deviceInfo"
|
v-if="deviceInfo"
|
||||||
:xp2pInfo="xp2pInfo"
|
id="playerRef"
|
||||||
:rotate="90"
|
:deviceInfo="deviceInfo"
|
||||||
:muted="isMute"
|
:xp2pInfo="xp2pInfo"
|
||||||
mode="RTC"
|
:rotate="90"
|
||||||
:acceptPlayerEvents="true"
|
:muted="isMute"
|
||||||
soundMode="speaker"
|
mode="RTC"
|
||||||
sceneType="live"
|
:acceptPlayerEvents="true"
|
||||||
:streamQuality="range[index].value"
|
soundMode="speaker"
|
||||||
:minCache="0.2"
|
sceneType="live"
|
||||||
:maxCache="0.8"
|
:streamQuality="range[index].value"
|
||||||
:fill="true"
|
:minCache="0.2"
|
||||||
orientation="horizontal"
|
:maxCache="0.8"
|
||||||
@playsuccess="handlePlaySuccess"
|
:fill="true"
|
||||||
>
|
orientation="horizontal"
|
||||||
</iot-p2p-player-with-mjpg>
|
@playsuccess="handlePlaySuccess"
|
||||||
<view
|
>
|
||||||
v-if="buttonInfo"
|
</iot-p2p-player-with-mjpg>
|
||||||
:style="{
|
<!-- #endif -->
|
||||||
top: buttonInfo.bottom + 15 + 'px'
|
|
||||||
}"
|
<!-- #ifdef APP-PLUS -->
|
||||||
class="bg-[rgba(0,0,0,0.35)] rounded-full px-2 py-1.5 fixed right-32"
|
<video
|
||||||
>
|
autoplay
|
||||||
<picker :value="index" mode="selector" :range="range" range-key="name" @change="changeEvent">
|
id="playerRef"
|
||||||
<up-icon
|
v-if="url"
|
||||||
:label="range[index].name"
|
:muted="isMute"
|
||||||
color="#ffffff"
|
:src="urlPrefix"
|
||||||
label-color="#ffffff"
|
object-fit="cover"
|
||||||
labelPos="left"
|
class="w-[100vw] h-[100vh]"
|
||||||
name="arrow-down-fill"
|
:is-live="true"
|
||||||
size="32rpx"
|
:play-strategy="2"
|
||||||
space="16rpx"
|
:controls="false"
|
||||||
></up-icon>
|
:show-progress="false"
|
||||||
</picker>
|
:show-fullscreen-btn="false"
|
||||||
|
:show-play-btn="false"
|
||||||
|
:enable-progress-gesture="false"
|
||||||
|
:vslide-gesture="true"
|
||||||
|
/>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<image
|
<image
|
||||||
v-if="!isVideoLoaded"
|
v-if="!isVideoLoaded"
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/background_monitor.png"
|
src="https://oss-lock.xhjcn.ltd/mp/background_monitor.png"
|
||||||
class="w-full h-full absolute top-0 left-0"
|
class="w-full h-full absolute top-0 left-0"
|
||||||
></image>
|
></image>
|
||||||
|
|
||||||
|
<cover-view
|
||||||
|
v-if="isApp || buttonInfo"
|
||||||
|
:style="{
|
||||||
|
top: isApp ? '60px' : buttonInfo.bottom + 15 + 'px'
|
||||||
|
}"
|
||||||
|
class="bg-[rgba(0,0,0,0.35)] rounded-full px-4 py-1.5 fixed right-32"
|
||||||
|
>
|
||||||
|
<cover-view class="text-white text-xs" @click="showQualitySelector">
|
||||||
|
{{ range[index].name }}
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<iot-p2p-voice
|
<iot-p2p-voice
|
||||||
v-if="deviceInfo"
|
v-if="deviceInfo"
|
||||||
id="voiceComponent"
|
id="voiceComponent"
|
||||||
@ -51,58 +70,94 @@
|
|||||||
voiceType="Pusher"
|
voiceType="Pusher"
|
||||||
>
|
>
|
||||||
</iot-p2p-voice>
|
</iot-p2p-voice>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
<view
|
<cover-view
|
||||||
v-if="isVideoLoaded"
|
v-if="isVideoLoaded"
|
||||||
class="fixed bottom-[calc(32rpx+env(safe-area-inset-bottom))] bg-[rgba(0,0,0,0.3)] rounded-xl p-4 shadow-lg left-1/2 -translate-x-1/2 w-622"
|
class="fixed bottom-[calc(32rpx+env(safe-area-inset-bottom))] bg-[rgba(0,0,0,0.3)] rounded-xl p-4 shadow-lg left-1/2 -translate-x-1/2 w-622"
|
||||||
>
|
>
|
||||||
<view class="flex items-center justify-around mx-15">
|
<cover-view class="flex items-center justify-around mx-15">
|
||||||
<image
|
<cover-view class="relative">
|
||||||
@click="isMute = !isMute"
|
<cover-image
|
||||||
:src="
|
v-show="isMute"
|
||||||
isMute
|
src="https://oss-lock.xhjcn.ltd/mp/icon_mute.png"
|
||||||
? 'https://oss-lock.xhjcn.ltd/mp/icon_mute.png'
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
: 'https://oss-lock.xhjcn.ltd/mp/icon_not_mute.png'
|
></cover-image>
|
||||||
"
|
<cover-image
|
||||||
class="w-48 h-48 p-2"
|
v-show="!isMute"
|
||||||
></image>
|
src="https://oss-lock.xhjcn.ltd/mp/icon_not_mute.png"
|
||||||
<image
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
@click="handleScreenshot"
|
></cover-image>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_screenshot.png"
|
<cover-view
|
||||||
class="w-48 h-48 p-2"
|
@click="toggleMute"
|
||||||
></image>
|
class="absolute top-0 left-0 w-full h-full size-48 p-2"
|
||||||
</view>
|
></cover-view>
|
||||||
<view class="flex items-center justify-between text-white mt-2 px-10">
|
</cover-view>
|
||||||
<view class="flex flex-col items-center" @longpress="startVoice" @touchend="stopVoice">
|
<cover-view class="relative">
|
||||||
<view class="bg-white w-80 h-80 rounded-full flex items-center justify-center">
|
<cover-image
|
||||||
<image
|
src="https://oss-lock.xhjcn.ltd/mp/icon_screenshot.png"
|
||||||
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
|
></cover-image>
|
||||||
|
<cover-view
|
||||||
|
@click="handleScreenshot"
|
||||||
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
|
></cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="flex items-center justify-between text-white mt-2 px-10">
|
||||||
|
<cover-view class="flex flex-col items-center">
|
||||||
|
<cover-view
|
||||||
|
class="bg-white w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
:src="
|
:src="
|
||||||
isVoice
|
isVoice
|
||||||
? 'https://oss-lock.xhjcn.ltd/mp/icon_microphone.png'
|
? 'https://oss-lock.xhjcn.ltd/mp/icon_microphone.png'
|
||||||
: 'https://oss-lock.xhjcn.ltd/mp/icon_no_microphone.png'
|
: 'https://oss-lock.xhjcn.ltd/mp/icon_no_microphone.png'
|
||||||
"
|
"
|
||||||
class="w-55 h-55"
|
class="w-55 h-55"
|
||||||
></image>
|
></cover-image>
|
||||||
</view>
|
<cover-view
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">长按说话</view>
|
@click="toggleVoice"
|
||||||
</view>
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
<view class="flex flex-col items-center" @click="handleHangUp">
|
></cover-view>
|
||||||
<view class="bg-[#eb292b] w-80 h-80 rounded-full flex items-center justify-center">
|
</cover-view>
|
||||||
<image src="https://oss-lock.xhjcn.ltd/mp/icon_hang_up.png" class="w-60 h-60"></image>
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">{{
|
||||||
</view>
|
isVoice ? '点击停止' : '点击说话'
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">挂断</view>
|
}}</cover-view>
|
||||||
</view>
|
</cover-view>
|
||||||
<view class="flex flex-col items-center" @click="handleLock">
|
<cover-view class="flex flex-col items-center">
|
||||||
<view class="bg-[#63b8af] w-80 h-80 rounded-full flex items-center justify-center">
|
<cover-view
|
||||||
<image
|
class="bg-[#eb292b] w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
|
src="https://oss-lock.xhjcn.ltd/mp/icon_hang_up.png"
|
||||||
|
class="w-60 h-60"
|
||||||
|
></cover-image>
|
||||||
|
<cover-view
|
||||||
|
@click="handleHangUp"
|
||||||
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
|
></cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">挂断</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="flex flex-col items-center">
|
||||||
|
<cover-view
|
||||||
|
class="bg-[#63b8af] w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_lock_white.png"
|
src="https://oss-lock.xhjcn.ltd/mp/icon_lock_white.png"
|
||||||
class="w-60 h-60"
|
class="w-60 h-60"
|
||||||
></image>
|
></cover-image>
|
||||||
</view>
|
<cover-view
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">开锁</view>
|
@click="handleLock"
|
||||||
</view>
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
</view>
|
></cover-view>
|
||||||
</view>
|
</cover-view>
|
||||||
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">开锁</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
<view
|
<view
|
||||||
v-if="!isVideoLoaded"
|
v-if="!isVideoLoaded"
|
||||||
class="fixed bottom-[calc(48rpx+env(safe-area-inset-bottom))] w-full flex justify-center"
|
class="fixed bottom-[calc(48rpx+env(safe-area-inset-bottom))] w-full flex justify-center"
|
||||||
@ -119,7 +174,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref, computed } from 'vue'
|
||||||
import { onUnload } from '@dcloudio/uni-app'
|
import { onUnload } from '@dcloudio/uni-app'
|
||||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
@ -131,17 +186,20 @@
|
|||||||
import * as B from './exportForPlayerPlugin'
|
import * as B from './exportForPlayerPlugin'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
import { startService, getLiveUrl, stopService } from '@/uni_modules/xhj-tencent-xp2p'
|
||||||
|
// #endif
|
||||||
|
|
||||||
const $bluetooth = useBluetoothStore()
|
const $bluetooth = useBluetoothStore()
|
||||||
const $basic = useBasicStore()
|
const $basic = useBasicStore()
|
||||||
const $user = useUserStore()
|
const $user = useUserStore()
|
||||||
const buttonInfo = ref(null)
|
const buttonInfo = ref(null)
|
||||||
|
|
||||||
|
const isApp = ref(false)
|
||||||
|
|
||||||
const onlineToken = ref('0')
|
const onlineToken = ref('0')
|
||||||
|
|
||||||
const lockId = ref()
|
const lockId = ref()
|
||||||
|
|
||||||
const time = ref(0)
|
const time = ref(0)
|
||||||
|
|
||||||
const pending = ref(false)
|
const pending = ref(false)
|
||||||
|
|
||||||
const index = ref(1)
|
const index = ref(1)
|
||||||
@ -153,13 +211,20 @@
|
|||||||
|
|
||||||
const deviceInfo = ref()
|
const deviceInfo = ref()
|
||||||
const xp2pInfo = ref()
|
const xp2pInfo = ref()
|
||||||
|
const url = ref()
|
||||||
const isVoice = ref(false)
|
const isVoice = ref(false)
|
||||||
|
|
||||||
const isMute = ref(false)
|
const isMute = ref(false)
|
||||||
const isVideoLoaded = ref(false)
|
const isVideoLoaded = ref(false)
|
||||||
|
|
||||||
|
const urlPrefix = computed(() => {
|
||||||
|
return url.value + `ipc.flv?action=live&channel=0&quality=${range.value[index.value].value}`
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
isApp.value = true
|
||||||
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
console.log(A, B)
|
console.log(A, B)
|
||||||
// #endif
|
// #endif
|
||||||
@ -173,6 +238,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
deviceInfo.value = {
|
deviceInfo.value = {
|
||||||
deviceId: `${data.productId}/${data.deviceName}`,
|
deviceId: `${data.productId}/${data.deviceName}`,
|
||||||
@ -183,23 +249,65 @@
|
|||||||
} else {
|
} else {
|
||||||
$basic.backAndToast(message)
|
$basic.backAndToast(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
await getServeTime()
|
await getServeTime()
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (code === 0) {
|
||||||
|
deviceInfo.value = data
|
||||||
|
const result = await startService({
|
||||||
|
appKey: 'aanuJXFtISXFYVVsd',
|
||||||
|
appSecret: 'SsnOMHJUcazCvpULSVWY',
|
||||||
|
productId: deviceInfo.value.productId,
|
||||||
|
deviceName: deviceInfo.value.deviceName,
|
||||||
|
xp2pInfo: deviceInfo.value.xp2pInfo
|
||||||
|
})
|
||||||
|
if (result.code === 0) {
|
||||||
|
setTimeout(async () => {
|
||||||
|
const urlResult = await getLiveUrl({
|
||||||
|
id: `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
||||||
|
})
|
||||||
|
if (urlResult.code === 0) {
|
||||||
|
url.value = urlResult.data.url
|
||||||
|
handlePlaySuccess()
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
stopService({
|
||||||
|
id: `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
if (player.stopAll) {
|
if (player.stopAll) {
|
||||||
player.stopAll()
|
player.stopAll()
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
const changeEvent = e => {
|
const showQualitySelector = () => {
|
||||||
index.value = e.detail.value
|
uni.showActionSheet({
|
||||||
|
itemList: range.value.map(item => item.name),
|
||||||
|
success: res => {
|
||||||
|
index.value = res.tapIndex
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleScreenshot = () => {
|
const handleScreenshot = () => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
|
|
||||||
@ -220,14 +328,26 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content:
|
||||||
|
'由于技术限制,APP端无法直接截取视频画面。请使用手机系统截图功能:\n\niOS:同时按下电源键+音量上键\nAndroid:同时按下电源键+音量下键',
|
||||||
|
confirmText: '我知道了',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleHangUp = () => {
|
const handleHangUp = () => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
if (player.stopAll) {
|
if (player.stopAll) {
|
||||||
player.stopAll()
|
player.stopAll()
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,24 +460,35 @@
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const startVoice = () => {
|
const toggleVoice = () => {
|
||||||
uni.vibrateLong()
|
// #ifdef MP-WEIXIN
|
||||||
isVoice.value = true
|
if (isVoice.value) {
|
||||||
const page = getCurrentPages().pop()
|
isVoice.value = false
|
||||||
const voice = page.selectComponent('#voiceComponent')
|
const page = getCurrentPages().pop()
|
||||||
voice.startVoice()
|
const voice = page.selectComponent('#voiceComponent')
|
||||||
}
|
if (voice) {
|
||||||
|
voice.stopVoice()
|
||||||
const stopVoice = () => {
|
}
|
||||||
isVoice.value = false
|
} else {
|
||||||
const page = getCurrentPages().pop()
|
uni.vibrateLong()
|
||||||
const voice = page.selectComponent('#voiceComponent')
|
isVoice.value = true
|
||||||
voice.stopVoice()
|
const page = getCurrentPages().pop()
|
||||||
|
const voice = page.selectComponent('#voiceComponent')
|
||||||
|
if (voice) {
|
||||||
|
voice.startVoice()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
console.log(1111)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePlaySuccess = () => {
|
const handlePlaySuccess = () => {
|
||||||
isVideoLoaded.value = true
|
isVideoLoaded.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toggleMute = () => {
|
||||||
|
isMute.value = !isMute.value
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -431,11 +431,6 @@ const pages = [
|
|||||||
name: 'safeVerify',
|
name: 'safeVerify',
|
||||||
path: '/pages/user/safeVerify',
|
path: '/pages/user/safeVerify',
|
||||||
tabBar: false
|
tabBar: false
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'appPlayer',
|
|
||||||
path: '/pages/p2p/appPlayer',
|
|
||||||
tabBar: false
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"moduleResolution": "bundler"
|
"moduleResolution": "bundler"
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts", "**/*.tsx", "**/*.uts", "**/*.vue"],
|
"include": ["**/*.vue", "**/*.js", "**/*.uts", "uni_modules/**/*.uts"],
|
||||||
"exclude": ["node_modules", "unpackage", "dist"]
|
"exclude": ["node_modules", "unpackage", "dist"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user