feat: 腾讯p2p的master分支逻辑

This commit is contained in:
fanpeng 2025-06-27 11:24:09 +08:00
parent 3a85d42c02
commit 4a2d418526
8 changed files with 95 additions and 20 deletions

View File

@ -314,7 +314,7 @@
}) })
const jumpToPlayer = async () => { const jumpToPlayer = async () => {
// #ifdef APP-PLUS // #ifdef APP-ANDROID
// //
const result = await requestPermission() const result = await requestPermission()
if (result.code !== 0) { if (result.code !== 0) {

View File

@ -188,7 +188,7 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
import { import {
startService, startServiceFunction,
stopService, stopService,
runSendService, runSendService,
stopSendService, stopSendService,
@ -262,14 +262,23 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (code === 0) { if (code === 0) {
deviceInfo.value = data deviceInfo.value = data
const result = await startService({ const params = {
appKey: 'aanuJXFtISXFYVVsd', appKey: 'aanuJXFtISXFYVVsd',
appSecret: 'SsnOMHJUcazCvpULSVWY', appSecret: 'SsnOMHJUcazCvpULSVWY',
productId: deviceInfo.value.productId, productId: deviceInfo.value.productId,
deviceName: deviceInfo.value.deviceName, deviceName: deviceInfo.value.deviceName,
xp2pInfo: deviceInfo.value.xp2pInfo 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 url.value = result.data.url
runSendService( runSendService(
`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`,

View File

@ -0,0 +1,3 @@
{
"deploymentTarget": "12"
}

View File

@ -4,7 +4,7 @@
import { UTSAndroid } from 'io.dcloud.uts' import { UTSAndroid } from 'io.dcloud.uts'
import { XP2PAppConfig, XP2P, XP2PCallback } from 'com.tencent.xnet' 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 { class XP2PCallbackImpl extends XP2PCallback {
private eventNotifyCallback?: (id: string | null, msg: string | null, event: Int) => void 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<Result> { export const startServiceFunction = async function (
appKey: string,
appSecret: string,
productId: string,
deviceName: string,
xp2pInfo: string
): Promise<Result> {
try { try {
const context = UTSAndroid.getAppContext() const context = UTSAndroid.getAppContext()
let xp2pConfig: XP2PAppConfig = new XP2PAppConfig() let xp2pConfig: XP2PAppConfig = new XP2PAppConfig()
xp2pConfig.appKey = params.appKey xp2pConfig.appKey = appKey
xp2pConfig.appSecret = params.appSecret xp2pConfig.appSecret = appSecret
await XP2P.startService( await XP2P.startService(context, productId, deviceName, xp2pInfo, xp2pConfig)
context,
params.productId,
params.deviceName,
params.xp2pInfo,
xp2pConfig
)
return new Promise<Result>((resolve, reject) => { return new Promise<Result>((resolve, reject) => {
const callback: XP2PCallback = new XP2PCallbackImpl( const callback: XP2PCallback = new XP2PCallbackImpl(

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>cydia</string>
</array>
</dict>
</plist>

View File

@ -1,11 +1,27 @@
{ {
"deploymentTarget": "12", "deploymentTarget": "9",
"frameworks": [
"AVFoundation.framework",
"CoreMedia.framework",
"VideoToolbox.framework",
"AudioToolbox.framework"
],
"dependencies-pods": [ "dependencies-pods": [
{ {
"name": "TIoTLinkVideo", "name": "TIoTLinkVideo",
"repo": { "version": "2.4.48"
"git": "https://github.com/tencentyun/iot-link-ios" },
} {
"name": "TIoTLinkKit_XP2P",
"version": "2.4.53"
},
{
"name": "TIoTLinkKit_GVoiceSE",
"version": "1.0.9"
},
{
"name": "TIoTLinkKit_IJKPlayer",
"version": "2.0.15"
} }
] ]
} }

View File

@ -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<Result> {
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