feat: ios端xp2p添加事件监听回调
This commit is contained in:
parent
a01ac4a237
commit
5859f78b36
2
App.vue
2
App.vue
@ -81,7 +81,7 @@
|
|||||||
listenerUI: {
|
listenerUI: {
|
||||||
cameraRotation: 270,
|
cameraRotation: 270,
|
||||||
objectFit: 'fill',
|
objectFit: 'fill',
|
||||||
enableToggleCamera: false
|
enableToggleCamera: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
wmpfVoip.setVoipEndPagePath({
|
wmpfVoip.setVoipEndPagePath({
|
||||||
|
|||||||
@ -104,7 +104,6 @@
|
|||||||
"modules" : {
|
"modules" : {
|
||||||
"Bluetooth" : {},
|
"Bluetooth" : {},
|
||||||
"VideoPlayer" : {},
|
"VideoPlayer" : {},
|
||||||
"LivePusher" : {},
|
|
||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
"Record" : {}
|
"Record" : {}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -4,6 +4,42 @@
|
|||||||
|
|
||||||
import { Result } from '../interface.uts'
|
import { Result } from '../interface.uts'
|
||||||
|
|
||||||
|
function avRecvHandle(
|
||||||
|
id: Optional<UnsafePointer<Int8>>,
|
||||||
|
recv_buf: Optional<UnsafeMutablePointer<UInt8>>,
|
||||||
|
recv_len: Int
|
||||||
|
) {
|
||||||
|
if (id != null) {
|
||||||
|
const idString = P2PConversionHelper.cStringToString(id)
|
||||||
|
// console.log(`avRecvHandle: ${idString}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function msgHandle(
|
||||||
|
id: Optional<UnsafePointer<Int8>>,
|
||||||
|
type: XP2PType,
|
||||||
|
msg: Optional<UnsafePointer<Int8>>
|
||||||
|
): Optional<UnsafePointer<Int8>> {
|
||||||
|
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<UnsafePointer<Int8>>,
|
||||||
|
recv_buf: Optional<UnsafeMutablePointer<UInt8>>,
|
||||||
|
recv_len: Int
|
||||||
|
): Optional<UnsafeMutablePointer<Int8>> {
|
||||||
|
if (id != null) {
|
||||||
|
const idString = P2PConversionHelper.cStringToString(id)
|
||||||
|
// console.log(`deviceDataHandle: ${idString}, len: ${recv_len}`)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
export const startServiceFunction = async function (
|
export const startServiceFunction = async function (
|
||||||
appKey: string,
|
appKey: string,
|
||||||
appSecret: string,
|
appSecret: string,
|
||||||
@ -18,7 +54,10 @@ export const startServiceFunction = async function (
|
|||||||
config.ip = UnsafePointer(strdup('')!)
|
config.ip = UnsafePointer(strdup('')!)
|
||||||
config.port = 20002
|
config.port = 20002
|
||||||
config.type = XP2P_PROTOCOL_AUTO
|
config.type = XP2P_PROTOCOL_AUTO
|
||||||
config.cross = false
|
config.cross = true
|
||||||
|
|
||||||
|
// 设置回调
|
||||||
|
setUserCallbackToXp2p(avRecvHandle, msgHandle, deviceDataHandle)
|
||||||
|
|
||||||
const result = startService(`${productId}/${deviceName}`, productId, deviceName, config)
|
const result = startService(`${productId}/${deviceName}`, productId, deviceName, config)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user