From 5859f78b36458b46254d09d9a2f2d6da1cff6f75 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Tue, 1 Jul 2025 15:33:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ios=E7=AB=AFxp2p=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- manifest.json | 1 - .../xhj-tencent-xp2p/utssdk/app-ios/index.uts | 41 ++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/App.vue b/App.vue index 04a7a20..43adea6 100644 --- a/App.vue +++ b/App.vue @@ -81,7 +81,7 @@ listenerUI: { cameraRotation: 270, objectFit: 'fill', - enableToggleCamera: false + enableToggleCamera: true } }) wmpfVoip.setVoipEndPagePath({ diff --git a/manifest.json b/manifest.json index 3afe025..22d3396 100644 --- a/manifest.json +++ b/manifest.json @@ -104,7 +104,6 @@ "modules" : { "Bluetooth" : {}, "VideoPlayer" : {}, - "LivePusher" : {}, "Camera" : {}, "Record" : {} }, 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 55d5158..c9e0cbd 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts @@ -4,6 +4,42 @@ import { Result } from '../interface.uts' +function avRecvHandle( + id: Optional>, + recv_buf: Optional>, + recv_len: Int +) { + if (id != null) { + const idString = P2PConversionHelper.cStringToString(id) + // console.log(`avRecvHandle: ${idString}`) + } +} + +function msgHandle( + id: Optional>, + type: XP2PType, + msg: Optional> +): Optional> { + const idString = id != null ? P2PConversionHelper.cStringToString(id) : '' + const msgString = msg != null ? P2PConversionHelper.cStringToString(msg) : '' + if (type == XP2PTypeLog) { + console.log(`${msgString}`) + } + return null +} + +function deviceDataHandle( + id: Optional>, + recv_buf: Optional>, + recv_len: Int +): Optional> { + if (id != null) { + const idString = P2PConversionHelper.cStringToString(id) + // console.log(`deviceDataHandle: ${idString}, len: ${recv_len}`) + } + return null +} + export const startServiceFunction = async function ( appKey: string, appSecret: string, @@ -18,7 +54,10 @@ export const startServiceFunction = async function ( config.ip = UnsafePointer(strdup('')!) config.port = 20002 config.type = XP2P_PROTOCOL_AUTO - config.cross = false + config.cross = true + + // 设置回调 + setUserCallbackToXp2p(avRecvHandle, msgHandle, deviceDataHandle) const result = startService(`${productId}/${deviceName}`, productId, deviceName, config)