@realsee/live 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +209 -87
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +644 -87
- package/dist/index.es.js.map +1 -1
- package/dist/live/controller.d.ts +163 -42
- package/dist/live/createLive.d.ts +35 -3
- package/dist/live/createLiveReact.d.ts +51 -3
- package/dist/live/live.d.ts +501 -50
- package/dist/rtc/BrowserRTC.d.ts +63 -0
- package/dist/rtc/BrowserRTC4Chime.d.ts +38 -2
- package/dist/rtc/CoreRTC.d.ts +65 -1
- package/dist/rtc/VRWebViewRTC.d.ts +56 -6
- package/dist/typings/live/EventType.d.ts +58 -10
- package/dist/typings/live/GetVoiceSign.d.ts +27 -7
- package/dist/typings/live/UserInfo.d.ts +70 -0
- package/dist/typings/rtc/eventType.d.ts +55 -8
- package/dist/utils/appendUri.d.ts +17 -0
- package/dist/utils/uuid.d.ts +11 -1
- package/docs/assets/highlight.css +34 -6
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/BrowserRTC.html +50 -22
- package/docs/classes/BrowserRTC4Chime.html +51 -23
- package/docs/classes/CoreRTC.html +28 -23
- package/docs/classes/Live.html +197 -41
- package/docs/classes/Subscribe.html +36 -0
- package/docs/classes/VRWebViewRTC.html +32 -13
- package/docs/enums/MemUserStatus.html +10 -2
- package/docs/functions/GetVoiceSignFn.html +20 -4
- package/docs/functions/createLive.html +9 -2
- package/docs/functions/createLiveReact.html +110 -17
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +80 -118
- package/docs/interfaces/LiveOptions.html +20 -4
- package/docs/interfaces/Permission.html +18 -2
- package/docs/interfaces/RTCProtocol.html +6 -6
- package/docs/interfaces/SubscribeMixinType.emit.html +1 -0
- package/docs/interfaces/SubscribeMixinType.hasListener.html +1 -0
- package/docs/interfaces/SubscribeMixinType.off.html +1 -0
- package/docs/interfaces/SubscribeMixinType.on.html +1 -0
- package/docs/interfaces/SubscribeMixinType.once.html +1 -0
- package/docs/interfaces/VRWebViewRTCOptions.html +20 -4
- package/docs/modules/SubscribeMixinType.html +6 -0
- package/docs/modules.html +4 -1
- package/docs/types/EventMap.html +1 -0
- package/docs/types/EventType.html +1 -1
- package/docs/types/GetVoiceSign.html +2 -1
- package/docs/types/KeyframeEventType.html +1 -1
- package/docs/types/LiveEventType.html +38 -12
- package/docs/types/LiveProviderPropTypes.html +5 -1
- package/docs/types/RTCEventType.html +29 -7
- package/docs/types/UserInfo.html +1 -1
- package/docs/types/UserInfoExt.html +1 -1
- package/package.json +1 -1
package/docs/classes/Live.html
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Live | 如视 Live SDK</title><meta name="description" content="Documentation for 如视 Live SDK"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">如视 Live SDK</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">如视 Live SDK</a></li><li><a href="Live.html">Live</a></li></ul><h1> ClassLive<KeyframesSnapshot></h1></div
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Live | 如视 Live SDK</title><meta name="description" content="Documentation for 如视 Live SDK"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">如视 Live SDK</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">如视 Live SDK</a></li><li><a href="Live.html">Live</a></li></ul><h1> ClassLive<KeyframesSnapshot></h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Live 带看实例类</p>
|
|
2
|
+
<p>这是带看功能的核心类,负责管理 WebSocket 连接、帧数据同步、RTC 语音通信等功能。
|
|
3
|
+
通过 Yjs 实现帧数据的协同编辑和同步。</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example" class="tsd-anchor"></a>Example<a href="#Example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 定义帧数据类型</span><br/><span class="hl-6">interface</span><span class="hl-2"> </span><span class="hl-7">MyKeyframes</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">camera</span><span class="hl-2">: { </span><span class="hl-5">position</span><span class="hl-2">: [</span><span class="hl-7">number</span><span class="hl-2">, </span><span class="hl-7">number</span><span class="hl-2">, </span><span class="hl-7">number</span><span class="hl-2">] }</span><br/><span class="hl-2"> </span><span class="hl-5">annotation</span><span class="hl-2">: { </span><span class="hl-5">text</span><span class="hl-2">: </span><span class="hl-7">string</span><span class="hl-2">; </span><span class="hl-5">position</span><span class="hl-2">: [</span><span class="hl-7">number</span><span class="hl-2">, </span><span class="hl-7">number</span><span class="hl-2">] }</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-0">// 创建 Live 实例</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">live</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Live</span><span class="hl-2"><</span><span class="hl-7">MyKeyframes</span><span class="hl-2">>({</span><br/><span class="hl-2"> </span><span class="hl-5">url:</span><span class="hl-2"> </span><span class="hl-3">'wss://example.com/live'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getTicket</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> </span><span class="hl-3">'your-ticket'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getVoiceSign</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> (</span><span class="hl-5">params</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> ({ </span><span class="hl-5">sdkAppId:</span><span class="hl-2"> </span><span class="hl-9">0</span><span class="hl-2">, </span><span class="hl-5">userId:</span><span class="hl-2"> </span><span class="hl-3">''</span><span class="hl-2">, </span><span class="hl-5">userSig:</span><span class="hl-2"> </span><span class="hl-3">''</span><span class="hl-2">, </span><span class="hl-5">roomId:</span><span class="hl-2"> </span><span class="hl-3">''</span><span class="hl-2"> }),</span><br/><span class="hl-2"> </span><span class="hl-5">useBuiltInRTC:</span><span class="hl-2"> </span><span class="hl-6">true</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-0">// 监听状态变化</span><br/><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">'stateChange'</span><span class="hl-2">, (</span><span class="hl-5">state</span><span class="hl-2">, </span><span class="hl-5">prevState</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">`状态从 </span><span class="hl-6">${</span><span class="hl-5">prevState</span><span class="hl-6">}</span><span class="hl-3"> 变为 </span><span class="hl-6">${</span><span class="hl-5">state</span><span class="hl-6">}</span><span class="hl-3">`</span><span class="hl-2">)</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-0">// 连接带看</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">connect</span><span class="hl-2">()</span>
|
|
5
|
+
</code><button type="button">Copy</button></pre>
|
|
6
|
+
|
|
7
|
+
</div></div></section> <section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="KeyframesSnapshot" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">KeyframesSnapshot</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>帧数据快照类型,必须是一个对象类型</p>
|
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></section> <section class="tsd-panel tsd-hierarchy"><h4>Hierarchy (<a href="../hierarchy.html#Live">view full</a>)</h4><ul class="tsd-hierarchy"><li><a href="Subscribe.html" class="tsd-signature-type tsd-kind-class">Subscribe</a><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><ul class="tsd-hierarchy"><li><span class="target">Live</span></li></ul></li></ul></section><aside class="tsd-sources"><ul><li>Defined in live/live.ts:94</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="Live.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
|
2
9
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="Live.html#keyframes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>keyframes</span></a>
|
|
3
10
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Accessors</h3><div class="tsd-index-list"><a href="Live.html#_RTC" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>$RTC</span></a>
|
|
4
11
|
<a href="Live.html#jsBridge" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>js<wbr/>Bridge</span></a>
|
|
@@ -32,62 +39,211 @@
|
|
|
32
39
|
<a href="Live.html#setSelfInfo" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Self<wbr/>Info</span></a>
|
|
33
40
|
<a href="Live.html#toggleMicro" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>toggle<wbr/>Micro</span></a>
|
|
34
41
|
<a href="Live.html#updateStatus" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Status</span></a>
|
|
35
|
-
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_Live" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Live</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">opts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Live.html" class="tsd-signature-type tsd-kind-class">Live</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><a href="#constructor.new_Live" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><
|
|
36
|
-
</div><
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
</div><div class="tsd-comment tsd-typography"></div></li><
|
|
51
|
-
</
|
|
52
|
-
|
|
53
|
-
</div><
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</
|
|
42
|
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_Live" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Live</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">opts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Live.html" class="tsd-signature-type tsd-kind-class">Live</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><a href="#constructor.new_Live" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>创建 Live 带看实例</p>
|
|
43
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="constructor.new_Live.KeyframesSnapshot-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">KeyframesSnapshot</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">opts</span>: <a href="../interfaces/LiveOptions.html" class="tsd-signature-type tsd-kind-interface">LiveOptions</a></span><div class="tsd-comment tsd-typography"><p>带看配置选项,包含以下属性:</p>
|
|
44
|
+
<ul>
|
|
45
|
+
<li>url: WebSocket 连接地址(可选,可在 connect 时提供)</li>
|
|
46
|
+
<li>getTicket: 获取连接票据的函数(可选,可在 connect 时提供)</li>
|
|
47
|
+
<li>rtc: RTC 实例(可选,如果不提供会根据配置自动创建)</li>
|
|
48
|
+
<li>rtcType: 指定内置 RTC 类型(当 rtc 为空时使用)</li>
|
|
49
|
+
<li>useBuiltInRTC: 是否使用内置 RTC(默认根据环境自动选择)</li>
|
|
50
|
+
<li>getVoiceSign: 获取语音签名的函数(使用内置 RTC 时必需)</li>
|
|
51
|
+
<li>jsBridge: JSBridge 实例(可选,用于 App/WebView 环境)</li>
|
|
52
|
+
<li>useBuiltInJsBridge: 是否使用内置 JSBridge(默认 false)</li>
|
|
53
|
+
<li>initialMicroStatus: 麦克风初始状态(默认 OPEN)</li>
|
|
54
|
+
<li>autoPlayConfirm: 自动播放确认回调(使用 BrowserRTC 时可能需要)</li>
|
|
55
|
+
<li><strong>debug</strong>: 是否开启调试模式(会在控制台打印日志)</li>
|
|
56
|
+
</ul>
|
|
57
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="Live.html" class="tsd-signature-type tsd-kind-class">Live</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-1" class="tsd-anchor"></a>Example<a href="#Example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 基础用法</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">live</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Live</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-5">url:</span><span class="hl-2"> </span><span class="hl-3">'wss://example.com/live'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getTicket</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">response</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">fetch</span><span class="hl-2">(</span><span class="hl-3">'/api/get-ticket'</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2"> </span><span class="hl-5">response</span><span class="hl-2">.</span><span class="hl-1">json</span><span class="hl-2">().</span><span class="hl-5">ticket</span><br/><span class="hl-2"> },</span><br/><span class="hl-2"> </span><span class="hl-1">getVoiceSign</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> (</span><span class="hl-5">params</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">response</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">fetch</span><span class="hl-2">(</span><span class="hl-3">'/api/get-voice-sign'</span><span class="hl-2">, {</span><br/><span class="hl-2"> </span><span class="hl-5">method:</span><span class="hl-2"> </span><span class="hl-3">'POST'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">body:</span><span class="hl-2"> </span><span class="hl-8">JSON</span><span class="hl-2">.</span><span class="hl-1">stringify</span><span class="hl-2">(</span><span class="hl-5">params</span><span class="hl-2">)</span><br/><span class="hl-2"> })</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2"> </span><span class="hl-5">response</span><span class="hl-2">.</span><span class="hl-1">json</span><span class="hl-2">()</span><br/><span class="hl-2"> },</span><br/><span class="hl-2"> </span><span class="hl-5">useBuiltInRTC:</span><span class="hl-2"> </span><span class="hl-6">true</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-0">// 使用自定义 RTC</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">customRTC</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">MyCustomRTC</span><span class="hl-2">()</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">live</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Live</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-5">rtc:</span><span class="hl-2"> </span><span class="hl-5">customRTC</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">url:</span><span class="hl-2"> </span><span class="hl-3">'wss://example.com/live'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getTicket</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> </span><span class="hl-3">'ticket'</span><br/><span class="hl-2">})</span>
|
|
58
|
+
</code><button type="button">Copy</button></pre>
|
|
59
|
+
|
|
60
|
+
</div></div><aside class="tsd-sources"><p>Overrides <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#constructor">constructor</a></p><ul><li>Defined in live/live.ts:219</li></ul></aside></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="keyframes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>keyframes</span><a href="#keyframes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">keyframes</span><span class="tsd-signature-symbol">:</span> <a href="Subscribe.html" class="tsd-signature-type tsd-kind-class">Subscribe</a><span class="tsd-signature-symbol"><</span><a href="../types/KeyframeEventType.html" class="tsd-signature-type tsd-kind-type-alias">KeyframeEventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = ...</span></div><div class="tsd-comment tsd-typography"><p>帧数据监听器</p>
|
|
61
|
+
<p>用于监听特定键的帧数据变化。当其他用户发送帧数据更新时,会触发对应键的事件。</p>
|
|
62
|
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-2" class="tsd-anchor"></a>Example<a href="#Example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 监听 camera 帧数据的变化</span><br/><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">keyframes</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">'camera'</span><span class="hl-2">, (</span><span class="hl-5">nextFrame</span><span class="hl-2">, </span><span class="hl-5">prevFrame</span><span class="hl-2">, </span><span class="hl-5">frontRequestId</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'相机位置更新:'</span><span class="hl-2">, </span><span class="hl-5">nextFrame</span><span class="hl-2">)</span><br/><span class="hl-2">})</span>
|
|
63
|
+
</code><button type="button">Copy</button></pre>
|
|
64
|
+
|
|
65
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:163</li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Accessors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Accessors</h2></summary><section><section class="tsd-panel tsd-member"><a id="_RTC" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>$RTC</span><a href="#_RTC" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="_RTC._RTC-1"><span class="tsd-signature-keyword">get</span> $RTC<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/RTCProtocol.html" class="tsd-signature-type tsd-kind-interface">RTCProtocol</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前 live 实例使用的 RTC 实例</p>
|
|
66
|
+
</div><h4 class="tsd-returns-title">Returns <a href="../interfaces/RTCProtocol.html" class="tsd-signature-type tsd-kind-interface">RTCProtocol</a></h4><p>RTC 协议实例,用于语音通信</p>
|
|
67
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:138</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="jsBridge" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>js<wbr/>Bridge</span><a href="#jsBridge" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="jsBridge.jsBridge-1"><span class="tsd-signature-keyword">get</span> jsBridge<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">JSBridgeProtocol</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前 live 实例使用的 jsBridge 实例</p>
|
|
68
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">JSBridgeProtocol</span></h4><p>JSBridge 协议实例,用于与原生 App 通信</p>
|
|
69
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:146</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="options" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>options</span><a href="#options" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="options.options-1"><span class="tsd-signature-keyword">get</span> options<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/LiveOptions.html" class="tsd-signature-type tsd-kind-interface">LiveOptions</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取带看的配置选项(只读)</p>
|
|
70
|
+
</div><h4 class="tsd-returns-title">Returns <a href="../interfaces/LiveOptions.html" class="tsd-signature-type tsd-kind-interface">LiveOptions</a></h4><p>冻结的配置选项对象</p>
|
|
71
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:104</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="readyState" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ready<wbr/>State</span><a href="#readyState" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="readyState.readyState-1"><span class="tsd-signature-keyword">get</span> readyState<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../enums/LiveState.html" class="tsd-signature-type tsd-kind-enum">LiveState</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>兼容老逻辑</p>
|
|
72
|
+
</div><h4 class="tsd-returns-title">Returns <a href="../enums/LiveState.html" class="tsd-signature-type tsd-kind-enum">LiveState</a></h4><p>当前连接状态</p>
|
|
73
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Deprecated"><h4 class="tsd-anchor-link"><a id="Deprecated" class="tsd-anchor"></a>Deprecated<a href="#Deprecated" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>请直接读取 state 属性字段,未来将移除该属性</p>
|
|
74
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:121</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="roomInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>room<wbr/>Info</span><a href="#roomInfo" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="roomInfo.roomInfo-1"><span class="tsd-signature-keyword">get</span> roomInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/RoomInfo.html" class="tsd-signature-type tsd-kind-type-alias">RoomInfo</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前带看房间信息</p>
|
|
75
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/RoomInfo.html" class="tsd-signature-type tsd-kind-type-alias">RoomInfo</a></h4><p>房间信息对象,如果尚未获取则返回 undefined</p>
|
|
76
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-3" class="tsd-anchor"></a>Example<a href="#Example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">roomInfo</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">roomInfo</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">roomInfo</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'房间代码:'</span><span class="hl-2">, </span><span class="hl-5">roomInfo</span><span class="hl-2">.</span><span class="hl-5">info</span><span class="hl-2">.</span><span class="hl-5">room_code</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'房间状态:'</span><span class="hl-2">, </span><span class="hl-5">roomInfo</span><span class="hl-2">.</span><span class="hl-5">info</span><span class="hl-2">.</span><span class="hl-5">status</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
77
|
+
</code><button type="button">Copy</button></pre>
|
|
78
|
+
|
|
79
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:413</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="selfInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>self<wbr/>Info</span><a href="#selfInfo" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="selfInfo.selfInfo-1"><span class="tsd-signature-keyword">get</span> selfInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/UserInfo.html" class="tsd-signature-type tsd-kind-type-alias">UserInfo</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前用户信息</p>
|
|
80
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/UserInfo.html" class="tsd-signature-type tsd-kind-type-alias">UserInfo</a></h4><p>当前用户信息对象,如果尚未获取则返回 undefined</p>
|
|
81
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-4" class="tsd-anchor"></a>Example<a href="#Example-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">selfInfo</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">selfInfo</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">selfInfo</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'用户ID:'</span><span class="hl-2">, </span><span class="hl-5">selfInfo</span><span class="hl-2">.</span><span class="hl-5">id</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'麦克风状态:'</span><span class="hl-2">, </span><span class="hl-5">selfInfo</span><span class="hl-2">.</span><span class="hl-5">micro_status</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'用户权限:'</span><span class="hl-2">, </span><span class="hl-5">selfInfo</span><span class="hl-2">.</span><span class="hl-5">permission</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
82
|
+
</code><button type="button">Copy</button></pre>
|
|
83
|
+
|
|
84
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:379</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="snapshot" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>snapshot</span><a href="#snapshot" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="snapshot.snapshot-1"><span class="tsd-signature-keyword">get</span> snapshot<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前所有帧数据的快照</p>
|
|
85
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></h4><p>当前帧数据的部分快照对象</p>
|
|
86
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-5" class="tsd-anchor"></a>Example<a href="#Example-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">snapshot</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">snapshot</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'当前相机位置:'</span><span class="hl-2">, </span><span class="hl-5">snapshot</span><span class="hl-2">.</span><span class="hl-5">camera</span><span class="hl-2">)</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'当前标注:'</span><span class="hl-2">, </span><span class="hl-5">snapshot</span><span class="hl-2">.</span><span class="hl-5">annotation</span><span class="hl-2">)</span>
|
|
87
|
+
</code><button type="button">Copy</button></pre>
|
|
88
|
+
|
|
89
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:245</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="state" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>state</span><a href="#state" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="state.state-1"><span class="tsd-signature-keyword">get</span> state<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../enums/LiveState.html" class="tsd-signature-type tsd-kind-enum">LiveState</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前带看连接状态</p>
|
|
90
|
+
</div><h4 class="tsd-returns-title">Returns <a href="../enums/LiveState.html" class="tsd-signature-type tsd-kind-enum">LiveState</a></h4><p>当前连接状态</p>
|
|
91
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:112</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="url" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>url</span><a href="#url" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="url.url-1"><span class="tsd-signature-keyword">get</span> url<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。</p>
|
|
92
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h4><p>WebSocket 连接 URL,如果未设置则返回 undefined</p>
|
|
93
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Deprecated"><h4 class="tsd-anchor-link"><a id="Deprecated-1" class="tsd-anchor"></a>Deprecated<a href="#Deprecated-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>带看不需要关注底层ws的相关信息,未来将移除</p>
|
|
94
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:130</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="userList" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>user<wbr/>List</span><a href="#userList" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="userList.userList-1"><span class="tsd-signature-keyword">get</span> userList<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../types/UserInfo.html" class="tsd-signature-type tsd-kind-type-alias">UserInfo</a><span class="tsd-signature-symbol">[]</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取当前房间内的用户列表</p>
|
|
95
|
+
</div><h4 class="tsd-returns-title">Returns <a href="../types/UserInfo.html" class="tsd-signature-type tsd-kind-type-alias">UserInfo</a><span class="tsd-signature-symbol">[]</span></h4><p>用户信息数组,如果尚未获取则返回空数组</p>
|
|
96
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-6" class="tsd-anchor"></a>Example<a href="#Example-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">users</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">userList</span><br/><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">`房间内有 </span><span class="hl-6">${</span><span class="hl-5">users</span><span class="hl-10">.</span><span class="hl-5">length</span><span class="hl-6">}</span><span class="hl-3"> 个用户`</span><span class="hl-2">)</span><br/><span class="hl-5">users</span><span class="hl-2">.</span><span class="hl-1">forEach</span><span class="hl-2">(</span><span class="hl-5">user</span><span class="hl-2"> </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">`用户 </span><span class="hl-6">${</span><span class="hl-5">user</span><span class="hl-10">.</span><span class="hl-5">id</span><span class="hl-6">}</span><span class="hl-3"> 在线状态: </span><span class="hl-6">${</span><span class="hl-5">user</span><span class="hl-10">.</span><span class="hl-5">current_ws_online</span><span class="hl-6">}</span><span class="hl-3">`</span><span class="hl-2">)</span><br/><span class="hl-2">})</span>
|
|
97
|
+
</code><button type="button">Copy</button></pre>
|
|
98
|
+
|
|
99
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:396</li></ul></aside></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="_exit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_exit</span><a href="#_exit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="_exit._exit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_exit</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#_exit._exit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>退出带看(内部方法)
|
|
100
|
+
清理数据并关闭连接,但不发送房间关闭消息</p>
|
|
101
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 关闭是否成功</p>
|
|
102
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:861</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="_handleKeyframesChange" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_handle<wbr/>Keyframes<wbr/>Change</span><a href="#_handleKeyframesChange" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="_handleKeyframesChange._handleKeyframesChange-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_handle<wbr/>Keyframes<wbr/>Change</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_handleKeyframesChange._handleKeyframesChange-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>处理帧数据变化(内部方法)
|
|
103
|
+
当本地或远程帧数据发生变化时,会触发此方法进行同步</p>
|
|
104
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <span class="tsd-signature-type">YMapEvent</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>Yjs Map 事件对象</p>
|
|
105
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:263</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="_initializeKeyframesObservers" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_initialize<wbr/>Keyframes<wbr/>Observers</span><a href="#_initializeKeyframesObservers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="_initializeKeyframesObservers._initializeKeyframesObservers-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_initialize<wbr/>Keyframes<wbr/>Observers</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#_initializeKeyframesObservers._initializeKeyframesObservers-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>初始化帧数据观察者(内部方法)
|
|
106
|
+
用于监听 Yjs Map 的变化并同步到其他用户</p>
|
|
107
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:253</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="broadcast" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>broadcast</span><a href="#broadcast" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="broadcast.broadcast-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">broadcast</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#broadcast.broadcast-1.Request">Request</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#broadcast.broadcast-1.Response">Response</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">request</span>, <span class="tsd-kind-parameter">toUserIds</span>, <span class="tsd-kind-parameter">timeout</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#broadcast.broadcast-1.Response">Response</a><span class="tsd-signature-symbol">></span><a href="#broadcast.broadcast-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>自定义广播消息</p>
|
|
108
|
+
<p>向指定用户发送自定义消息,并等待响应。如果设置了超时时间,
|
|
109
|
+
超时后会拒绝 Promise。</p>
|
|
110
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="broadcast.broadcast-1.Request" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Request</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>请求数据类型</p>
|
|
111
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><a id="broadcast.broadcast-1.Response" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Response</span></span><div class="tsd-comment tsd-typography"><p>响应数据类型</p>
|
|
112
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">request</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#broadcast.broadcast-1.Request">Request</a></span><div class="tsd-comment tsd-typography"><p>广播请求的数据对象</p>
|
|
113
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>目标用户ID,可以是单个字符串或字符串数组,空数组表示广播给所有人</p>
|
|
114
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">timeout</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>超时时间(毫秒),0 表示不超时</p>
|
|
115
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#broadcast.broadcast-1.Response">Response</a><span class="tsd-signature-symbol">></span></h4><p>Promise<Response> 响应数据,连接未打开返回 false,发送失败返回 Error</p>
|
|
116
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-7" class="tsd-anchor"></a>Example<a href="#Example-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 发送自定义消息并等待响应</span><br/><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">response</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">broadcast</span><span class="hl-2">(</span><br/><span class="hl-2"> { </span><span class="hl-5">type:</span><span class="hl-2"> </span><span class="hl-3">'ping'</span><span class="hl-2">, </span><span class="hl-5">data:</span><span class="hl-2"> </span><span class="hl-3">'hello'</span><span class="hl-2"> },</span><br/><span class="hl-2"> [</span><span class="hl-3">'user-id-1'</span><span class="hl-2">, </span><span class="hl-3">'user-id-2'</span><span class="hl-2">],</span><br/><span class="hl-2"> </span><span class="hl-9">5000</span><span class="hl-2"> </span><span class="hl-0">// 5秒超时</span><br/><span class="hl-2"> )</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'收到响应:'</span><span class="hl-2">, </span><span class="hl-5">response</span><span class="hl-2">)</span><br/><span class="hl-2">} </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">'广播失败或超时:'</span><span class="hl-2">, </span><span class="hl-5">error</span><span class="hl-2">)</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-0">// 广播给所有人</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">response</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">broadcast</span><span class="hl-2">(</span><br/><span class="hl-2"> { </span><span class="hl-5">type:</span><span class="hl-2"> </span><span class="hl-3">'announcement'</span><span class="hl-2">, </span><span class="hl-5">message:</span><span class="hl-2"> </span><span class="hl-3">'大家好'</span><span class="hl-2"> },</span><br/><span class="hl-2"> [],</span><br/><span class="hl-2"> </span><span class="hl-9">0</span><span class="hl-2"> </span><span class="hl-0">// 不超时</span><br/><span class="hl-2">)</span><br/><br/><span class="hl-0">// 监听广播消息</span><br/><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">on</span><span class="hl-2">(</span><span class="hl-3">'broadcast'</span><span class="hl-2">, (</span><span class="hl-5">data</span><span class="hl-2">, </span><span class="hl-5">frontRequestId</span><span class="hl-2">) </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'收到广播:'</span><span class="hl-2">, </span><span class="hl-5">data</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-0">// 可以在这里响应广播</span><br/><span class="hl-2">})</span>
|
|
117
|
+
</code><button type="button">Copy</button></pre>
|
|
118
|
+
|
|
119
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1065</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="close" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>close</span><a href="#close" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="close.close-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">close</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#close.close-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>关闭带看房间</p>
|
|
120
|
+
<p>关闭 WebSocket 连接、退出 RTC 房间,并发送房间关闭消息。
|
|
121
|
+
与 exit 方法不同的是,此方法会通知服务器房间已关闭。</p>
|
|
122
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise<void></p>
|
|
123
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-8" class="tsd-anchor"></a>Example<a href="#Example-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 关闭房间</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">close</span><span class="hl-2">()</span><br/><br/><span class="hl-0">// 在组件卸载时关闭</span><br/><span class="hl-1">useEffect</span><span class="hl-2">(() </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">close</span><span class="hl-2">()</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">}, [])</span>
|
|
124
|
+
</code><button type="button">Copy</button></pre>
|
|
125
|
+
|
|
126
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:907</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="connect" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>connect</span><a href="#connect" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="connect.connect-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">connect</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">></span><a href="#connect.connect-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>连接带看房间</p>
|
|
127
|
+
<p>建立 WebSocket 连接并加入带看房间。如果配置中已提供 url 和 getTicket,
|
|
128
|
+
可以在创建实例后自动连接,也可以手动调用此方法。</p>
|
|
129
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../types/LiveConnectOptions.html" class="tsd-signature-type tsd-kind-type-alias">LiveConnectOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>连接选项,包含以下属性:</p>
|
|
130
|
+
<ul>
|
|
131
|
+
<li>url: WebSocket 连接地址(可选,会覆盖构造函数中的配置)</li>
|
|
132
|
+
<li>getTicket: 获取连接票据的函数(可选,会覆盖构造函数中的配置)</li>
|
|
133
|
+
<li>rtcMicStatus: 麦克风初始状态(可选,会覆盖构造函数中的配置)</li>
|
|
134
|
+
<li>force: 是否强制连接(如果已有连接,会先关闭再连接)</li>
|
|
135
|
+
</ul>
|
|
136
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><span class="tsd-signature-symbol">></span></h4><p>连接结果,成功返回 true,失败返回 Error</p>
|
|
137
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-9" class="tsd-anchor"></a>Example<a href="#Example-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 在创建实例时已配置 url 和 getTicket</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">live</span><span class="hl-2"> = </span><span class="hl-6">new</span><span class="hl-2"> </span><span class="hl-1">Live</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-5">url:</span><span class="hl-2"> </span><span class="hl-3">'wss://example.com/live'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getTicket</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> </span><span class="hl-3">'ticket'</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-0">// 手动连接</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">result</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">connect</span><span class="hl-2">()</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">result</span><span class="hl-2"> === </span><span class="hl-6">true</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'连接成功'</span><span class="hl-2">)</span><br/><span class="hl-2">} </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">'连接失败:'</span><span class="hl-2">, </span><span class="hl-5">result</span><span class="hl-2">.</span><span class="hl-5">message</span><span class="hl-2">)</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-0">// 在连接时提供配置</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">connect</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-5">url:</span><span class="hl-2"> </span><span class="hl-3">'wss://example.com/live'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-1">getTicket</span><span class="hl-5">:</span><span class="hl-2"> </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">res</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">fetch</span><span class="hl-2">(</span><span class="hl-3">'/api/ticket'</span><span class="hl-2">)</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2"> </span><span class="hl-5">res</span><span class="hl-2">.</span><span class="hl-1">json</span><span class="hl-2">().</span><span class="hl-5">ticket</span><br/><span class="hl-2"> },</span><br/><span class="hl-2"> </span><span class="hl-5">rtcMicStatus:</span><span class="hl-2"> </span><span class="hl-5">MicroStatus</span><span class="hl-2">.</span><span class="hl-8">OPEN</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-0">// 强制重连</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">connect</span><span class="hl-2">({ </span><span class="hl-5">force:</span><span class="hl-2"> </span><span class="hl-6">true</span><span class="hl-2"> })</span>
|
|
138
|
+
</code><button type="button">Copy</button></pre>
|
|
139
|
+
|
|
140
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:809</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dispose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose</span><a href="#dispose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dispose.dispose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#dispose.dispose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>销毁带看实例</p>
|
|
141
|
+
<p>完全销毁实例,清理所有资源,包括事件监听、Yjs 文档等。
|
|
142
|
+
销毁后实例不能再使用,需要重新创建。</p>
|
|
143
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<void></p>
|
|
144
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-10" class="tsd-anchor"></a>Example<a href="#Example-10" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 销毁实例</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">dispose</span><span class="hl-2">()</span><br/><br/><span class="hl-0">// 在组件卸载时销毁</span><br/><span class="hl-1">useEffect</span><span class="hl-2">(() </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">return</span><span class="hl-2"> () </span><span class="hl-6">=></span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">dispose</span><span class="hl-2">()</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">}, [])</span>
|
|
145
|
+
</code><button type="button">Copy</button></pre>
|
|
146
|
+
|
|
147
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:938</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="emit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>emit</span><a href="#emit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="emit.emit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">emit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#emit.emit-1.K">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#emit.emit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>触发事件</p>
|
|
57
148
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="emit.emit-1.K" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-keyword">keyof </span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>预设的监听事件名称</p>
|
|
58
149
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#emit.emit-1.K">K</a></span><div class="tsd-comment tsd-typography"><p>事件类型</p>
|
|
59
150
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Rest</code><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#emit.emit-1.K">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>触发事件的数据</p>
|
|
60
151
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><p>canceled 是否被触发取消</p>
|
|
61
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from Subscribe.emit</p><ul><li>Defined in utils/subscribe.ts:115</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="exit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>exit</span><a href="#exit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="exit.exit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">exit</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#exit.exit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p
|
|
62
|
-
|
|
63
|
-
</div><
|
|
64
|
-
|
|
65
|
-
</
|
|
66
|
-
|
|
67
|
-
</div
|
|
152
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#emit">emit</a></p><ul><li>Defined in utils/subscribe.ts:115</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="exit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>exit</span><a href="#exit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="exit.exit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">exit</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#exit.exit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>退出带看房间</p>
|
|
153
|
+
<p>这是 close 方法的别名,用于保持 API 的一致性。</p>
|
|
154
|
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise<void></p>
|
|
155
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-11" class="tsd-anchor"></a>Example<a href="#Example-11" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 退出带看</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">exit</span><span class="hl-2">()</span>
|
|
156
|
+
</code><button type="button">Copy</button></pre>
|
|
157
|
+
|
|
158
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:885</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="forbidMicro" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>forbid<wbr/>Micro</span><a href="#forbidMicro" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="forbidMicro.forbidMicro-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">forbid<wbr/>Micro</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">microStatus</span>, <span class="tsd-kind-parameter">toUserIds</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#forbidMicro.forbidMicro-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>控制其他用户的麦克风状态</p>
|
|
159
|
+
<p>开启或关闭指定用户的麦克风。只有拥有 control_other_micro 权限的用户才能操作。</p>
|
|
160
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">microStatus</span>: <a href="../enums/MicroStatus.html" class="tsd-signature-type tsd-kind-enum">MicroStatus</a></span><div class="tsd-comment tsd-typography"><p>麦克风状态(MicroStatus.OPEN 或 MicroStatus.CLOSE)</p>
|
|
161
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>目标用户ID,可以是单个字符串或字符串数组</p>
|
|
162
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 是否操作成功,无权限或权限检查失败返回 false</p>
|
|
163
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-12" class="tsd-anchor"></a>Example<a href="#Example-12" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 关闭某个用户的麦克风</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">forbidMicro</span><span class="hl-2">(</span><span class="hl-5">MicroStatus</span><span class="hl-2">.</span><span class="hl-8">CLOSE</span><span class="hl-2">, </span><span class="hl-3">'user-id-1'</span><span class="hl-2">)</span><br/><br/><span class="hl-0">// 开启多个用户的麦克风</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">forbidMicro</span><span class="hl-2">(</span><span class="hl-5">MicroStatus</span><span class="hl-2">.</span><span class="hl-8">OPEN</span><span class="hl-2">, [</span><span class="hl-3">'user-id-1'</span><span class="hl-2">, </span><span class="hl-3">'user-id-2'</span><span class="hl-2">])</span><br/><br/><span class="hl-0">// 检查权限</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">selfInfo</span><span class="hl-2">?.</span><span class="hl-5">permission</span><span class="hl-2">?.</span><span class="hl-5">control_other_micro</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">forbidMicro</span><span class="hl-2">(</span><span class="hl-5">MicroStatus</span><span class="hl-2">.</span><span class="hl-8">CLOSE</span><span class="hl-2">, </span><span class="hl-3">'user-id-1'</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
164
|
+
</code><button type="button">Copy</button></pre>
|
|
165
|
+
|
|
166
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1165</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="forbidSync" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>forbid<wbr/>Sync</span><a href="#forbidSync" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="forbidSync.forbidSync-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">forbid<wbr/>Sync</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">sync</span>, <span class="tsd-kind-parameter">toUserIds</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#forbidSync.forbidSync-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>控制其他用户的帧数据同步权限</p>
|
|
167
|
+
<p>允许或禁止指定用户同步全量帧数据。只有拥有 control_other_sync 权限的用户才能操作。</p>
|
|
168
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">sync</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>是否允许同步,true 表示允许,false 表示禁止</p>
|
|
169
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>目标用户ID,可以是单个字符串或字符串数组</p>
|
|
170
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 是否操作成功,无权限或权限检查失败返回 false</p>
|
|
171
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-13" class="tsd-anchor"></a>Example<a href="#Example-13" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 禁止某个用户同步帧数据</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">forbidSync</span><span class="hl-2">(</span><span class="hl-6">false</span><span class="hl-2">, </span><span class="hl-3">'user-id-1'</span><span class="hl-2">)</span><br/><br/><span class="hl-0">// 允许多个用户同步帧数据</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">forbidSync</span><span class="hl-2">(</span><span class="hl-6">true</span><span class="hl-2">, [</span><span class="hl-3">'user-id-1'</span><span class="hl-2">, </span><span class="hl-3">'user-id-2'</span><span class="hl-2">])</span>
|
|
172
|
+
</code><button type="button">Copy</button></pre>
|
|
173
|
+
|
|
174
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1201</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="getFramesByKey" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Frames<wbr/>By<wbr/>Key</span><a href="#getFramesByKey" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getFramesByKey.getFramesByKey-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Frames<wbr/>By<wbr/>Key</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getFramesByKey.getFramesByKey-1.Key">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getFramesByKey.getFramesByKey-1.Key">Key</a><span class="tsd-signature-symbol">]</span><a href="#getFramesByKey.getFramesByKey-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>根据键值获取对应的帧数据</p>
|
|
175
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="getFramesByKey.getFramesByKey-1.Key" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>帧数据的键类型</p>
|
|
176
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getFramesByKey.getFramesByKey-1.Key">Key</a></span><div class="tsd-comment tsd-typography"><p>帧数据的键值</p>
|
|
177
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getFramesByKey.getFramesByKey-1.Key">Key</a><span class="tsd-signature-symbol">]</span></h4><p>对应键的帧数据,如果不存在则返回 undefined</p>
|
|
178
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-14" class="tsd-anchor"></a>Example<a href="#Example-14" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 获取相机帧数据</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">cameraFrame</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">getFramesByKey</span><span class="hl-2">(</span><span class="hl-3">'camera'</span><span class="hl-2">)</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">cameraFrame</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'相机位置:'</span><span class="hl-2">, </span><span class="hl-5">cameraFrame</span><span class="hl-2">.</span><span class="hl-5">position</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
179
|
+
</code><button type="button">Copy</button></pre>
|
|
180
|
+
|
|
181
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:312</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="getSnapshotForKey" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Snapshot<wbr/>For<wbr/>Key</span><a href="#getSnapshotForKey" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getSnapshotForKey.getSnapshotForKey-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Snapshot<wbr/>For<wbr/>Key</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getSnapshotForKey.getSnapshotForKey-1.Key-1">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><a href="#getSnapshotForKey.getSnapshotForKey-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>获取指定键的帧数据快照</p>
|
|
182
|
+
<p>这是 getFramesByKey 方法的别名,用于保持 API 的一致性。</p>
|
|
183
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="getSnapshotForKey.getSnapshotForKey-1.Key-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>帧数据的键类型</p>
|
|
184
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#getSnapshotForKey.getSnapshotForKey-1.Key-1">Key</a></span><div class="tsd-comment tsd-typography"><p>帧数据的键值</p>
|
|
185
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><p>对应键的帧数据,如果不存在则返回 undefined</p>
|
|
186
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-15" class="tsd-anchor"></a>Example<a href="#Example-15" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">cameraFrame</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">getSnapshotForKey</span><span class="hl-2">(</span><span class="hl-3">'camera'</span><span class="hl-2">)</span>
|
|
187
|
+
</code><button type="button">Copy</button></pre>
|
|
188
|
+
|
|
189
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1271</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="hasListener" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>has<wbr/>Listener</span><a href="#hasListener" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="hasListener.hasListener-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">has<wbr/>Listener</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#hasListener.hasListener-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>判断是否注册了事件</p>
|
|
68
190
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-keyword">keyof </span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>事件类型</p>
|
|
69
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from Subscribe.hasListener</p><ul><li>Defined in utils/subscribe.ts:41</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="kick" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>kick</span><a href="#kick" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="kick.kick-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">kick</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">toUserIds</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#kick.kick-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p
|
|
70
|
-
|
|
191
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#hasListener">hasListener</a></p><ul><li>Defined in utils/subscribe.ts:41</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="kick" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>kick</span><a href="#kick" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="kick.kick-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">kick</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">toUserIds</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#kick.kick-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>将用户踢出带看房间</p>
|
|
192
|
+
<p>强制将指定用户从房间中移除。只有拥有 change_other_status 权限的用户才能操作。</p>
|
|
193
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>目标用户ID,可以是单个字符串或字符串数组</p>
|
|
194
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 是否操作成功,无权限或权限检查失败返回 false</p>
|
|
195
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-16" class="tsd-anchor"></a>Example<a href="#Example-16" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 踢出单个用户</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">kick</span><span class="hl-2">(</span><span class="hl-3">'user-id-1'</span><span class="hl-2">)</span><br/><br/><span class="hl-0">// 踢出多个用户</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">kick</span><span class="hl-2">([</span><span class="hl-3">'user-id-1'</span><span class="hl-2">, </span><span class="hl-3">'user-id-2'</span><span class="hl-2">])</span><br/><br/><span class="hl-0">// 检查权限</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">selfInfo</span><span class="hl-2">?.</span><span class="hl-5">permission</span><span class="hl-2">?.</span><span class="hl-5">change_other_status</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">kick</span><span class="hl-2">(</span><span class="hl-3">'user-id-1'</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
196
|
+
</code><button type="button">Copy</button></pre>
|
|
197
|
+
|
|
198
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1239</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="off" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>off</span><a href="#off" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="off.off-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">off</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">callback</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#off.off-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>解除事件</p>
|
|
71
199
|
<p>如果 name 不传的话解除对应所有事件
|
|
72
200
|
如果 name, callback 不传的话解除所有name的所有事件</p>
|
|
73
201
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="off.off-1.K-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-keyword">keyof </span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>预设的监听事件名称</p>
|
|
74
202
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">name</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a></span><div class="tsd-comment tsd-typography"><p>事件类型</p>
|
|
75
203
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">callback</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>事件回调函数</p>
|
|
76
|
-
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Rest</code><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from Subscribe.off</p><ul><li>Defined in utils/subscribe.ts:87</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="on" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>on</span><a href="#on" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="on.on-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">callback</span>, <span class="tsd-kind-parameter">once</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><a href="#on.on-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>注册事件</p>
|
|
204
|
+
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Rest</code><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#off.off-1.K-1">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#off">off</a></p><ul><li>Defined in utils/subscribe.ts:87</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="on" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>on</span><a href="#on" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="on.on-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">on</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">callback</span>, <span class="tsd-kind-parameter">once</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><a href="#on.on-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>注册事件</p>
|
|
77
205
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="on.on-1.K-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-keyword">keyof </span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>预设的监听事件名称</p>
|
|
78
206
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a></span><div class="tsd-comment tsd-typography"><p>事件类型</p>
|
|
79
207
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">callback</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>事件回调函数</p>
|
|
80
208
|
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Rest</code><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#on.on-1.K-2">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">once</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>是否只执行一次</p>
|
|
81
209
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></h4><p>解除事件</p>
|
|
82
|
-
<ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="on.on-1.__type.__type-1"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from Subscribe.on</p><ul><li>Defined in utils/subscribe.ts:55</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="once" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>once</span><a href="#once" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="once.once-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">callback</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><a href="#once.once-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>注册事件(是否只执行一次)</p>
|
|
210
|
+
<ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="on.on-1.__type.__type-1"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#on">on</a></p><ul><li>Defined in utils/subscribe.ts:55</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited"><a id="once" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>once</span><a href="#once" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited"><li class="tsd-signature tsd-anchor-link"><a id="once.once-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">once</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">callback</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><a href="#once.once-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>注册事件(是否只执行一次)</p>
|
|
83
211
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="once.once-1.K-3" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">K</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-keyword">keyof </span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>预设的监听事件名称</p>
|
|
84
212
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a></span><div class="tsd-comment tsd-typography"><p>事件类型</p>
|
|
85
213
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">callback</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span></span><div class="tsd-comment tsd-typography"><p>事件回调函数</p>
|
|
86
214
|
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Rest</code><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="../types/EventType.html" class="tsd-signature-type tsd-kind-type-alias">EventType</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="CoreRTC.html#once.once-1.K-3">K</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span></h4><p>解除事件</p>
|
|
87
|
-
<ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="once.once-1.__type-2.__type-3"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from Subscribe.once</p><ul><li>Defined in utils/subscribe.ts:74</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="sendKeyframe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>send<wbr/>Keyframe</span><a href="#sendKeyframe" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="sendKeyframe.sendKeyframe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">send<wbr/>Keyframe</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#sendKeyframe.sendKeyframe-1.Key-2">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">frame</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><a href="#sendKeyframe.sendKeyframe-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>发送帧数据(需要能够被序列化)</p>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</div><
|
|
91
|
-
|
|
92
|
-
</div><div class="tsd-
|
|
93
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">evtType</span>: <a href="../enums/BuiltinEventType.html" class="tsd-signature-type tsd-kind-enum">BuiltinEventType</a></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">atnType</span>: <a href="../enums/BuiltinActionType.html" class="tsd-signature-type tsd-kind-enum">BuiltinActionType</a></span><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">status</span>: <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:660</li></ul></aside></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#keyframes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>keyframes</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Accessors</summary><div><a href="#_RTC" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>$RTC</span></a><a href="#jsBridge" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>js<wbr/>Bridge</span></a><a href="#options" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>options</span></a><a href="#readyState" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>ready<wbr/>State</span></a><a href="#roomInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>room<wbr/>Info</span></a><a href="#selfInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>self<wbr/>Info</span></a><a href="#snapshot" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>snapshot</span></a><a href="#state" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>state</span></a><a href="#url" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>url</span></a><a href="#userList" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>user<wbr/>List</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#_exit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_exit</span></a><a href="#_handleKeyframesChange" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_handle<wbr/>Keyframes<wbr/>Change</span></a><a href="#_initializeKeyframesObservers" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_initialize<wbr/>Keyframes<wbr/>Observers</span></a><a href="#broadcast" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>broadcast</span></a><a href="#close" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>close</span></a><a href="#connect" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>connect</span></a><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#emit" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a><a href="#exit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>exit</span></a><a href="#forbidMicro" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>forbid<wbr/>Micro</span></a><a href="#forbidSync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>forbid<wbr/>Sync</span></a><a href="#getFramesByKey" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Frames<wbr/>By<wbr/>Key</span></a><a href="#getSnapshotForKey" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Snapshot<wbr/>For<wbr/>Key</span></a><a href="#hasListener" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>has<wbr/>Listener</span></a><a href="#kick" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>kick</span></a><a href="#off" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a><a href="#on" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a><a href="#once" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a><a href="#sendKeyframe" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>send<wbr/>Keyframe</span></a><a href="#setSelfInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Self<wbr/>Info</span></a><a href="#toggleMicro" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>toggle<wbr/>Micro</span></a><a href="#updateStatus" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Status</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>如视 Live SDK</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
|
|
215
|
+
<ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="once.once-1.__type-2.__type-3"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="Subscribe.html">Subscribe</a>.<a href="Subscribe.html#once">once</a></p><ul><li>Defined in utils/subscribe.ts:74</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="sendKeyframe" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>send<wbr/>Keyframe</span><a href="#sendKeyframe" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="sendKeyframe.sendKeyframe-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">send<wbr/>Keyframe</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#sendKeyframe.sendKeyframe-1.Key-2">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">frame</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span><a href="#sendKeyframe.sendKeyframe-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>发送帧数据(需要能够被序列化)</p>
|
|
216
|
+
<p>将帧数据同步到其他用户。帧数据必须是可序列化的 JSON 对象。
|
|
217
|
+
只有在连接状态为 OPEN 时才能发送。</p>
|
|
218
|
+
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="sendKeyframe.sendKeyframe-1.Key-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span><div class="tsd-comment tsd-typography"><p>帧数据的键类型</p>
|
|
219
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#sendKeyframe.sendKeyframe-1.Key-2">Key</a></span><div class="tsd-comment tsd-typography"><p>帧数据键值</p>
|
|
220
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">frame</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#constructor.new_Live.KeyframesSnapshot-1">KeyframesSnapshot</a><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Live.html#sendKeyframe.sendKeyframe-1.Key-2">Key</a><span class="tsd-signature-symbol">]</span></span><div class="tsd-comment tsd-typography"><p>帧数据本体,必须可序列化</p>
|
|
221
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span></h4><p>发送结果,成功返回 true,连接未打开返回 false,其他错误返回 Error</p>
|
|
222
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-17" class="tsd-anchor"></a>Example<a href="#Example-17" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 发送相机位置更新</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">result</span><span class="hl-2"> = </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">sendKeyframe</span><span class="hl-2">(</span><span class="hl-3">'camera'</span><span class="hl-2">, {</span><br/><span class="hl-2"> </span><span class="hl-5">position:</span><span class="hl-2"> [</span><span class="hl-9">1</span><span class="hl-2">, </span><span class="hl-9">2</span><span class="hl-2">, </span><span class="hl-9">3</span><span class="hl-2">],</span><br/><span class="hl-2"> </span><span class="hl-5">rotation:</span><span class="hl-2"> [</span><span class="hl-9">0</span><span class="hl-2">, </span><span class="hl-9">0</span><span class="hl-2">, </span><span class="hl-9">0</span><span class="hl-2">]</span><br/><span class="hl-2">})</span><br/><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">result</span><span class="hl-2"> === </span><span class="hl-6">true</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'发送成功'</span><span class="hl-2">)</span><br/><span class="hl-2">} </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">'发送失败:'</span><span class="hl-2">, </span><span class="hl-5">result</span><span class="hl-2">)</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-0">// 发送标注更新</span><br/><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">sendKeyframe</span><span class="hl-2">(</span><span class="hl-3">'annotation'</span><span class="hl-2">, {</span><br/><span class="hl-2"> </span><span class="hl-5">text:</span><span class="hl-2"> </span><span class="hl-3">'这是一个标注'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">position:</span><span class="hl-2"> [</span><span class="hl-9">100</span><span class="hl-2">, </span><span class="hl-9">200</span><span class="hl-2">]</span><br/><span class="hl-2">})</span>
|
|
223
|
+
</code><button type="button">Copy</button></pre>
|
|
224
|
+
|
|
225
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:346</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="setSelfInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Self<wbr/>Info</span><a href="#setSelfInfo" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setSelfInfo.setSelfInfo-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Self<wbr/>Info</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">userInfo</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#setSelfInfo.setSelfInfo-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>设置自己的用户信息</p>
|
|
226
|
+
<p>更新当前用户在房间中的信息,如昵称、头像等。</p>
|
|
227
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">userInfo</span>: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../types/UserInfo.html" class="tsd-signature-type tsd-kind-type-alias">UserInfo</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>用户信息的部分更新对象</p>
|
|
228
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 是否更新成功</p>
|
|
229
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-18" class="tsd-anchor"></a>Example<a href="#Example-18" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 更新昵称和头像</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">setSelfInfo</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-5">extension:</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">nickname:</span><span class="hl-2"> </span><span class="hl-3">'新昵称'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">avatar:</span><span class="hl-2"> </span><span class="hl-3">'https://example.com/avatar.jpg'</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">})</span>
|
|
230
|
+
</code><button type="button">Copy</button></pre>
|
|
231
|
+
|
|
232
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1022</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="toggleMicro" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>toggle<wbr/>Micro</span><a href="#toggleMicro" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="toggleMicro.toggleMicro-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">toggle<wbr/>Micro</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">microStatus</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#toggleMicro.toggleMicro-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>切换自己的麦克风状态</p>
|
|
233
|
+
<p>开启或关闭自己的麦克风。只有拥有 control_own_micro 权限的用户才能操作。</p>
|
|
234
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">microStatus</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>麦克风状态,true 表示开启,false 表示关闭</p>
|
|
235
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise<boolean> 是否操作成功,无权限返回 false</p>
|
|
236
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-19" class="tsd-anchor"></a>Example<a href="#Example-19" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 开启麦克风</span><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-8">result</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">toggleMicro</span><span class="hl-2">(</span><span class="hl-6">true</span><span class="hl-2">)</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">result</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'麦克风已开启'</span><span class="hl-2">)</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-0">// 关闭麦克风</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">toggleMicro</span><span class="hl-2">(</span><span class="hl-6">false</span><span class="hl-2">)</span><br/><br/><span class="hl-0">// 检查权限</span><br/><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-5">selfInfo</span><span class="hl-2">?.</span><span class="hl-5">permission</span><span class="hl-2">?.</span><span class="hl-5">control_own_micro</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">toggleMicro</span><span class="hl-2">(</span><span class="hl-6">true</span><span class="hl-2">)</span><br/><span class="hl-2">} </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">'没有权限控制麦克风'</span><span class="hl-2">)</span><br/><span class="hl-2">}</span>
|
|
237
|
+
</code><button type="button">Copy</button></pre>
|
|
238
|
+
|
|
239
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:1125</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="updateStatus" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>Status</span><a href="#updateStatus" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="updateStatus.updateStatus-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update<wbr/>Status</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">evtType</span>, <span class="tsd-kind-parameter">atnType</span>, <span class="tsd-kind-parameter">status</span>, <span class="tsd-kind-parameter">toUserIds</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#updateStatus.updateStatus-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>更新带看状态</p>
|
|
240
|
+
<p>发送内置消息来更新用户或房间的状态。只有在连接状态为 OPEN 时才能发送。</p>
|
|
241
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">evtType</span>: <a href="../enums/BuiltinEventType.html" class="tsd-signature-type tsd-kind-enum">BuiltinEventType</a></span><div class="tsd-comment tsd-typography"><p>事件类型(用户变化或房间变化)</p>
|
|
242
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">atnType</span>: <a href="../enums/BuiltinActionType.html" class="tsd-signature-type tsd-kind-enum">BuiltinActionType</a></span><div class="tsd-comment tsd-typography"><p>操作类型(如用户信息、麦克风状态、房间关闭等)</p>
|
|
243
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">status</span>: <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>状态数据对象</p>
|
|
244
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">toUserIds</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>目标用户ID(可选,不传则广播给所有人)</p>
|
|
245
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>是否发送成功,连接未打开或发送失败返回 false</p>
|
|
246
|
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-Example"><h4 class="tsd-anchor-link"><a id="Example-20" class="tsd-anchor"></a>Example<a href="#Example-20" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-0">// 更新用户信息</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">updateStatus</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinEventType</span><span class="hl-2">.</span><span class="hl-5">UserChange</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinActionType</span><span class="hl-2">.</span><span class="hl-5">UserInfo</span><span class="hl-2">,</span><br/><span class="hl-2"> { </span><span class="hl-5">nickname:</span><span class="hl-2"> </span><span class="hl-3">'新昵称'</span><span class="hl-2">, </span><span class="hl-5">avatar:</span><span class="hl-2"> </span><span class="hl-3">'https://example.com/avatar.jpg'</span><span class="hl-2"> }</span><br/><span class="hl-2">)</span><br/><br/><span class="hl-0">// 关闭房间(仅管理员可用)</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">updateStatus</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinEventType</span><span class="hl-2">.</span><span class="hl-5">RoomChange</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinActionType</span><span class="hl-2">.</span><span class="hl-5">RoomClose</span><span class="hl-2">,</span><br/><span class="hl-2"> {}</span><br/><span class="hl-2">)</span><br/><br/><span class="hl-0">// 向特定用户发送状态更新</span><br/><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-5">live</span><span class="hl-2">.</span><span class="hl-1">updateStatus</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinEventType</span><span class="hl-2">.</span><span class="hl-5">UserChange</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-5">BuiltinActionType</span><span class="hl-2">.</span><span class="hl-5">UserMicroStatus</span><span class="hl-2">,</span><br/><span class="hl-2"> { </span><span class="hl-5">status:</span><span class="hl-2"> </span><span class="hl-5">MicroStatus</span><span class="hl-2">.</span><span class="hl-8">CLOSE</span><span class="hl-2"> },</span><br/><span class="hl-2"> [</span><span class="hl-3">'user-id-1'</span><span class="hl-2">, </span><span class="hl-3">'user-id-2'</span><span class="hl-2">]</span><br/><span class="hl-2">)</span>
|
|
247
|
+
</code><button type="button">Copy</button></pre>
|
|
248
|
+
|
|
249
|
+
</div></div><aside class="tsd-sources"><ul><li>Defined in live/live.ts:986</li></ul></aside></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#keyframes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>keyframes</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Accessors</summary><div><a href="#_RTC" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>$RTC</span></a><a href="#jsBridge" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>js<wbr/>Bridge</span></a><a href="#options" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>options</span></a><a href="#readyState" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>ready<wbr/>State</span></a><a href="#roomInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>room<wbr/>Info</span></a><a href="#selfInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>self<wbr/>Info</span></a><a href="#snapshot" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>snapshot</span></a><a href="#state" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>state</span></a><a href="#url" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>url</span></a><a href="#userList" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>user<wbr/>List</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#_exit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_exit</span></a><a href="#_handleKeyframesChange" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_handle<wbr/>Keyframes<wbr/>Change</span></a><a href="#_initializeKeyframesObservers" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_initialize<wbr/>Keyframes<wbr/>Observers</span></a><a href="#broadcast" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>broadcast</span></a><a href="#close" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>close</span></a><a href="#connect" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>connect</span></a><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#emit" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit</span></a><a href="#exit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>exit</span></a><a href="#forbidMicro" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>forbid<wbr/>Micro</span></a><a href="#forbidSync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>forbid<wbr/>Sync</span></a><a href="#getFramesByKey" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Frames<wbr/>By<wbr/>Key</span></a><a href="#getSnapshotForKey" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Snapshot<wbr/>For<wbr/>Key</span></a><a href="#hasListener" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>has<wbr/>Listener</span></a><a href="#kick" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>kick</span></a><a href="#off" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>off</span></a><a href="#on" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>on</span></a><a href="#once" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>once</span></a><a href="#sendKeyframe" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>send<wbr/>Keyframe</span></a><a href="#setSelfInfo" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Self<wbr/>Info</span></a><a href="#toggleMicro" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>toggle<wbr/>Micro</span></a><a href="#updateStatus" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Status</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>如视 Live SDK</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
|