From 4a2d418526e22be5ad031cb6f5dc673207b1ad22 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Fri, 27 Jun 2025 11:24:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=85=BE=E8=AE=AFp2p=E7=9A=84master?= =?UTF-8?q?=E5=88=86=E6=94=AF=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/main/lockDetail.vue | 2 +- pages/p2p/p2pPlayer.vue | 17 +++++++-- .../xhj-record/utssdk/app-ios/config.json | 3 ++ .../xhj-record/utssdk/app-ios/index.uts | 0 .../utssdk/app-android/index.uts | 22 +++++------ .../utssdk/app-ios/Info.plist | 10 +++++ .../utssdk/app-ios/config.json | 24 ++++++++++-- .../xhj-tencent-xp2p/utssdk/app-ios/index.uts | 37 +++++++++++++++++++ 8 files changed, 95 insertions(+), 20 deletions(-) create mode 100644 uni_modules/xhj-record/utssdk/app-ios/config.json create mode 100644 uni_modules/xhj-record/utssdk/app-ios/index.uts create mode 100644 uni_modules/xhj-tencent-xp2p/utssdk/app-ios/Info.plist diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index 3cc70b9..05cd56a 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -314,7 +314,7 @@ }) const jumpToPlayer = async () => { - // #ifdef APP-PLUS + // #ifdef APP-ANDROID // 检查权限 const result = await requestPermission() if (result.code !== 0) { diff --git a/pages/p2p/p2pPlayer.vue b/pages/p2p/p2pPlayer.vue index 12c34a6..6145b91 100644 --- a/pages/p2p/p2pPlayer.vue +++ b/pages/p2p/p2pPlayer.vue @@ -188,7 +188,7 @@ // #ifdef APP-PLUS import { - startService, + startServiceFunction, stopService, runSendService, stopSendService, @@ -262,14 +262,23 @@ // #ifdef APP-PLUS if (code === 0) { deviceInfo.value = data - const result = await startService({ + const params = { appKey: 'aanuJXFtISXFYVVsd', appSecret: 'SsnOMHJUcazCvpULSVWY', productId: deviceInfo.value.productId, deviceName: deviceInfo.value.deviceName, xp2pInfo: deviceInfo.value.xp2pInfo - }) - if (result.code === 0) { + } + + const result = await startServiceFunction( + params.appKey, + params.appSecret, + params.productId, + params.deviceName, + params.xp2pInfo + ) + console.log(1111, result) + if (result?.code === 0) { url.value = result.data.url runSendService( `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, diff --git a/uni_modules/xhj-record/utssdk/app-ios/config.json b/uni_modules/xhj-record/utssdk/app-ios/config.json new file mode 100644 index 0000000..3312828 --- /dev/null +++ b/uni_modules/xhj-record/utssdk/app-ios/config.json @@ -0,0 +1,3 @@ +{ + "deploymentTarget": "12" +} diff --git a/uni_modules/xhj-record/utssdk/app-ios/index.uts b/uni_modules/xhj-record/utssdk/app-ios/index.uts new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts b/uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts index 60e6bc9..b9aac16 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts @@ -4,7 +4,7 @@ import { UTSAndroid } from 'io.dcloud.uts' import { XP2PAppConfig, XP2P, XP2PCallback } from 'com.tencent.xnet' -import { Result, InitParams, IdParams } from '../interface.uts' +import { Result, IdParams } from '../interface.uts' class XP2PCallbackImpl extends XP2PCallback { private eventNotifyCallback?: (id: string | null, msg: string | null, event: Int) => void @@ -64,22 +64,22 @@ async function getLiveUrlAsync( } } -export const startService = async function (params: InitParams): Promise { +export const startServiceFunction = async function ( + appKey: string, + appSecret: string, + productId: string, + deviceName: string, + xp2pInfo: string +): Promise { try { const context = UTSAndroid.getAppContext() let xp2pConfig: XP2PAppConfig = new XP2PAppConfig() - xp2pConfig.appKey = params.appKey - xp2pConfig.appSecret = params.appSecret + xp2pConfig.appKey = appKey + xp2pConfig.appSecret = appSecret - await XP2P.startService( - context, - params.productId, - params.deviceName, - params.xp2pInfo, - xp2pConfig - ) + await XP2P.startService(context, productId, deviceName, xp2pInfo, xp2pConfig) return new Promise((resolve, reject) => { const callback: XP2PCallback = new XP2PCallbackImpl( diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/Info.plist b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/Info.plist new file mode 100644 index 0000000..1041b0f --- /dev/null +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/Info.plist @@ -0,0 +1,10 @@ + + + + + LSApplicationQueriesSchemes + + cydia + + + diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/config.json b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/config.json index 850658e..cb624d4 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/config.json +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/config.json @@ -1,11 +1,27 @@ { - "deploymentTarget": "12", + "deploymentTarget": "9", + "frameworks": [ + "AVFoundation.framework", + "CoreMedia.framework", + "VideoToolbox.framework", + "AudioToolbox.framework" + ], "dependencies-pods": [ { "name": "TIoTLinkVideo", - "repo": { - "git": "https://github.com/tencentyun/iot-link-ios" - } + "version": "2.4.48" + }, + { + "name": "TIoTLinkKit_XP2P", + "version": "2.4.53" + }, + { + "name": "TIoTLinkKit_GVoiceSE", + "version": "1.0.9" + }, + { + "name": "TIoTLinkKit_IJKPlayer", + "version": "2.0.15" } ] } diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts index e69de29..b148e0a 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts @@ -0,0 +1,37 @@ +/* eslint-disable */ +// @ts-nocheck +// @ts-ignore-start + +import { Result } from '../interface.uts' +// import 'TIoTCoreXP2PBridge.h' +// import 'TIoTCoreAudioConfig.h' +// import 'TIoTCoreVideoConfig.h' + +export const startServiceFunction = async function ( + appKey: string, + appSecret: string, + productId: string, + deviceName: string, + xp2pInfo: string +): Promise { + try { + console.log(1111, appKey, appSecret, productId, deviceName, xp2pInfo) + // console.log(1111, TIoTCoreXP2PBridge) + // const config = TIoTP2PAPPConfig() + // console.log(1111, config) + return { + code: -1, + data: {}, + message: '1' + } + } catch (error) { + console.log('startServiceFunction报错', error) + return { + code: -1, + data: {}, + message: error.toString() + } + } +} + +// @ts-ignore-end