适配微信小程序
This commit is contained in:
@@ -76,8 +76,9 @@ onMounted(() => {
|
|||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// 初始化小程序通话信令监听器
|
// 初始化小程序通话信令监听器
|
||||||
|
// 注意:initPusherContext 不在这里调用,因为此时 live-pusher 组件还未渲染
|
||||||
|
// live-pusher 的 Context 初始化由 MiniProgramCallWindow.vue 在 pushUrl 设置后处理
|
||||||
mpCall.initListener()
|
mpCall.initListener()
|
||||||
mpCall.initPusherContext()
|
|
||||||
console.log('✅ [GlobalCallProvider] 微信小程序通话监听器已初始化')
|
console.log('✅ [GlobalCallProvider] 微信小程序通话监听器已初始化')
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const { initListener: initWebRTCListener } = useWebRTC()
|
|||||||
import MiniProgramCallWindow from './MiniProgramCallWindow.vue'
|
import MiniProgramCallWindow from './MiniProgramCallWindow.vue'
|
||||||
import { useMiniProgramCall } from '@/composables/useMiniProgramCall'
|
import { useMiniProgramCall } from '@/composables/useMiniProgramCall'
|
||||||
|
|
||||||
const { initListener: initMPListener, initPusherContext } = useMiniProgramCall()
|
const { initListener: initMPListener } = useMiniProgramCall()
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -37,8 +37,9 @@ onMounted(() => {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
|
// 注意:initPusherContext 不在这里调用,因为此时 live-pusher 组件还未渲染
|
||||||
|
// live-pusher 的 Context 初始化由 MiniProgramCallWindow.vue 在 pushUrl 设置后处理
|
||||||
initMPListener()
|
initMPListener()
|
||||||
initPusherContext()
|
|
||||||
// #endif
|
// #endif
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ export function useMiniProgramCall() {
|
|||||||
} else {
|
} else {
|
||||||
console.error('[MiniProgramCall] ❌ 推流地址验证失败:', validation.error)
|
console.error('[MiniProgramCall] ❌ 推流地址验证失败:', validation.error)
|
||||||
uni.showToast({ title: validation.error || '推流地址无效', icon: 'none' })
|
uni.showToast({ title: validation.error || '推流地址无效', icon: 'none' })
|
||||||
pushUrl.value = response.push_url
|
pushUrl.value = response.push_url
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('[MiniProgramCall] ❌ 服务器未返回推流地址')
|
console.error('[MiniProgramCall] ❌ 服务器未返回推流地址')
|
||||||
@@ -364,7 +364,7 @@ export function useMiniProgramCall() {
|
|||||||
|
|
||||||
if (call.active && pushUrl.value && pusherContext) {
|
if (call.active && pushUrl.value && pusherContext) {
|
||||||
console.log('[MiniProgramCall] 🔄 autopush 未成功,尝试手动启动推流')
|
console.log('[MiniProgramCall] 🔄 autopush 未成功,尝试手动启动推流')
|
||||||
startPushing()
|
startPushing()
|
||||||
} else if (call.active && pushUrl.value && !pusherContext) {
|
} else if (call.active && pushUrl.value && !pusherContext) {
|
||||||
console.warn('[MiniProgramCall] ⚠️ pusherContext 未初始化,等待后重试')
|
console.warn('[MiniProgramCall] ⚠️ pusherContext 未初始化,等待后重试')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user