Files
youle_app_ios_v2/ylgamehall/Source/Bridge/Handlers/VideoRoomHandlers.swift
T
joywayerandClaude Opus 4.7 c77037f407 Phase 8 视频房间 3 件套 stub:createRoom / getVideoinfo / exitRoom
业务暂未启用视频功能,按运营确认仅维持桥契约,让 H5 子游戏调用不报 "no handler"。

- 新增 Source/Bridge/Handlers/VideoRoomHandlers.swift:单一 enum.register 3 个 stub,
  各自 callback 字面回包名(与 OpenSaomaHandler 同款 stub 模式)
- SubGameViewController.registerBridgeHandlers 挂上 VideoRoomHandlers
- 不抽 VideoRoom protocol / NoopVideoRoom 类(违反"不为假设的未来需求设计"原则);
  未来重新接入 Agora 时把 3 个 stub 展开实现即可,注册点不变
- Plan §5.6.3 / §5.8.1-8.3 进度已勾选

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-22 21:19:55 +08:00

46 lines
2.0 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// VideoRoomHandlers.swift
// ylgamehall
//
// H5 → Native handler stub:声网视频房间 3 件套(createRoom / getVideoinfo / exitRoom)。
// 契约:docs/H5-Native-Contract.md §3.1 19][20][21
//
// 当前业务不使用视频功能(运营确认下线 / 暂未启用),此处仅注册空 handler 维持
// 桥契约:H5 子游戏页若误调不会触发 "bridge handler not found" 错误分支。
// 当未来重新接入 Agora 时(Phase 8 完整实现),把每个 handler 的实现展开即可,
// 注册位点不变。
//
// 注:契约 §3.2 13]的 Native → H5 反向 `getVideoinfo(uid 字符串)` 在 Agora SDK
// didDecodedRemoteVideo 时由 SDK 适配层触发,与本文件 stub 无关。
//
// ⚠️ 仅注册到 SubGameViewController;大厅 WebContainerViewController 不注册
// msext NewRootVC 也不注册,沿用 msext 行为)。
//
import Foundation
public enum VideoRoomHandlers {
public static func register(on bridge: any BridgeProtocol) {
// 【19】createRoom — 创建/加入音视频房间
// 入参:pmw / pmh / top / left / width / height / playerid / roomid
// 完整实现:md5(agentinfo+gameinfo+roomid) 算频道名 + Agora joinChannel + 本地画像
bridge.register("createRoom") { _, callback in
callback?(.string("createRoom"))
}
// 【20】getVideoinfoH5→Native 方向)— 添加/排版远端视频窗
// 入参与 createRoom 几乎相同,缺 roomid(已在房间内)
// 完整实现:Agora setupRemoteVideo + 把 view 放到 H5 指定坐标
bridge.register("getVideoinfo") { _, callback in
callback?(.string("getVideoinfo"))
}
// 【21】exitRoom — 离开房间
// 完整实现:Agora leaveChannel + 清理本地/远端 view
bridge.register("exitRoom") { _, callback in
callback?(.string("exitRoom"))
}
}
}