diff --git a/src/app/web-live/page.tsx b/src/app/web-live/page.tsx index 2ae6552..1a9dceb 100644 --- a/src/app/web-live/page.tsx +++ b/src/app/web-live/page.tsx @@ -3,6 +3,8 @@ import { AlertTriangle,Radio } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; +import { useWebLiveSync } from '@/hooks/useWebLiveSync'; + import PageLayout from '@/components/PageLayout'; let Artplayer: any = null; @@ -27,6 +29,22 @@ export default function WebLivePage() { const [selectedPlatform, setSelectedPlatform] = useState(null); const [isWebLiveEnabled, setIsWebLiveEnabled] = useState(null); + // 观影室同步功能 + const webLiveSync = useWebLiveSync({ + currentSourceKey: currentSource?.key || '', + currentSourceName: currentSource?.name || '', + currentSourcePlatform: currentSource?.platform || '', + currentSourceRoomId: currentSource?.roomId || '', + onSourceChange: (sourceKey, platform, roomId) => { + // 房员接收到直播源切换指令 + if (!sources || !Array.isArray(sources)) return; + const source = sources.find(s => s.key === sourceKey); + if (source) { + handleSourceClick(source); + } + }, + }); + useEffect(() => { const meta = document.createElement('meta'); meta.name = 'referrer'; @@ -419,7 +437,7 @@ export default function WebLivePage() { {/* 外部播放器按钮 */} - {currentSource && ( + {currentSource && !webLiveSync.isInRoom && (
@@ -653,7 +671,8 @@ export default function WebLivePage() {