@realsee/live 0.3.0-alpha.3 → 0.3.0-alpha.4
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/docs/enums/live.MicroStatus.html +1 -1
- package/docs/modules/live.html +3 -3
- package/lib/typings/LiveMsg.js +2 -2
- package/lib/typings/LiveMsg.js.map +1 -1
- package/package.json +1 -1
- package/umd/{createLive.96395a4c.js → createLive.1ecf7dd4.js} +1 -1
- package/umd/{createLiveReact.e1836101.js → createLiveReact.9075a8fd.js} +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>MicroStatus | 如视 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 async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></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"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">如视 Live SDK</a></li><li><a href="../modules/live.html">live</a></li><li><a href="live.MicroStatus.html">MicroStatus</a></li></ul><h1>Enumeration MicroStatus</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
|
2
2
|
<p>麦克风状态。</p>
|
|
3
|
-
</div></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumeration members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#CLOSE" class="tsd-kind-icon">CLOSE</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#OPEN" class="tsd-kind-icon">OPEN</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="CLOSE" class="tsd-anchor"></a><h3 class="tsd-anchor-link">CLOSE<a href="#CLOSE" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">CLOSE<span class="tsd-signature-symbol"> = "CLOSE"</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:
|
|
3
|
+
</div></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumeration members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#CLOSE" class="tsd-kind-icon">CLOSE</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#OPEN" class="tsd-kind-icon">OPEN</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="CLOSE" class="tsd-anchor"></a><h3 class="tsd-anchor-link">CLOSE<a href="#CLOSE" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">CLOSE<span class="tsd-signature-symbol"> = "CLOSE"</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:111</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="OPEN" class="tsd-anchor"></a><h3 class="tsd-anchor-link">OPEN<a href="#OPEN" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">OPEN<span class="tsd-signature-symbol"> = "OPEN"</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:110</li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Modules</a></li><li class=" tsd-kind-module"><a href="../modules/RTCProtocol.html">RTCProtocol</a></li><li class="current tsd-kind-module"><a href="../modules/live.html">live</a></li><li class=" tsd-kind-module"><a href="../modules/shared_utils.html">shared-<wbr/>utils</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-enum tsd-parent-kind-module"><a href="live.MicroStatus.html" class="tsd-kind-icon">Micro<wbr/>Status</a><ul><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#CLOSE" class="tsd-kind-icon">CLOSE</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="live.MicroStatus.html#OPEN" class="tsd-kind-icon">OPEN</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li><li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li><li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li><li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li><li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li><li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
package/docs/modules/live.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default"><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 async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></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"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">如视 Live SDK</a></li><li><a href="live.html">live</a></li></ul><h1>Module live</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumerations</h3><ul class="tsd-index-list"><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.BuiltinActionType.html" class="tsd-kind-icon">Builtin<wbr/>Action<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.BuiltinEventType.html" class="tsd-kind-icon">Builtin<wbr/>Event<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.Command.html" class="tsd-kind-icon">Command</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.MemUserStatus.html" class="tsd-kind-icon">Mem<wbr/>User<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.MicroStatus.html" class="tsd-kind-icon">Micro<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.UserStatus.html" class="tsd-kind-icon">User<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketCloseError.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Close<wbr/>Error</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketErrorType.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Error<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketState.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>State</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface tsd-parent-kind-module tsd-has-type-parameter"><a href="../interfaces/live.Live.html" class="tsd-kind-icon">Live</a></li><li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/live.LiveOptions.html" class="tsd-kind-icon">Live<wbr/>Options</a></li><li class="tsd-kind-interface tsd-parent-kind-module tsd-has-type-parameter"><a href="../interfaces/live.LiveReact.html" class="tsd-kind-icon">Live<wbr/>React</a></li></ul></section><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#BuiltinMsg" class="tsd-kind-icon">Builtin<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#EventType" class="tsd-kind-icon">Event<wbr/>Type</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#KeyframeTypes" class="tsd-kind-icon">Keyframe<wbr/>Types</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveActionReactCallback" class="tsd-kind-icon">Live<wbr/>Action<wbr/>React<wbr/>Callback</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveEventType" class="tsd-kind-icon">Live<wbr/>Event<wbr/>Type</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#LiveMsg" class="tsd-kind-icon">Live<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveProviderPropTypes" class="tsd-kind-icon">Live<wbr/>Provider<wbr/>Prop<wbr/>Types</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#ReqLiveMsg" class="tsd-kind-icon">Req<wbr/>Live<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#RoomInfo" class="tsd-kind-icon">Room<wbr/>Info</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#UserInfo" class="tsd-kind-icon">User<wbr/>Info</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#UserInfoExt" class="tsd-kind-icon">User<wbr/>Info<wbr/>Ext</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#WebSocketError" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Error</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#WebSocketEventType" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Event<wbr/>Type</a></li></ul></section><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#createLive" class="tsd-kind-icon">create<wbr/>Live</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#createLiveReact" class="tsd-kind-icon">create<wbr/>Live<wbr/>React</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="live.html#parseLiveMsg" class="tsd-kind-icon">parse<wbr/>Live<wbr/>Msg</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="BuiltinMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Builtin<wbr/>Msg<a href="#BuiltinMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Builtin<wbr/>Msg<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>action<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinActionType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinActionType</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>extension<span class="tsd-signature-symbol">?: </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 class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">; </span>event_type<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinEventType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinEventType</a><span class="tsd-signature-symbol">; </span>to_user_ids<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:
|
|
1
|
+
<!DOCTYPE html><html class="default"><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 async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></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"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">如视 Live SDK</a></li><li><a href="live.html">live</a></li></ul><h1>Module live</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Enumerations</h3><ul class="tsd-index-list"><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.BuiltinActionType.html" class="tsd-kind-icon">Builtin<wbr/>Action<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.BuiltinEventType.html" class="tsd-kind-icon">Builtin<wbr/>Event<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.Command.html" class="tsd-kind-icon">Command</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.MemUserStatus.html" class="tsd-kind-icon">Mem<wbr/>User<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.MicroStatus.html" class="tsd-kind-icon">Micro<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.UserStatus.html" class="tsd-kind-icon">User<wbr/>Status</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketCloseError.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Close<wbr/>Error</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketErrorType.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Error<wbr/>Type</a></li><li class="tsd-kind-enum tsd-parent-kind-module"><a href="../enums/live.WebSocketState.html" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>State</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface tsd-parent-kind-module tsd-has-type-parameter"><a href="../interfaces/live.Live.html" class="tsd-kind-icon">Live</a></li><li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/live.LiveOptions.html" class="tsd-kind-icon">Live<wbr/>Options</a></li><li class="tsd-kind-interface tsd-parent-kind-module tsd-has-type-parameter"><a href="../interfaces/live.LiveReact.html" class="tsd-kind-icon">Live<wbr/>React</a></li></ul></section><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#BuiltinMsg" class="tsd-kind-icon">Builtin<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#EventType" class="tsd-kind-icon">Event<wbr/>Type</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#KeyframeTypes" class="tsd-kind-icon">Keyframe<wbr/>Types</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveActionReactCallback" class="tsd-kind-icon">Live<wbr/>Action<wbr/>React<wbr/>Callback</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveEventType" class="tsd-kind-icon">Live<wbr/>Event<wbr/>Type</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#LiveMsg" class="tsd-kind-icon">Live<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#LiveProviderPropTypes" class="tsd-kind-icon">Live<wbr/>Provider<wbr/>Prop<wbr/>Types</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#ReqLiveMsg" class="tsd-kind-icon">Req<wbr/>Live<wbr/>Msg</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#RoomInfo" class="tsd-kind-icon">Room<wbr/>Info</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#UserInfo" class="tsd-kind-icon">User<wbr/>Info</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#UserInfoExt" class="tsd-kind-icon">User<wbr/>Info<wbr/>Ext</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#WebSocketError" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Error</a></li><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="live.html#WebSocketEventType" class="tsd-kind-icon">Web<wbr/>Socket<wbr/>Event<wbr/>Type</a></li></ul></section><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#createLive" class="tsd-kind-icon">create<wbr/>Live</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="live.html#createLiveReact" class="tsd-kind-icon">create<wbr/>Live<wbr/>React</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="live.html#parseLiveMsg" class="tsd-kind-icon">parse<wbr/>Live<wbr/>Msg</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="BuiltinMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Builtin<wbr/>Msg<a href="#BuiltinMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Builtin<wbr/>Msg<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>action<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinActionType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinActionType</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>extension<span class="tsd-signature-symbol">?: </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 class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">; </span>event_type<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinEventType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinEventType</a><span class="tsd-signature-symbol">; </span>to_user_ids<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:96</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
2
2
|
<p>内置事件数据结构体。</p>
|
|
3
3
|
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>action<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinActionType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinActionType</a></h5></li><li class="tsd-parameter"><h5>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>extension<span class="tsd-signature-symbol">?: </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 class="tsd-signature-symbol"> }</span></h5><ul class="tsd-parameters"><li class="tsd-parameter-index-signature"><h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> extension<span class="tsd-signature-symbol">?: </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></h5></li></ul></li><li class="tsd-parameter"><h5>event_<wbr/>type<span class="tsd-signature-symbol">: </span><a href="../enums/live.BuiltinEventType.html" class="tsd-signature-type" data-tsd-kind="Enumeration">BuiltinEventType</a></h5></li><li class="tsd-parameter"><h5>to_<wbr/>user_<wbr/>ids<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a id="EventType" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Event<wbr/>Type<a href="#EventType" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Event<wbr/>Type<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">:</span> <a href="live.html#LiveEventType" class="tsd-signature-type" data-tsd-kind="Type alias">LiveEventType</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="live.html#WebSocketEventType" class="tsd-signature-type" data-tsd-kind="Type alias">WebSocketEventType</a></div><aside class="tsd-sources"><ul><li>Defined in typings/EventType.ts:97</li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a id="KeyframeTypes" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Keyframe<wbr/>Types<a href="#KeyframeTypes" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Keyframe<wbr/>Types<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Type</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">Property</span><span class="tsd-signature-symbol"> in </span><span class="tsd-signature-symbol">keyof </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Type</span><span class="tsd-signature-symbol"> as </span><span class="tsd-signature-type">Property</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>nextKeyframes<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Type</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">Property</span><span class="tsd-signature-symbol">]</span>, prevKeyframes<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Type</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">Property</span><span class="tsd-signature-symbol">]</span>, frontRequestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</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></div><aside class="tsd-sources"><ul><li>Defined in typings/EventType.ts:93</li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Type</h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a id="LiveActionReactCallback" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Live<wbr/>Action<wbr/>React<wbr/>Callback<a href="#LiveActionReactCallback" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Live<wbr/>Action<wbr/>React<wbr/>Callback<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Pick</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/live.Live.html" class="tsd-signature-type" data-tsd-kind="Interface">Live</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"broadcast"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"exit"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"kick"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"toggleMicro"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"forbidMicro"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"sendKeyframe"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"getFramesByKey"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"setSelfInfo"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"updateStatus"</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in typings/Live.ts:140</li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot<span class="tsd-signature-symbol">: </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></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a id="LiveEventType" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Live<wbr/>Event<wbr/>Type<a href="#LiveEventType" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Live<wbr/>Event<wbr/>Type<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>broadcast<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>builtinEvent<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>keyframes<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>kickOut<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>readyKeyframeSync<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>roomChange<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>selfInfoUpdate<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>userChange<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span>userListUpdate<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/EventType.ts:35</li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>broadcast<span class="tsd-signature-symbol">:</span>function</h5><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-type-literal"><li class="tsd-signature tsd-kind-icon">broadcast<span class="tsd-signature-symbol">(</span>evtMsg<span class="tsd-signature-symbol">: </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>, frontRequestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in typings/EventType.ts:58</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
4
4
|
<p>收到其他用户的广播消息。</p>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li><li class="tsd-parameter"><h5>user<wbr/>List<wbr/>Update<span class="tsd-signature-symbol">:</span>function</h5><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-type-literal"><li class="tsd-signature tsd-kind-icon">user<wbr/>List<wbr/>Update<span class="tsd-signature-symbol">(</span>userList<span class="tsd-signature-symbol">: </span><a href="live.html#UserInfo" class="tsd-signature-type" data-tsd-kind="Type alias">UserInfo</a><span class="tsd-signature-symbol">[]</span>, frontRequestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in typings/EventType.ts:79</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
31
31
|
<p>用户列表更新。</p>
|
|
32
32
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>userList: <a href="live.html#UserInfo" class="tsd-signature-type" data-tsd-kind="Type alias">UserInfo</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
33
|
-
</div></div></li><li><h5>frontRequestId: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="LiveMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Live<wbr/>Msg<a href="#LiveMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Live<wbr/>Msg<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>appId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>code<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>command<span class="tsd-signature-symbol">: </span><a href="../enums/live.Command.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Command</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </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 class="tsd-signature-symbol"> | </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 class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>frontRequestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>requestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>roomCode<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>triggerUserId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:
|
|
33
|
+
</div></div></li><li><h5>frontRequestId: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="LiveMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Live<wbr/>Msg<a href="#LiveMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Live<wbr/>Msg<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>appId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>code<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>command<span class="tsd-signature-symbol">: </span><a href="../enums/live.Command.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Command</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </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 class="tsd-signature-symbol"> | </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 class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span>frontRequestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>requestId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>roomCode<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>triggerUserId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:116</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
34
34
|
<p>响应的信息结构体。</p>
|
|
35
35
|
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>app<wbr/>Id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>code<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>command<span class="tsd-signature-symbol">: </span><a href="../enums/live.Command.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Command</a></h5></li><li class="tsd-parameter"><h5>data<span class="tsd-signature-symbol">: </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 class="tsd-signature-symbol"> | </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 class="tsd-signature-symbol">[]</span></h5></li><li class="tsd-parameter"><h5>front<wbr/>Request<wbr/>Id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>request<wbr/>Id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>room<wbr/>Code<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>trigger<wbr/>User<wbr/>Id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module tsd-has-type-parameter"><a id="LiveProviderPropTypes" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Live<wbr/>Provider<wbr/>Prop<wbr/>Types<a href="#LiveProviderPropTypes" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Live<wbr/>Provider<wbr/>Prop<wbr/>Types<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>children<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">React.ReactNode</span><span class="tsd-signature-symbol">; </span>live<span class="tsd-signature-symbol">?: </span><a href="../interfaces/live.Live.html" class="tsd-signature-type" data-tsd-kind="Interface">Live</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in createLiveReact.tsx:13</li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> children<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">React.ReactNode</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> live<span class="tsd-signature-symbol">?: </span><a href="../interfaces/live.Live.html" class="tsd-signature-type" data-tsd-kind="Interface">Live</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="ReqLiveMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Req<wbr/>Live<wbr/>Msg<a href="#ReqLiveMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Req<wbr/>Live<wbr/>Msg<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>command<span class="tsd-signature-symbol">: </span><a href="../enums/live.Command.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Command</a><span class="tsd-signature-symbol">; </span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>to_user_ids<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">; </span>front_request_id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:28</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
36
36
|
<p>向服务端请求数据时的数据格式。</p>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<p>创建 <code>live</code> 实例。</p>
|
|
96
96
|
</div></div><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a href="../interfaces/live.LiveOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/live.Live.html" class="tsd-signature-type" data-tsd-kind="Interface">Live</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a id="createLiveReact" class="tsd-anchor"></a><h3 class="tsd-anchor-link">create<wbr/>Live<wbr/>React<a href="#createLiveReact" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">create<wbr/>Live<wbr/>React<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/live.LiveOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/live.LiveReact.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveReact</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in createLiveReact.tsx:21</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
97
97
|
<p>创建 <a href="../interfaces/live.LiveReact.html">LiveReact</a> 实例,并提供 <code>React</code> 技术栈相关工具链。</p>
|
|
98
|
-
</div></div><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a href="../interfaces/live.LiveOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/live.LiveReact.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveReact</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="parseLiveMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">parse<wbr/>Live<wbr/>Msg<a href="#parseLiveMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">parse<wbr/>Live<wbr/>Msg<span class="tsd-signature-symbol">(</span>jsonTxt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="live.html#LiveMsg" class="tsd-signature-type" data-tsd-kind="Type alias">LiveMsg</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:
|
|
98
|
+
</div></div><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>Snapshot</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a href="../interfaces/live.LiveOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/live.LiveReact.html" class="tsd-signature-type" data-tsd-kind="Interface">LiveReact</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">Snapshot</span><span class="tsd-signature-symbol">></span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="parseLiveMsg" class="tsd-anchor"></a><h3 class="tsd-anchor-link">parse<wbr/>Live<wbr/>Msg<a href="#parseLiveMsg" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">parse<wbr/>Live<wbr/>Msg<span class="tsd-signature-symbol">(</span>jsonTxt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="live.html#LiveMsg" class="tsd-signature-type" data-tsd-kind="Type alias">LiveMsg</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in typings/LiveMsg.ts:133</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
99
99
|
<p>解析下后端数据格式。</p>
|
|
100
100
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>jsonTxt: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
101
101
|
<p>JSON序列化后的文本。</p>
|
package/lib/typings/LiveMsg.js
CHANGED
|
@@ -94,11 +94,11 @@ function parseLiveMsg(jsonTxt) {
|
|
|
94
94
|
requestId: msg.request_id,
|
|
95
95
|
frontRequestId: msg.front_request_id,
|
|
96
96
|
triggerUserID: msg.trigger_user_id,
|
|
97
|
-
data:
|
|
97
|
+
data: msg.data || {},
|
|
98
98
|
};
|
|
99
99
|
var undefinedKeys = Object.keys(resMsg_1).filter(function (key) { return resMsg_1[key] === undefined; });
|
|
100
100
|
if (undefinedKeys.length > 0) {
|
|
101
|
-
console.warn("\u63A8\u9001\u6570\u636E\u683C\u5F0F\u5F02\u5E38\uFF1A".concat(undefinedKeys.join(
|
|
101
|
+
console.warn("\u63A8\u9001\u6570\u636E\u683C\u5F0F\u5F02\u5E38\uFF1A".concat(undefinedKeys.join(" "), " \u503C\u4E0D\u5B58\u5728\uFF01"));
|
|
102
102
|
}
|
|
103
103
|
return resMsg_1;
|
|
104
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveMsg.js","sourceRoot":"","sources":["../../resources/typings/LiveMsg.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB,eAAe;IACf,0CAA+B,CAAA;IAC/B,aAAa;IACb,iCAAsB,CAAA;IACtB,cAAc;IACd,+BAAoB,CAAA;IACpB,aAAa;IACb,iCAAsB,CAAA;IACtB,gBAAgB;IAChB,qCAA0B,CAAA;IAC1B,qBAAqB;IACrB,uCAA4B,CAAA;IAC5B,iBAAiB;IACjB,yCAA8B,CAAA;IAC9B,cAAc;IACd,wCAA6B,CAAA;AAC/B,CAAC,EAjBW,OAAO,GAAP,eAAO,KAAP,eAAO,QAiBlB;AA0BD;;GAEG;AACH,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,8CAA0B,CAAA;IAC1B;;OAEG;IACH,8CAA0B,CAAA;AAC5B,CAAC,EATW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAS3B;AAED;;GAEG;AACH,IAAY,iBAyBX;AAzBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,4DAAuC,CAAA;IACvC;;OAEG;IACH,8DAAyC,CAAA;IACzC;;OAEG;IACH,yDAAoC,CAAA;IACpC;;OAEG;IACH,iDAA4B,CAAA;IAC5B;;OAEG;IACH,6CAAwB,CAAA;IACxB;;OAEG;IACH,wCAAmB,CAAA;AACrB,CAAC,EAzBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAyB5B;
|
|
1
|
+
{"version":3,"file":"LiveMsg.js","sourceRoot":"","sources":["../../resources/typings/LiveMsg.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB,eAAe;IACf,0CAA+B,CAAA;IAC/B,aAAa;IACb,iCAAsB,CAAA;IACtB,cAAc;IACd,+BAAoB,CAAA;IACpB,aAAa;IACb,iCAAsB,CAAA;IACtB,gBAAgB;IAChB,qCAA0B,CAAA;IAC1B,qBAAqB;IACrB,uCAA4B,CAAA;IAC5B,iBAAiB;IACjB,yCAA8B,CAAA;IAC9B,cAAc;IACd,wCAA6B,CAAA;AAC/B,CAAC,EAjBW,OAAO,GAAP,eAAO,KAAP,eAAO,QAiBlB;AA0BD;;GAEG;AACH,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,8CAA0B,CAAA;IAC1B;;OAEG;IACH,8CAA0B,CAAA;AAC5B,CAAC,EATW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAS3B;AAED;;GAEG;AACH,IAAY,iBAyBX;AAzBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,4DAAuC,CAAA;IACvC;;OAEG;IACH,8DAAyC,CAAA;IACzC;;OAEG;IACH,yDAAoC,CAAA;IACpC;;OAEG;IACH,iDAA4B,CAAA;IAC5B;;OAEG;IACH,6CAAwB,CAAA;IACxB;;OAEG;IACH,wCAAmB,CAAA;AACrB,CAAC,EAzBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAyB5B;AAeD;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;AACjB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAgBD;;;;GAIG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,IAAI;QACF,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChC,IAAM,QAAM,GAAwB;YAClC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,QAAQ,EAAE,GAAG,CAAC,SAAS;YACvB,KAAK,EAAE,GAAG,CAAC,MAAM;YACjB,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,cAAc,EAAE,GAAG,CAAC,gBAAgB;YACpC,aAAa,EAAE,GAAG,CAAC,eAAe;YAClC,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE;SACrB,CAAC;QAEF,IAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,QAAM,CAAC,CAAC,MAAM,CAC9C,UAAC,GAAG,IAAK,OAAA,QAAM,CAAC,GAAG,CAAC,KAAK,SAAS,EAAzB,CAAyB,CACnC,CAAC;QACF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,gEAAY,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,oCAAQ,CAAC,CAAC;SAC3D;QACD,OAAO,QAAiB,CAAC;KAC1B;IAAC,OAAO,KAAK,EAAE;QACd,yBAAyB;QACzB,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AA1BD,oCA0BC"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LiveSDK=t():e.LiveSDK=t()}(self,(function(){return(()=>{"use strict";var e={900:(e,t,r)=>{r.d(t,{RTCExample:()=>o});var n=r(508);let s;!function(e){e.realsee="realsee",e.custom="custom"}(s||(s={}));class o extends n.x{join(e){throw new Error("Method not implemented.")}joined=!1;micro=!1;voiceId="";type=s.realsee;async quit(){return!0}async detectMicro(){return!0}async toggleMicro(e){return!0}shock(){}}},508:(e,t,r)=>{r.d(t,{x:()=>o});const n=Symbol("$$LIVE_EVENT$$");function s(e){return e[n]||(e[n]={}),e[n]}class o{hasListener(e){const t=s(this);return t&&t[e]&&t[e].length>0}on(e,t,r){const n=s(this);return n[e]||(n[e]=[]),n[e].push([t,r||!1]),()=>this.off(e,t)}once(e,t){return this.on(e,t,!0)}off(e,t){if(void 0===e)return void(this[n]||delete this[n]);const r=s(this);if(r[e]||(r[e]=[]),void 0===t)return void(r[e].length=0);let o=0;for(;o<r[e].length&&r[e][o][0]!==t;o++);o<r[e].length&&r[e].splice(o,1)}emit(e,...t){let r=!1;const n=s(this)[e]||[];for(let s of n.slice()){const[n,o=!1]=s,i=n(...t);o&&this.off(e,n),!1===i&&(r=!0)}return r}}let i;i||(i={})}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function o(e,r){return!!s(e,r)||(t(e)&&t(r)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!o(e[s],t[s]))return!1}return!0}(e,r):!(!Array.isArray(e)||!Array.isArray(r))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!o(e[r],t[r]))return!1;return!0}(e,r))}function i(e,r,n={deep:!1}){return n.deep?o(e,r):function(e,r){return!!s(e,r)||(t(e)&&t(r)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,o=r.length;n<o;n++){const o=r[n];if(!s(e[o],t[o]))return!1}return!0}(e,r):!(!Array.isArray(e)||!Array.isArray(r))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!s(e[r],t[r]))return!1;return!0}(e,r))}(e,r)}r.r(n),r.d(n,{createLive:()=>E});var a=r(508);let c,u,h,d,f,l,g;!function(e){e[e.NOTINITIALIZED=-1]="NOTINITIALIZED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(c||(c={})),function(e){e.Error="Error",e.Close="Close",e.MicroAuth="MicroAuth",e.DuplicateConnect="DuplicateConnect",e.IllegalURL="IllegalURL",e.Unknown="Unknown",e.IllegalArgs="IllegalArgs"}(u||(u={})),function(e){e.Err_1001="CLOSE_GOING_AWAY",e.Err_1002="CLOSE_PROTOCOL_ERROR",e.Err_1003="CLOSE_UNSUPPORTED",e.Err_1006="CLOSE_ABNORMAL",e.Err_1007="Unsupported Data",e.Err_1008="Policy Violation",e.Err_1009="CLOSE_TOO_LARGE",e.Err_unknown="unknown"}(h||(h={})),function(e){e.SelfUserInfo="SELF_USER_INFO",e.RoomInfo="ROOM_INFO",e.RTCInfo="RTC_INFO",e.UserList="USER_LIST",e.BuiltinMsg="BUILTIN_MSG",e.CustomEvent="CUSTOM_EVENT",e.KeyframeSync="KEYFRAME_SYNC",e.UserKickOut="USER_KICK_OUT"}(d||(d={})),function(e){e.UserChange="user_change",e.RoomChange="room_change"}(f||(f={})),function(e){e.UserMicroStatus="change_micro_status",e.UserMicroStatusSync="sync_micro_status",e.UserPermission="change_permission",e.UserStatus="change_status",e.UserInfo="change_info",e.RoomClose="close"}(l||(l={})),function(e){e.OPEN="OPEN",e.CLOSE="CLOSE"}(g||(g={}));var y=r(900);class m{readyState=c.NOTINITIALIZED;canSync=!0;connecting=!1;keyframes={};constructor(e){this.options=Object.assign({autoConnect:!0,healthCheck:3e3},e)}checkReadyState=e=>{do{if(!this.webSocket){this.readyState!==c.NOTINITIALIZED&&(this.readyState=c.NOTINITIALIZED,e.emit("ws.readyStateUpdate",this.readyState));break}const t=this.webSocket.readyState;t!==this.readyState&&(this.readyState=t,e.emit("ws.readyStateUpdate",this.readyState))}while(0);return this.readyState};dispose=()=>{console.log("dispose"),this.disposeWebSocket(),this.connecting=!1,this.healthCheckId&&(clearInterval(this.healthCheckId),this.healthCheckId=void 0)};disposeWebSocket=()=>{this.webSocket&&(this.onEvtOpnListener&&(this.webSocket.removeEventListener("open",this.onEvtOpnListener),this.onEvtOpnListener=void 0),this.onEvtMsgListener&&(this.webSocket.removeEventListener("message",this.onEvtMsgListener),this.onEvtMsgListener=void 0),this.onEvtErrListener&&(this.webSocket.removeEventListener("error",this.onEvtErrListener),this.onEvtErrListener=void 0),this.onEvtCLEListener&&(this.webSocket.removeEventListener("close",this.onEvtCLEListener),this.onEvtCLEListener=void 0),this.webSocket.close(),this.webSocket=void 0)};handleMessage(e,t){const{command:r,data:n,frontRequestId:s,code:o,message:a}=e;if("SUCCESS"!==o)return t.emit("error",e);switch(r){case d.SelfUserInfo:{const e=n;if(i(this.selfUserInfo,e,{deep:!0}))return;this.selfUserInfo=e,t.emit("selfInfoUpdate",this.selfUserInfo,s);break}case d.RoomInfo:{const e=n;this.roomInfo=Object.assign({},e),t.emit("readyKeyframeSync",e.last_frame||{});break}case d.RTCInfo:{const{voice_id:e,type:r}=n;if(t.$RTC.joined)break;t.$RTC.join({voiceId:e,userId:this.selfUserInfo?.id||"",roomId:this.roomInfo?.info.room_code,type:r}),t.updateStatus(f.UserChange,l.UserMicroStatus,{status:g.OPEN});break}case d.UserList:{const e=n;this.userList=e,t.emit("userListUpdate",this.userList,s);break}case d.CustomEvent:{const e=n;t.emit("broadcast",e,s);break}case d.KeyframeSync:{const e=n,r=Object.keys(e).reduce(((r,n)=>{if(i(e[n],this.keyframes[n],{deep:!0}))return r;const o=[e[n],this.keyframes[n],s],a=n;return t.keyframes.emit(a,...o),this.keyframes[n]=e[n],r[n]=e[n],r}),{});t.emit("keyframes",r,s);break}case d.BuiltinMsg:{const e=n;t.emit("builtinEvent",e),e.event_type===f.UserChange&&t.emit("userChange",e),e.event_type===f.RoomChange&&t.emit("roomChange",e),e.event_type===f.UserChange&&e.action===l.UserMicroStatus&&t.toggleMicro(e.data.status===g.OPEN),e.event_type===f.RoomChange&&e.action===l.RoomClose&&(this.options.rtc?.quit(),this.disposeWebSocket());break}case d.UserKickOut:t.emit("kickOut")}}sendMessage(e){return this.webSocket?e?void this.webSocket.send(JSON.stringify(e)):console.warn("WebSocket messages is empty!"):console.warn("WebSocket has not yet been initialized!")}}function E(t){const r=new m(t),n=(t,r={},n)=>((n=n?Array.isArray(n)?n:[n]:[])&&(r.to_user_ids=n),{command:t,front_request_id:(e()+e()+"-"+e()+"-4"+e().substr(0,3)+"-"+e()+"-"+e()+e()+e()).toLowerCase(),data:r});class s extends a.x{get options(){return Object.freeze(Object.assign({},r.options))}get readyState(){return r.checkReadyState(this),r.readyState}get url(){return r.webSocket?.url||""}get selfInfo(){return r.selfUserInfo}get userList(){return r.userList||[]}get snapshot(){return r.keyframes||{}}get $RTC(){return r.options.rtc}keyframes=new a.x;constructor(){super(),t.rtc||(r.options.rtc=new y.RTCExample),r.options.url&&r.options.getTicket&&this.connect();const e=(e=>{if(!e)return 0;if(!0===e)return 3e3;const t=Number(e);return t>0?t:3e3})(r.options.healthCheck);e&&(r.healthCheckId=setInterval((()=>r.checkReadyState(this)),e))}async setSelfInfo(e){if(this.readyState!==c.OPEN)return new Error("The connection is not open and ready to communicate.");try{return await this.updateStatus(f.UserChange,l.UserInfo,e)}catch(e){return e}}getFramesByKey(e){return r.keyframes[e]}sendKeyframe(e,t){if(this.readyState!==c.OPEN)return new Error("The connection is not open and ready to communicate.");r.keyframes[e]=t;const s=n(d.KeyframeSync,this.snapshot);return r.sendMessage(s),!0}broadcast(e,t,s){return this.readyState!==c.OPEN?new Error("The connection is not open and ready to communicate."):new Promise(((o,i)=>{const a=n(d.CustomEvent,e,t),c=a.front_request_id;r.sendMessage(a);const u=s?setTimeout((()=>{i(new Error("RESPONSE TIMEOUT")),this.off("broadcast",h)}),s):void 0,h=(e,t)=>{t===c&&(this.off("broadcast",h),o(e),u&&clearInterval(u))};this.on("broadcast",h)}))}async updateStatus(e,t,s,o){if(this.readyState!==c.OPEN)return!1;const i=Object.assign({event_type:e,action:t},{data:s}),a=n(d.BuiltinMsg,i,o);return r.sendMessage(a),!0}async toggleMicro(e){return!!this.selfInfo?.permission?.control_own_micro&&(await this.$RTC.toggleMicro(e),await this.updateStatus(f.UserChange,l.UserMicroStatus,{status:e?g.OPEN:g.CLOSE},[]))}async forbidMicro(e,t){return!(r.options.canForbidUserMicro&&!r.options.canForbidUserMicro(t))&&!!this.selfInfo?.permission?.control_other_micro&&await this.updateStatus(f.UserChange,l.UserMicroStatus,{status:e},t)}async forbidSync(e,t){return!(r.options.canForbidUserSync&&!r.options.canForbidUserSync(t))&&!!this.selfInfo?.permission?.control_other_sync&&await this.updateStatus(f.UserChange,l.UserPermission,{sync_frame:e},t)}async kick(e){return!(r.options.canForbidUserKick&&!r.options.canForbidUserKick(e))&&!!this.selfInfo?.permission?.change_other_status&&await this.updateStatus(f.UserChange,l.UserStatus,{status:"KICK_OUT"},e)}async exit(){return await this.$RTC.quit(),await this.updateStatus(f.RoomChange,l.RoomClose,{})}async connect(e={}){if(!await this.$RTC.detectMicro()){const e=new Error("系统监测麦克风未授权~");return this.emit("ws.error",{type:u.MicroAuth,error:e}),e}if(r.connecting){const e=new Error("WebSocket 正在连接中,请勿重复连接 ...");return this.emit("ws.error",{type:u.DuplicateConnect,error:e}),e}const{force:t}=e;if(!t&&(this.readyState===c.CONNECTING||this.readyState===c.OPEN))return!0;if(e.url&&(r.options.url=e.url),e.getTicket&&(r.options.getTicket=e.getTicket),!r.options.url||!r.options.url.startsWith("ws")){const e=new Error(`WebSocket URL 未配置或格式不合法:"${r.options.url}"`);return this.emit("ws.error",{type:u.IllegalURL,error:e}),e}if(!r.options.getTicket){const e=new Error("getTicket() 未配置!");return this.emit("ws.error",{type:u.IllegalArgs,error:e}),e}r.connecting=!0,r.disposeWebSocket(),this.emit("ws.beforeConnect");const n=t||e.url||!this.url?function(e,t={}){const r=-1!==e.indexOf("?");return e+Object.keys(t).reduce(((e,n,s)=>`${e}${0!==s||r?"&":"?"}${n}=${t[n]}`),"")}(r.options.url,{ticket:await r.options.getTicket(),force:Number(!!t)}):this.url;return r.webSocket=new WebSocket(n),r.onEvtOpnListener=()=>{r.checkReadyState(this),this.emit("ws.afterConnect")},r.onEvtMsgListener=e=>{r.checkReadyState(this);try{const t=function(e){try{const t=JSON.parse(e),r={code:t.code,message:t.message,command:t.command,roomCode:t.room_code,appID:t.app_id,requestId:t.request_id,frontRequestId:t.front_request_id,triggerUserID:t.trigger_user_id,data:Object.assign({trigger_user_id:t.trigger_user_id},t.data||{})},n=Object.keys(r).filter((e=>void 0===r[e]));return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),r}catch(e){return!1}}(e.data);if(!1===t)return;r.handleMessage(t,this)}catch(t){this.emit("ws.error",{type:u.Unknown,error:t,target:e})}},r.onEvtErrListener=e=>{o.emit("ws.error",{type:u.Error,target:e}),r.checkReadyState(this)},r.onEvtCLEListener=e=>{r.checkReadyState(this);const t=Number(e.code);if(1e3===t)return;const n=function(e){switch(e){case 1001:return h.Err_1001;case 1002:return h.Err_1002;case 1003:return h.Err_1003;case 1006:return h.Err_1006;case 1007:return h.Err_1007;case 1008:return h.Err_1008;case 1009:return h.Err_1009}return h.Err_unknown}(t);o.emit("ws.error",{target:e,type:u.Close,closeError:n})},r.webSocket.addEventListener("open",r.onEvtOpnListener),r.webSocket.addEventListener("message",r.onEvtMsgListener),r.webSocket.addEventListener("error",r.onEvtErrListener),r.webSocket.addEventListener("close",r.onEvtCLEListener),await new Promise(((e,t)=>{const n=()=>{e(!0),r.connecting=!1,this.off("ws.error",s)},s=e=>{t(e.error?e.error:new Error("WebSocket connection failed!")),r.connecting=!1,this.off("ws.afterConnect",n)};this.once("ws.afterConnect",n),this.once("ws.error",s)}))}async revoke(){return!0}}const o=new s;return t.__debug__&&(Object.assign(o,{__controller__:r}),Object.assign(window,{$live:o})),o}})(),n})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LiveSDK=t():e.LiveSDK=t()}(self,(function(){return(()=>{"use strict";var e={900:(e,t,r)=>{r.d(t,{RTCExample:()=>o});var n=r(508);let s;!function(e){e.realsee="realsee",e.custom="custom"}(s||(s={}));class o extends n.x{join(e){throw new Error("Method not implemented.")}joined=!1;micro=!1;voiceId="";type=s.realsee;async quit(){return!0}async detectMicro(){return!0}async toggleMicro(e){return!0}shock(){}}},508:(e,t,r)=>{r.d(t,{x:()=>o});const n=Symbol("$$LIVE_EVENT$$");function s(e){return e[n]||(e[n]={}),e[n]}class o{hasListener(e){const t=s(this);return t&&t[e]&&t[e].length>0}on(e,t,r){const n=s(this);return n[e]||(n[e]=[]),n[e].push([t,r||!1]),()=>this.off(e,t)}once(e,t){return this.on(e,t,!0)}off(e,t){if(void 0===e)return void(this[n]||delete this[n]);const r=s(this);if(r[e]||(r[e]=[]),void 0===t)return void(r[e].length=0);let o=0;for(;o<r[e].length&&r[e][o][0]!==t;o++);o<r[e].length&&r[e].splice(o,1)}emit(e,...t){let r=!1;const n=s(this)[e]||[];for(let s of n.slice()){const[n,o=!1]=s,i=n(...t);o&&this.off(e,n),!1===i&&(r=!0)}return r}}let i;i||(i={})}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function o(e,r){return!!s(e,r)||(t(e)&&t(r)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!o(e[s],t[s]))return!1}return!0}(e,r):!(!Array.isArray(e)||!Array.isArray(r))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!o(e[r],t[r]))return!1;return!0}(e,r))}function i(e,r,n={deep:!1}){return n.deep?o(e,r):function(e,r){return!!s(e,r)||(t(e)&&t(r)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,o=r.length;n<o;n++){const o=r[n];if(!s(e[o],t[o]))return!1}return!0}(e,r):!(!Array.isArray(e)||!Array.isArray(r))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!s(e[r],t[r]))return!1;return!0}(e,r))}(e,r)}r.r(n),r.d(n,{createLive:()=>E});var a=r(508);let c,u,h,d,f,l,y;!function(e){e[e.NOTINITIALIZED=-1]="NOTINITIALIZED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(c||(c={})),function(e){e.Error="Error",e.Close="Close",e.MicroAuth="MicroAuth",e.DuplicateConnect="DuplicateConnect",e.IllegalURL="IllegalURL",e.Unknown="Unknown",e.IllegalArgs="IllegalArgs"}(u||(u={})),function(e){e.Err_1001="CLOSE_GOING_AWAY",e.Err_1002="CLOSE_PROTOCOL_ERROR",e.Err_1003="CLOSE_UNSUPPORTED",e.Err_1006="CLOSE_ABNORMAL",e.Err_1007="Unsupported Data",e.Err_1008="Policy Violation",e.Err_1009="CLOSE_TOO_LARGE",e.Err_unknown="unknown"}(h||(h={})),function(e){e.SelfUserInfo="SELF_USER_INFO",e.RoomInfo="ROOM_INFO",e.RTCInfo="RTC_INFO",e.UserList="USER_LIST",e.BuiltinMsg="BUILTIN_MSG",e.CustomEvent="CUSTOM_EVENT",e.KeyframeSync="KEYFRAME_SYNC",e.UserKickOut="USER_KICK_OUT"}(d||(d={})),function(e){e.UserChange="user_change",e.RoomChange="room_change"}(f||(f={})),function(e){e.UserMicroStatus="change_micro_status",e.UserMicroStatusSync="sync_micro_status",e.UserPermission="change_permission",e.UserStatus="change_status",e.UserInfo="change_info",e.RoomClose="close"}(l||(l={})),function(e){e.OPEN="OPEN",e.CLOSE="CLOSE"}(y||(y={}));var g=r(900);class m{readyState=c.NOTINITIALIZED;canSync=!0;connecting=!1;keyframes={};constructor(e){this.options=Object.assign({autoConnect:!0,healthCheck:3e3},e)}checkReadyState=e=>{do{if(!this.webSocket){this.readyState!==c.NOTINITIALIZED&&(this.readyState=c.NOTINITIALIZED,e.emit("ws.readyStateUpdate",this.readyState));break}const t=this.webSocket.readyState;t!==this.readyState&&(this.readyState=t,e.emit("ws.readyStateUpdate",this.readyState))}while(0);return this.readyState};dispose=()=>{console.log("dispose"),this.disposeWebSocket(),this.connecting=!1,this.healthCheckId&&(clearInterval(this.healthCheckId),this.healthCheckId=void 0)};disposeWebSocket=()=>{this.webSocket&&(this.onEvtOpnListener&&(this.webSocket.removeEventListener("open",this.onEvtOpnListener),this.onEvtOpnListener=void 0),this.onEvtMsgListener&&(this.webSocket.removeEventListener("message",this.onEvtMsgListener),this.onEvtMsgListener=void 0),this.onEvtErrListener&&(this.webSocket.removeEventListener("error",this.onEvtErrListener),this.onEvtErrListener=void 0),this.onEvtCLEListener&&(this.webSocket.removeEventListener("close",this.onEvtCLEListener),this.onEvtCLEListener=void 0),this.webSocket.close(),this.webSocket=void 0)};handleMessage(e,t){const{command:r,data:n,frontRequestId:s,code:o,message:a}=e;if("SUCCESS"!==o)return t.emit("error",e);switch(r){case d.SelfUserInfo:{const e=n;if(i(this.selfUserInfo,e,{deep:!0}))return;this.selfUserInfo=e,t.emit("selfInfoUpdate",this.selfUserInfo,s);break}case d.RoomInfo:{const e=n;this.roomInfo=Object.assign({},e),t.emit("readyKeyframeSync",e.last_frame||{});break}case d.RTCInfo:{const{voice_id:e,type:r}=n;if(t.$RTC.joined)break;t.$RTC.join({voiceId:e,userId:this.selfUserInfo?.id||"",roomId:this.roomInfo?.info.room_code,type:r}),t.updateStatus(f.UserChange,l.UserMicroStatus,{status:y.OPEN});break}case d.UserList:{const e=n;this.userList=e,t.emit("userListUpdate",this.userList,s);break}case d.CustomEvent:{const e=n;t.emit("broadcast",e,s);break}case d.KeyframeSync:{const e=n,r=Object.keys(e).reduce(((r,n)=>{if(i(e[n],this.keyframes[n],{deep:!0}))return r;const o=[e[n],this.keyframes[n],s],a=n;return t.keyframes.emit(a,...o),this.keyframes[n]=e[n],r[n]=e[n],r}),{});t.emit("keyframes",r,s);break}case d.BuiltinMsg:{const e=n;t.emit("builtinEvent",e),e.event_type===f.UserChange&&t.emit("userChange",e),e.event_type===f.RoomChange&&t.emit("roomChange",e),e.event_type===f.UserChange&&e.action===l.UserMicroStatus&&t.toggleMicro(e.data.status===y.OPEN),e.event_type===f.RoomChange&&e.action===l.RoomClose&&(this.options.rtc?.quit(),this.disposeWebSocket());break}case d.UserKickOut:t.emit("kickOut")}}sendMessage(e){return this.webSocket?e?void this.webSocket.send(JSON.stringify(e)):console.warn("WebSocket messages is empty!"):console.warn("WebSocket has not yet been initialized!")}}function E(t){const r=new m(t),n=(t,r={},n)=>((n=n?Array.isArray(n)?n:[n]:[])&&(r.to_user_ids=n),{command:t,front_request_id:(e()+e()+"-"+e()+"-4"+e().substr(0,3)+"-"+e()+"-"+e()+e()+e()).toLowerCase(),data:r});class s extends a.x{get options(){return Object.freeze(Object.assign({},r.options))}get readyState(){return r.checkReadyState(this),r.readyState}get url(){return r.webSocket?.url||""}get selfInfo(){return r.selfUserInfo}get userList(){return r.userList||[]}get snapshot(){return r.keyframes||{}}get $RTC(){return r.options.rtc}keyframes=new a.x;constructor(){super(),t.rtc||(r.options.rtc=new g.RTCExample),r.options.url&&r.options.getTicket&&this.connect();const e=(e=>{if(!e)return 0;if(!0===e)return 3e3;const t=Number(e);return t>0?t:3e3})(r.options.healthCheck);e&&(r.healthCheckId=setInterval((()=>r.checkReadyState(this)),e))}async setSelfInfo(e){if(this.readyState!==c.OPEN)return new Error("The connection is not open and ready to communicate.");try{return await this.updateStatus(f.UserChange,l.UserInfo,e)}catch(e){return e}}getFramesByKey(e){return r.keyframes[e]}sendKeyframe(e,t){if(this.readyState!==c.OPEN)return new Error("The connection is not open and ready to communicate.");r.keyframes[e]=t;const s=n(d.KeyframeSync,this.snapshot);return r.sendMessage(s),!0}broadcast(e,t,s){return this.readyState!==c.OPEN?new Error("The connection is not open and ready to communicate."):new Promise(((o,i)=>{const a=n(d.CustomEvent,e,t),c=a.front_request_id;r.sendMessage(a);const u=s?setTimeout((()=>{i(new Error("RESPONSE TIMEOUT")),this.off("broadcast",h)}),s):void 0,h=(e,t)=>{t===c&&(this.off("broadcast",h),o(e),u&&clearInterval(u))};this.on("broadcast",h)}))}async updateStatus(e,t,s,o){if(this.readyState!==c.OPEN)return!1;const i=Object.assign({event_type:e,action:t},{data:s}),a=n(d.BuiltinMsg,i,o);return r.sendMessage(a),!0}async toggleMicro(e){return!!this.selfInfo?.permission?.control_own_micro&&(await this.$RTC.toggleMicro(e),await this.updateStatus(f.UserChange,l.UserMicroStatus,{status:e?y.OPEN:y.CLOSE},[]))}async forbidMicro(e,t){return!(r.options.canForbidUserMicro&&!r.options.canForbidUserMicro(t))&&!!this.selfInfo?.permission?.control_other_micro&&await this.updateStatus(f.UserChange,l.UserMicroStatus,{status:e},t)}async forbidSync(e,t){return!(r.options.canForbidUserSync&&!r.options.canForbidUserSync(t))&&!!this.selfInfo?.permission?.control_other_sync&&await this.updateStatus(f.UserChange,l.UserPermission,{sync_frame:e},t)}async kick(e){return!(r.options.canForbidUserKick&&!r.options.canForbidUserKick(e))&&!!this.selfInfo?.permission?.change_other_status&&await this.updateStatus(f.UserChange,l.UserStatus,{status:"KICK_OUT"},e)}async exit(){return await this.$RTC.quit(),await this.updateStatus(f.RoomChange,l.RoomClose,{})}async connect(e={}){if(!await this.$RTC.detectMicro()){const e=new Error("系统监测麦克风未授权~");return this.emit("ws.error",{type:u.MicroAuth,error:e}),e}if(r.connecting){const e=new Error("WebSocket 正在连接中,请勿重复连接 ...");return this.emit("ws.error",{type:u.DuplicateConnect,error:e}),e}const{force:t}=e;if(!t&&(this.readyState===c.CONNECTING||this.readyState===c.OPEN))return!0;if(e.url&&(r.options.url=e.url),e.getTicket&&(r.options.getTicket=e.getTicket),!r.options.url||!r.options.url.startsWith("ws")){const e=new Error(`WebSocket URL 未配置或格式不合法:"${r.options.url}"`);return this.emit("ws.error",{type:u.IllegalURL,error:e}),e}if(!r.options.getTicket){const e=new Error("getTicket() 未配置!");return this.emit("ws.error",{type:u.IllegalArgs,error:e}),e}r.connecting=!0,r.disposeWebSocket(),this.emit("ws.beforeConnect");const n=t||e.url||!this.url?function(e,t={}){const r=-1!==e.indexOf("?");return e+Object.keys(t).reduce(((e,n,s)=>`${e}${0!==s||r?"&":"?"}${n}=${t[n]}`),"")}(r.options.url,{ticket:await r.options.getTicket(),force:Number(!!t)}):this.url;return r.webSocket=new WebSocket(n),r.onEvtOpnListener=()=>{r.checkReadyState(this),this.emit("ws.afterConnect")},r.onEvtMsgListener=e=>{r.checkReadyState(this);try{const t=function(e){try{const t=JSON.parse(e),r={code:t.code,message:t.message,command:t.command,roomCode:t.room_code,appID:t.app_id,requestId:t.request_id,frontRequestId:t.front_request_id,triggerUserID:t.trigger_user_id,data:t.data||{}},n=Object.keys(r).filter((e=>void 0===r[e]));return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),r}catch(e){return!1}}(e.data);if(!1===t)return;r.handleMessage(t,this)}catch(t){this.emit("ws.error",{type:u.Unknown,error:t,target:e})}},r.onEvtErrListener=e=>{o.emit("ws.error",{type:u.Error,target:e}),r.checkReadyState(this)},r.onEvtCLEListener=e=>{r.checkReadyState(this);const t=Number(e.code);if(1e3===t)return;const n=function(e){switch(e){case 1001:return h.Err_1001;case 1002:return h.Err_1002;case 1003:return h.Err_1003;case 1006:return h.Err_1006;case 1007:return h.Err_1007;case 1008:return h.Err_1008;case 1009:return h.Err_1009}return h.Err_unknown}(t);o.emit("ws.error",{target:e,type:u.Close,closeError:n})},r.webSocket.addEventListener("open",r.onEvtOpnListener),r.webSocket.addEventListener("message",r.onEvtMsgListener),r.webSocket.addEventListener("error",r.onEvtErrListener),r.webSocket.addEventListener("close",r.onEvtCLEListener),await new Promise(((e,t)=>{const n=()=>{e(!0),r.connecting=!1,this.off("ws.error",s)},s=e=>{t(e.error?e.error:new Error("WebSocket connection failed!")),r.connecting=!1,this.off("ws.afterConnect",n)};this.once("ws.afterConnect",n),this.once("ws.error",s)}))}async revoke(){return!0}}const o=new s;return t.__debug__&&(Object.assign(o,{__controller__:r}),Object.assign(window,{$live:o})),o}})(),n})()}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LiveSDK=t():e.LiveSDK=t()}(self,(function(){return(()=>{var e={206:e=>{if(!("React"in window))throw new Error('"React" is not available. Please include "react" in your HTML.');e.exports=window.React},900:(e,t,r)=>{"use strict";r.d(t,{RTCExample:()=>o});var n=r(508);let s;!function(e){e.realsee="realsee",e.custom="custom"}(s||(s={}));class o extends n.x{join(e){throw new Error("Method not implemented.")}joined=!1;micro=!1;voiceId="";type=s.realsee;async quit(){return!0}async detectMicro(){return!0}async toggleMicro(e){return!0}shock(){}}},431:(e,t,r)=>{"use strict";function n(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function s(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function i(e,t){return!!o(e,t)||(s(e)&&s(t)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!i(e[s],t[s]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!i(e[r],t[r]))return!1;return!0}(e,t))}function a(e,t,r={deep:!1}){return r.deep?i(e,t):function(e,t){return!!o(e,t)||(s(e)&&s(t)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!o(e[s],t[s]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!o(e[r],t[r]))return!1;return!0}(e,t))}(e,t)}r.d(t,{createLive:()=>E});var c=r(508);let u,f,l,d,h,y,g;!function(e){e[e.NOTINITIALIZED=-1]="NOTINITIALIZED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(u||(u={})),function(e){e.Error="Error",e.Close="Close",e.MicroAuth="MicroAuth",e.DuplicateConnect="DuplicateConnect",e.IllegalURL="IllegalURL",e.Unknown="Unknown",e.IllegalArgs="IllegalArgs"}(f||(f={})),function(e){e.Err_1001="CLOSE_GOING_AWAY",e.Err_1002="CLOSE_PROTOCOL_ERROR",e.Err_1003="CLOSE_UNSUPPORTED",e.Err_1006="CLOSE_ABNORMAL",e.Err_1007="Unsupported Data",e.Err_1008="Policy Violation",e.Err_1009="CLOSE_TOO_LARGE",e.Err_unknown="unknown"}(l||(l={})),function(e){e.SelfUserInfo="SELF_USER_INFO",e.RoomInfo="ROOM_INFO",e.RTCInfo="RTC_INFO",e.UserList="USER_LIST",e.BuiltinMsg="BUILTIN_MSG",e.CustomEvent="CUSTOM_EVENT",e.KeyframeSync="KEYFRAME_SYNC",e.UserKickOut="USER_KICK_OUT"}(d||(d={})),function(e){e.UserChange="user_change",e.RoomChange="room_change"}(h||(h={})),function(e){e.UserMicroStatus="change_micro_status",e.UserMicroStatusSync="sync_micro_status",e.UserPermission="change_permission",e.UserStatus="change_status",e.UserInfo="change_info",e.RoomClose="close"}(y||(y={})),function(e){e.OPEN="OPEN",e.CLOSE="CLOSE"}(g||(g={}));var m=r(900);class S{readyState=u.NOTINITIALIZED;canSync=!0;connecting=!1;keyframes={};constructor(e){this.options=Object.assign({autoConnect:!0,healthCheck:3e3},e)}checkReadyState=e=>{do{if(!this.webSocket){this.readyState!==u.NOTINITIALIZED&&(this.readyState=u.NOTINITIALIZED,e.emit("ws.readyStateUpdate",this.readyState));break}const t=this.webSocket.readyState;t!==this.readyState&&(this.readyState=t,e.emit("ws.readyStateUpdate",this.readyState))}while(0);return this.readyState};dispose=()=>{console.log("dispose"),this.disposeWebSocket(),this.connecting=!1,this.healthCheckId&&(clearInterval(this.healthCheckId),this.healthCheckId=void 0)};disposeWebSocket=()=>{this.webSocket&&(this.onEvtOpnListener&&(this.webSocket.removeEventListener("open",this.onEvtOpnListener),this.onEvtOpnListener=void 0),this.onEvtMsgListener&&(this.webSocket.removeEventListener("message",this.onEvtMsgListener),this.onEvtMsgListener=void 0),this.onEvtErrListener&&(this.webSocket.removeEventListener("error",this.onEvtErrListener),this.onEvtErrListener=void 0),this.onEvtCLEListener&&(this.webSocket.removeEventListener("close",this.onEvtCLEListener),this.onEvtCLEListener=void 0),this.webSocket.close(),this.webSocket=void 0)};handleMessage(e,t){const{command:r,data:n,frontRequestId:s,code:o,message:i}=e;if("SUCCESS"!==o)return t.emit("error",e);switch(r){case d.SelfUserInfo:{const e=n;if(a(this.selfUserInfo,e,{deep:!0}))return;this.selfUserInfo=e,t.emit("selfInfoUpdate",this.selfUserInfo,s);break}case d.RoomInfo:{const e=n;this.roomInfo=Object.assign({},e),t.emit("readyKeyframeSync",e.last_frame||{});break}case d.RTCInfo:{const{voice_id:e,type:r}=n;if(t.$RTC.joined)break;t.$RTC.join({voiceId:e,userId:this.selfUserInfo?.id||"",roomId:this.roomInfo?.info.room_code,type:r}),t.updateStatus(h.UserChange,y.UserMicroStatus,{status:g.OPEN});break}case d.UserList:{const e=n;this.userList=e,t.emit("userListUpdate",this.userList,s);break}case d.CustomEvent:{const e=n;t.emit("broadcast",e,s);break}case d.KeyframeSync:{const e=n,r=Object.keys(e).reduce(((r,n)=>{if(a(e[n],this.keyframes[n],{deep:!0}))return r;const o=[e[n],this.keyframes[n],s],i=n;return t.keyframes.emit(i,...o),this.keyframes[n]=e[n],r[n]=e[n],r}),{});t.emit("keyframes",r,s);break}case d.BuiltinMsg:{const e=n;t.emit("builtinEvent",e),e.event_type===h.UserChange&&t.emit("userChange",e),e.event_type===h.RoomChange&&t.emit("roomChange",e),e.event_type===h.UserChange&&e.action===y.UserMicroStatus&&t.toggleMicro(e.data.status===g.OPEN),e.event_type===h.RoomChange&&e.action===y.RoomClose&&(this.options.rtc?.quit(),this.disposeWebSocket());break}case d.UserKickOut:t.emit("kickOut")}}sendMessage(e){return this.webSocket?e?void this.webSocket.send(JSON.stringify(e)):console.warn("WebSocket messages is empty!"):console.warn("WebSocket has not yet been initialized!")}}function E(e){const t=new S(e),r=(e,t={},r)=>((r=r?Array.isArray(r)?r:[r]:[])&&(t.to_user_ids=r),{command:e,front_request_id:(n()+n()+"-"+n()+"-4"+n().substr(0,3)+"-"+n()+"-"+n()+n()+n()).toLowerCase(),data:t});class s extends c.x{get options(){return Object.freeze(Object.assign({},t.options))}get readyState(){return t.checkReadyState(this),t.readyState}get url(){return t.webSocket?.url||""}get selfInfo(){return t.selfUserInfo}get userList(){return t.userList||[]}get snapshot(){return t.keyframes||{}}get $RTC(){return t.options.rtc}keyframes=new c.x;constructor(){super(),e.rtc||(t.options.rtc=new m.RTCExample),t.options.url&&t.options.getTicket&&this.connect();const r=(e=>{if(!e)return 0;if(!0===e)return 3e3;const t=Number(e);return t>0?t:3e3})(t.options.healthCheck);r&&(t.healthCheckId=setInterval((()=>t.checkReadyState(this)),r))}async setSelfInfo(e){if(this.readyState!==u.OPEN)return new Error("The connection is not open and ready to communicate.");try{return await this.updateStatus(h.UserChange,y.UserInfo,e)}catch(e){return e}}getFramesByKey(e){return t.keyframes[e]}sendKeyframe(e,n){if(this.readyState!==u.OPEN)return new Error("The connection is not open and ready to communicate.");t.keyframes[e]=n;const s=r(d.KeyframeSync,this.snapshot);return t.sendMessage(s),!0}broadcast(e,n,s){return this.readyState!==u.OPEN?new Error("The connection is not open and ready to communicate."):new Promise(((o,i)=>{const a=r(d.CustomEvent,e,n),c=a.front_request_id;t.sendMessage(a);const u=s?setTimeout((()=>{i(new Error("RESPONSE TIMEOUT")),this.off("broadcast",f)}),s):void 0,f=(e,t)=>{t===c&&(this.off("broadcast",f),o(e),u&&clearInterval(u))};this.on("broadcast",f)}))}async updateStatus(e,n,s,o){if(this.readyState!==u.OPEN)return!1;const i=Object.assign({event_type:e,action:n},{data:s}),a=r(d.BuiltinMsg,i,o);return t.sendMessage(a),!0}async toggleMicro(e){return!!this.selfInfo?.permission?.control_own_micro&&(await this.$RTC.toggleMicro(e),await this.updateStatus(h.UserChange,y.UserMicroStatus,{status:e?g.OPEN:g.CLOSE},[]))}async forbidMicro(e,r){return!(t.options.canForbidUserMicro&&!t.options.canForbidUserMicro(r))&&!!this.selfInfo?.permission?.control_other_micro&&await this.updateStatus(h.UserChange,y.UserMicroStatus,{status:e},r)}async forbidSync(e,r){return!(t.options.canForbidUserSync&&!t.options.canForbidUserSync(r))&&!!this.selfInfo?.permission?.control_other_sync&&await this.updateStatus(h.UserChange,y.UserPermission,{sync_frame:e},r)}async kick(e){return!(t.options.canForbidUserKick&&!t.options.canForbidUserKick(e))&&!!this.selfInfo?.permission?.change_other_status&&await this.updateStatus(h.UserChange,y.UserStatus,{status:"KICK_OUT"},e)}async exit(){return await this.$RTC.quit(),await this.updateStatus(h.RoomChange,y.RoomClose,{})}async connect(e={}){if(!await this.$RTC.detectMicro()){const e=new Error("系统监测麦克风未授权~");return this.emit("ws.error",{type:f.MicroAuth,error:e}),e}if(t.connecting){const e=new Error("WebSocket 正在连接中,请勿重复连接 ...");return this.emit("ws.error",{type:f.DuplicateConnect,error:e}),e}const{force:r}=e;if(!r&&(this.readyState===u.CONNECTING||this.readyState===u.OPEN))return!0;if(e.url&&(t.options.url=e.url),e.getTicket&&(t.options.getTicket=e.getTicket),!t.options.url||!t.options.url.startsWith("ws")){const e=new Error(`WebSocket URL 未配置或格式不合法:"${t.options.url}"`);return this.emit("ws.error",{type:f.IllegalURL,error:e}),e}if(!t.options.getTicket){const e=new Error("getTicket() 未配置!");return this.emit("ws.error",{type:f.IllegalArgs,error:e}),e}t.connecting=!0,t.disposeWebSocket(),this.emit("ws.beforeConnect");const n=r||e.url||!this.url?function(e,t={}){const r=-1!==e.indexOf("?");return e+Object.keys(t).reduce(((e,n,s)=>`${e}${0!==s||r?"&":"?"}${n}=${t[n]}`),"")}(t.options.url,{ticket:await t.options.getTicket(),force:Number(!!r)}):this.url;return t.webSocket=new WebSocket(n),t.onEvtOpnListener=()=>{t.checkReadyState(this),this.emit("ws.afterConnect")},t.onEvtMsgListener=e=>{t.checkReadyState(this);try{const r=function(e){try{const t=JSON.parse(e),r={code:t.code,message:t.message,command:t.command,roomCode:t.room_code,appID:t.app_id,requestId:t.request_id,frontRequestId:t.front_request_id,triggerUserID:t.trigger_user_id,data:Object.assign({trigger_user_id:t.trigger_user_id},t.data||{})},n=Object.keys(r).filter((e=>void 0===r[e]));return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),r}catch(e){return!1}}(e.data);if(!1===r)return;t.handleMessage(r,this)}catch(t){this.emit("ws.error",{type:f.Unknown,error:t,target:e})}},t.onEvtErrListener=e=>{o.emit("ws.error",{type:f.Error,target:e}),t.checkReadyState(this)},t.onEvtCLEListener=e=>{t.checkReadyState(this);const r=Number(e.code);if(1e3===r)return;const n=function(e){switch(e){case 1001:return l.Err_1001;case 1002:return l.Err_1002;case 1003:return l.Err_1003;case 1006:return l.Err_1006;case 1007:return l.Err_1007;case 1008:return l.Err_1008;case 1009:return l.Err_1009}return l.Err_unknown}(r);o.emit("ws.error",{target:e,type:f.Close,closeError:n})},t.webSocket.addEventListener("open",t.onEvtOpnListener),t.webSocket.addEventListener("message",t.onEvtMsgListener),t.webSocket.addEventListener("error",t.onEvtErrListener),t.webSocket.addEventListener("close",t.onEvtCLEListener),await new Promise(((e,r)=>{const n=()=>{e(!0),t.connecting=!1,this.off("ws.error",s)},s=e=>{r(e.error?e.error:new Error("WebSocket connection failed!")),t.connecting=!1,this.off("ws.afterConnect",n)};this.once("ws.afterConnect",n),this.once("ws.error",s)}))}async revoke(){return!0}}const o=new s;return e.__debug__&&(Object.assign(o,{__controller__:t}),Object.assign(window,{$live:o})),o}},508:(e,t,r)=>{"use strict";r.d(t,{x:()=>o});const n=Symbol("$$LIVE_EVENT$$");function s(e){return e[n]||(e[n]={}),e[n]}class o{hasListener(e){const t=s(this);return t&&t[e]&&t[e].length>0}on(e,t,r){const n=s(this);return n[e]||(n[e]=[]),n[e].push([t,r||!1]),()=>this.off(e,t)}once(e,t){return this.on(e,t,!0)}off(e,t){if(void 0===e)return void(this[n]||delete this[n]);const r=s(this);if(r[e]||(r[e]=[]),void 0===t)return void(r[e].length=0);let o=0;for(;o<r[e].length&&r[e][o][0]!==t;o++);o<r[e].length&&r[e].splice(o,1)}emit(e,...t){let r=!1;const n=s(this)[e]||[];for(let s of n.slice()){const[n,o=!1]=s,i=n(...t);o&&this.off(e,n),!1===i&&(r=!0)}return r}}let i;i||(i={})}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{createLiveReact:()=>s});var e=r(206),t=r(431);function s(r){const n=e.createContext(null),s=(0,t.createLive)(r);function o(){const t=e.useContext(n);if(!t)throw new Error("LiveProvider never found.");return t}return{live:s,LiveProvider:function(t){return e.createElement(n.Provider,{value:t.live||s},t.children)},unsafe__useLiveInstance:function(){return o()},unsafe__useRTCInstance:function(){return o().$RTC},useCurrentWebSocketUrl:function(){const t=o(),[r,n]=e.useState(void 0);return e.useEffect((()=>{const e=()=>n(t.url);return t.on("ws.beforeConnect",e),()=>t.off("ws.beforeConnect",e)}),[t]),r},useConnect:function(){const e=o();return async t=>await e.connect(t)},useKeyframe:function(t){const r=o(),[n,s]=e.useState(r.getFramesByKey(t));return e.useEffect((()=>{const e=t,n=e=>s(e);return r.keyframes.on(e,n),()=>r.keyframes.off(e,n)}),[r]),[n,e.useCallback((e=>r.sendKeyframe(t,e)),[r])]},useKeyframeUpdateCallback:function(t,r,n){const s=o(),i=n?[s,t].concat(n):[s,t],a=()=>s.keyframes.off(t,r);return e.useEffect((()=>(s.keyframes.on(t,r),a)),i),a},useLiveAction:function(){const t=o(),r=e.useCallback((e=>t.toggleMicro(e)),[t]),n=e.useCallback(((e,r,n=0)=>t.broadcast(e,r,n)),[t]),s=e.useCallback((()=>t.exit()),[t]),i=e.useCallback((e=>t.kick(e)),[t]),a=e.useCallback(((e,r)=>t.forbidMicro(e,r)),[t]),c=e.useCallback(((e,r)=>t.forbidSync(e,r)),[t]),u=e.useCallback((e=>t.getFramesByKey(e)),[t]);return{broadcast:n,exit:s,kick:i,toggleMicro:r,forbidMicro:a,forbidSync:c,sendKeyframe:e.useCallback(((e,r)=>t.sendKeyframe(e,r)),[t]),getFramesByKey:u,setSelfInfo:e.useCallback((e=>t.setSelfInfo(e)),[t]),updateStatus:e.useCallback(((e,r,n,s)=>t.updateStatus(e,r,n,s)),[t])}},useLiveEventCallback:function(t,r,n){const s=o(),i=()=>s.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.on(t,r),i)),a),i},useReadyState:function(){const t=o(),[r,n]=e.useState(t.readyState);return e.useEffect((()=>{const e=e=>n(e);return t.on("ws.readyStateUpdate",e),()=>t.off("ws.readyStateUpdate",e)}),[t]),r},useRTCAction:function(){const t=o(),r=e.useCallback((e=>t.$RTC.join(e)),[t]);return{join:r,quit:e.useCallback((()=>t.$RTC.quit()),[t]),shock:e.useCallback((()=>t.$RTC.shock()),[t]),toggleMicro:e.useCallback((e=>t.$RTC.toggleMicro(e)),[t]),detectMicro:e.useCallback((()=>t.$RTC.detectMicro()),[t])}},useRTCEventCallback:function(t,r,n){const s=o(),i=()=>s.$RTC.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.$RTC.on(t,r),i)),a),i},useSelfInfo:function(){const t=o(),[r,n]=e.useState(t.selfInfo||{}),s=e=>n(e);return e.useEffect((()=>(t.on("selfInfoUpdate",s),()=>t.off("selfInfoUpdate",s))),[t]),[r,e.useCallback((async e=>await t.setSelfInfo(e)),[t])]},useSnapshot:function(){const t=o(),[r,n]=e.useState(t.snapshot);return e.useEffect((()=>{const e=e=>n(e);return t.on("keyframes",e),()=>t.off("keyframes",e)})),r},useUserList:function(){const t=o(),[r,n]=e.useState(t.userList),s=e=>n(e);return e.useEffect((()=>(t.on("userListUpdate",s),()=>t.off("userListUpdate",s))),[t]),r},useWebSocketEventCallback:function(t,r,n){const s=o(),i=()=>s.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.on(t,r),i)),a),i}}}})(),n})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LiveSDK=t():e.LiveSDK=t()}(self,(function(){return(()=>{var e={206:e=>{if(!("React"in window))throw new Error('"React" is not available. Please include "react" in your HTML.');e.exports=window.React},900:(e,t,r)=>{"use strict";r.d(t,{RTCExample:()=>o});var n=r(508);let s;!function(e){e.realsee="realsee",e.custom="custom"}(s||(s={}));class o extends n.x{join(e){throw new Error("Method not implemented.")}joined=!1;micro=!1;voiceId="";type=s.realsee;async quit(){return!0}async detectMicro(){return!0}async toggleMicro(e){return!0}shock(){}}},431:(e,t,r)=>{"use strict";function n(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function s(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return e===t||typeof e==typeof t&&!(!Number.isNaN(e)||!Number.isNaN(t))}function i(e,t){return!!o(e,t)||(s(e)&&s(t)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!i(e[s],t[s]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!i(e[r],t[r]))return!1;return!0}(e,t))}function a(e,t,r={deep:!1}){return r.deep?i(e,t):function(e,t){return!!o(e,t)||(s(e)&&s(t)?function(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(!o(e[s],t[s]))return!1}return!0}(e,t):!(!Array.isArray(e)||!Array.isArray(t))&&function(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(!o(e[r],t[r]))return!1;return!0}(e,t))}(e,t)}r.d(t,{createLive:()=>g});var c=r(508);let u,f,l,d,h,y,m;!function(e){e[e.NOTINITIALIZED=-1]="NOTINITIALIZED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(u||(u={})),function(e){e.Error="Error",e.Close="Close",e.MicroAuth="MicroAuth",e.DuplicateConnect="DuplicateConnect",e.IllegalURL="IllegalURL",e.Unknown="Unknown",e.IllegalArgs="IllegalArgs"}(f||(f={})),function(e){e.Err_1001="CLOSE_GOING_AWAY",e.Err_1002="CLOSE_PROTOCOL_ERROR",e.Err_1003="CLOSE_UNSUPPORTED",e.Err_1006="CLOSE_ABNORMAL",e.Err_1007="Unsupported Data",e.Err_1008="Policy Violation",e.Err_1009="CLOSE_TOO_LARGE",e.Err_unknown="unknown"}(l||(l={})),function(e){e.SelfUserInfo="SELF_USER_INFO",e.RoomInfo="ROOM_INFO",e.RTCInfo="RTC_INFO",e.UserList="USER_LIST",e.BuiltinMsg="BUILTIN_MSG",e.CustomEvent="CUSTOM_EVENT",e.KeyframeSync="KEYFRAME_SYNC",e.UserKickOut="USER_KICK_OUT"}(d||(d={})),function(e){e.UserChange="user_change",e.RoomChange="room_change"}(h||(h={})),function(e){e.UserMicroStatus="change_micro_status",e.UserMicroStatusSync="sync_micro_status",e.UserPermission="change_permission",e.UserStatus="change_status",e.UserInfo="change_info",e.RoomClose="close"}(y||(y={})),function(e){e.OPEN="OPEN",e.CLOSE="CLOSE"}(m||(m={}));var S=r(900);class E{readyState=u.NOTINITIALIZED;canSync=!0;connecting=!1;keyframes={};constructor(e){this.options=Object.assign({autoConnect:!0,healthCheck:3e3},e)}checkReadyState=e=>{do{if(!this.webSocket){this.readyState!==u.NOTINITIALIZED&&(this.readyState=u.NOTINITIALIZED,e.emit("ws.readyStateUpdate",this.readyState));break}const t=this.webSocket.readyState;t!==this.readyState&&(this.readyState=t,e.emit("ws.readyStateUpdate",this.readyState))}while(0);return this.readyState};dispose=()=>{console.log("dispose"),this.disposeWebSocket(),this.connecting=!1,this.healthCheckId&&(clearInterval(this.healthCheckId),this.healthCheckId=void 0)};disposeWebSocket=()=>{this.webSocket&&(this.onEvtOpnListener&&(this.webSocket.removeEventListener("open",this.onEvtOpnListener),this.onEvtOpnListener=void 0),this.onEvtMsgListener&&(this.webSocket.removeEventListener("message",this.onEvtMsgListener),this.onEvtMsgListener=void 0),this.onEvtErrListener&&(this.webSocket.removeEventListener("error",this.onEvtErrListener),this.onEvtErrListener=void 0),this.onEvtCLEListener&&(this.webSocket.removeEventListener("close",this.onEvtCLEListener),this.onEvtCLEListener=void 0),this.webSocket.close(),this.webSocket=void 0)};handleMessage(e,t){const{command:r,data:n,frontRequestId:s,code:o,message:i}=e;if("SUCCESS"!==o)return t.emit("error",e);switch(r){case d.SelfUserInfo:{const e=n;if(a(this.selfUserInfo,e,{deep:!0}))return;this.selfUserInfo=e,t.emit("selfInfoUpdate",this.selfUserInfo,s);break}case d.RoomInfo:{const e=n;this.roomInfo=Object.assign({},e),t.emit("readyKeyframeSync",e.last_frame||{});break}case d.RTCInfo:{const{voice_id:e,type:r}=n;if(t.$RTC.joined)break;t.$RTC.join({voiceId:e,userId:this.selfUserInfo?.id||"",roomId:this.roomInfo?.info.room_code,type:r}),t.updateStatus(h.UserChange,y.UserMicroStatus,{status:m.OPEN});break}case d.UserList:{const e=n;this.userList=e,t.emit("userListUpdate",this.userList,s);break}case d.CustomEvent:{const e=n;t.emit("broadcast",e,s);break}case d.KeyframeSync:{const e=n,r=Object.keys(e).reduce(((r,n)=>{if(a(e[n],this.keyframes[n],{deep:!0}))return r;const o=[e[n],this.keyframes[n],s],i=n;return t.keyframes.emit(i,...o),this.keyframes[n]=e[n],r[n]=e[n],r}),{});t.emit("keyframes",r,s);break}case d.BuiltinMsg:{const e=n;t.emit("builtinEvent",e),e.event_type===h.UserChange&&t.emit("userChange",e),e.event_type===h.RoomChange&&t.emit("roomChange",e),e.event_type===h.UserChange&&e.action===y.UserMicroStatus&&t.toggleMicro(e.data.status===m.OPEN),e.event_type===h.RoomChange&&e.action===y.RoomClose&&(this.options.rtc?.quit(),this.disposeWebSocket());break}case d.UserKickOut:t.emit("kickOut")}}sendMessage(e){return this.webSocket?e?void this.webSocket.send(JSON.stringify(e)):console.warn("WebSocket messages is empty!"):console.warn("WebSocket has not yet been initialized!")}}function g(e){const t=new E(e),r=(e,t={},r)=>((r=r?Array.isArray(r)?r:[r]:[])&&(t.to_user_ids=r),{command:e,front_request_id:(n()+n()+"-"+n()+"-4"+n().substr(0,3)+"-"+n()+"-"+n()+n()+n()).toLowerCase(),data:t});class s extends c.x{get options(){return Object.freeze(Object.assign({},t.options))}get readyState(){return t.checkReadyState(this),t.readyState}get url(){return t.webSocket?.url||""}get selfInfo(){return t.selfUserInfo}get userList(){return t.userList||[]}get snapshot(){return t.keyframes||{}}get $RTC(){return t.options.rtc}keyframes=new c.x;constructor(){super(),e.rtc||(t.options.rtc=new S.RTCExample),t.options.url&&t.options.getTicket&&this.connect();const r=(e=>{if(!e)return 0;if(!0===e)return 3e3;const t=Number(e);return t>0?t:3e3})(t.options.healthCheck);r&&(t.healthCheckId=setInterval((()=>t.checkReadyState(this)),r))}async setSelfInfo(e){if(this.readyState!==u.OPEN)return new Error("The connection is not open and ready to communicate.");try{return await this.updateStatus(h.UserChange,y.UserInfo,e)}catch(e){return e}}getFramesByKey(e){return t.keyframes[e]}sendKeyframe(e,n){if(this.readyState!==u.OPEN)return new Error("The connection is not open and ready to communicate.");t.keyframes[e]=n;const s=r(d.KeyframeSync,this.snapshot);return t.sendMessage(s),!0}broadcast(e,n,s){return this.readyState!==u.OPEN?new Error("The connection is not open and ready to communicate."):new Promise(((o,i)=>{const a=r(d.CustomEvent,e,n),c=a.front_request_id;t.sendMessage(a);const u=s?setTimeout((()=>{i(new Error("RESPONSE TIMEOUT")),this.off("broadcast",f)}),s):void 0,f=(e,t)=>{t===c&&(this.off("broadcast",f),o(e),u&&clearInterval(u))};this.on("broadcast",f)}))}async updateStatus(e,n,s,o){if(this.readyState!==u.OPEN)return!1;const i=Object.assign({event_type:e,action:n},{data:s}),a=r(d.BuiltinMsg,i,o);return t.sendMessage(a),!0}async toggleMicro(e){return!!this.selfInfo?.permission?.control_own_micro&&(await this.$RTC.toggleMicro(e),await this.updateStatus(h.UserChange,y.UserMicroStatus,{status:e?m.OPEN:m.CLOSE},[]))}async forbidMicro(e,r){return!(t.options.canForbidUserMicro&&!t.options.canForbidUserMicro(r))&&!!this.selfInfo?.permission?.control_other_micro&&await this.updateStatus(h.UserChange,y.UserMicroStatus,{status:e},r)}async forbidSync(e,r){return!(t.options.canForbidUserSync&&!t.options.canForbidUserSync(r))&&!!this.selfInfo?.permission?.control_other_sync&&await this.updateStatus(h.UserChange,y.UserPermission,{sync_frame:e},r)}async kick(e){return!(t.options.canForbidUserKick&&!t.options.canForbidUserKick(e))&&!!this.selfInfo?.permission?.change_other_status&&await this.updateStatus(h.UserChange,y.UserStatus,{status:"KICK_OUT"},e)}async exit(){return await this.$RTC.quit(),await this.updateStatus(h.RoomChange,y.RoomClose,{})}async connect(e={}){if(!await this.$RTC.detectMicro()){const e=new Error("系统监测麦克风未授权~");return this.emit("ws.error",{type:f.MicroAuth,error:e}),e}if(t.connecting){const e=new Error("WebSocket 正在连接中,请勿重复连接 ...");return this.emit("ws.error",{type:f.DuplicateConnect,error:e}),e}const{force:r}=e;if(!r&&(this.readyState===u.CONNECTING||this.readyState===u.OPEN))return!0;if(e.url&&(t.options.url=e.url),e.getTicket&&(t.options.getTicket=e.getTicket),!t.options.url||!t.options.url.startsWith("ws")){const e=new Error(`WebSocket URL 未配置或格式不合法:"${t.options.url}"`);return this.emit("ws.error",{type:f.IllegalURL,error:e}),e}if(!t.options.getTicket){const e=new Error("getTicket() 未配置!");return this.emit("ws.error",{type:f.IllegalArgs,error:e}),e}t.connecting=!0,t.disposeWebSocket(),this.emit("ws.beforeConnect");const n=r||e.url||!this.url?function(e,t={}){const r=-1!==e.indexOf("?");return e+Object.keys(t).reduce(((e,n,s)=>`${e}${0!==s||r?"&":"?"}${n}=${t[n]}`),"")}(t.options.url,{ticket:await t.options.getTicket(),force:Number(!!r)}):this.url;return t.webSocket=new WebSocket(n),t.onEvtOpnListener=()=>{t.checkReadyState(this),this.emit("ws.afterConnect")},t.onEvtMsgListener=e=>{t.checkReadyState(this);try{const r=function(e){try{const t=JSON.parse(e),r={code:t.code,message:t.message,command:t.command,roomCode:t.room_code,appID:t.app_id,requestId:t.request_id,frontRequestId:t.front_request_id,triggerUserID:t.trigger_user_id,data:t.data||{}},n=Object.keys(r).filter((e=>void 0===r[e]));return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),r}catch(e){return!1}}(e.data);if(!1===r)return;t.handleMessage(r,this)}catch(t){this.emit("ws.error",{type:f.Unknown,error:t,target:e})}},t.onEvtErrListener=e=>{o.emit("ws.error",{type:f.Error,target:e}),t.checkReadyState(this)},t.onEvtCLEListener=e=>{t.checkReadyState(this);const r=Number(e.code);if(1e3===r)return;const n=function(e){switch(e){case 1001:return l.Err_1001;case 1002:return l.Err_1002;case 1003:return l.Err_1003;case 1006:return l.Err_1006;case 1007:return l.Err_1007;case 1008:return l.Err_1008;case 1009:return l.Err_1009}return l.Err_unknown}(r);o.emit("ws.error",{target:e,type:f.Close,closeError:n})},t.webSocket.addEventListener("open",t.onEvtOpnListener),t.webSocket.addEventListener("message",t.onEvtMsgListener),t.webSocket.addEventListener("error",t.onEvtErrListener),t.webSocket.addEventListener("close",t.onEvtCLEListener),await new Promise(((e,r)=>{const n=()=>{e(!0),t.connecting=!1,this.off("ws.error",s)},s=e=>{r(e.error?e.error:new Error("WebSocket connection failed!")),t.connecting=!1,this.off("ws.afterConnect",n)};this.once("ws.afterConnect",n),this.once("ws.error",s)}))}async revoke(){return!0}}const o=new s;return e.__debug__&&(Object.assign(o,{__controller__:t}),Object.assign(window,{$live:o})),o}},508:(e,t,r)=>{"use strict";r.d(t,{x:()=>o});const n=Symbol("$$LIVE_EVENT$$");function s(e){return e[n]||(e[n]={}),e[n]}class o{hasListener(e){const t=s(this);return t&&t[e]&&t[e].length>0}on(e,t,r){const n=s(this);return n[e]||(n[e]=[]),n[e].push([t,r||!1]),()=>this.off(e,t)}once(e,t){return this.on(e,t,!0)}off(e,t){if(void 0===e)return void(this[n]||delete this[n]);const r=s(this);if(r[e]||(r[e]=[]),void 0===t)return void(r[e].length=0);let o=0;for(;o<r[e].length&&r[e][o][0]!==t;o++);o<r[e].length&&r[e].splice(o,1)}emit(e,...t){let r=!1;const n=s(this)[e]||[];for(let s of n.slice()){const[n,o=!1]=s,i=n(...t);o&&this.off(e,n),!1===i&&(r=!0)}return r}}let i;i||(i={})}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{createLiveReact:()=>s});var e=r(206),t=r(431);function s(r){const n=e.createContext(null),s=(0,t.createLive)(r);function o(){const t=e.useContext(n);if(!t)throw new Error("LiveProvider never found.");return t}return{live:s,LiveProvider:function(t){return e.createElement(n.Provider,{value:t.live||s},t.children)},unsafe__useLiveInstance:function(){return o()},unsafe__useRTCInstance:function(){return o().$RTC},useCurrentWebSocketUrl:function(){const t=o(),[r,n]=e.useState(void 0);return e.useEffect((()=>{const e=()=>n(t.url);return t.on("ws.beforeConnect",e),()=>t.off("ws.beforeConnect",e)}),[t]),r},useConnect:function(){const e=o();return async t=>await e.connect(t)},useKeyframe:function(t){const r=o(),[n,s]=e.useState(r.getFramesByKey(t));return e.useEffect((()=>{const e=t,n=e=>s(e);return r.keyframes.on(e,n),()=>r.keyframes.off(e,n)}),[r]),[n,e.useCallback((e=>r.sendKeyframe(t,e)),[r])]},useKeyframeUpdateCallback:function(t,r,n){const s=o(),i=n?[s,t].concat(n):[s,t],a=()=>s.keyframes.off(t,r);return e.useEffect((()=>(s.keyframes.on(t,r),a)),i),a},useLiveAction:function(){const t=o(),r=e.useCallback((e=>t.toggleMicro(e)),[t]),n=e.useCallback(((e,r,n=0)=>t.broadcast(e,r,n)),[t]),s=e.useCallback((()=>t.exit()),[t]),i=e.useCallback((e=>t.kick(e)),[t]),a=e.useCallback(((e,r)=>t.forbidMicro(e,r)),[t]),c=e.useCallback(((e,r)=>t.forbidSync(e,r)),[t]),u=e.useCallback((e=>t.getFramesByKey(e)),[t]);return{broadcast:n,exit:s,kick:i,toggleMicro:r,forbidMicro:a,forbidSync:c,sendKeyframe:e.useCallback(((e,r)=>t.sendKeyframe(e,r)),[t]),getFramesByKey:u,setSelfInfo:e.useCallback((e=>t.setSelfInfo(e)),[t]),updateStatus:e.useCallback(((e,r,n,s)=>t.updateStatus(e,r,n,s)),[t])}},useLiveEventCallback:function(t,r,n){const s=o(),i=()=>s.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.on(t,r),i)),a),i},useReadyState:function(){const t=o(),[r,n]=e.useState(t.readyState);return e.useEffect((()=>{const e=e=>n(e);return t.on("ws.readyStateUpdate",e),()=>t.off("ws.readyStateUpdate",e)}),[t]),r},useRTCAction:function(){const t=o(),r=e.useCallback((e=>t.$RTC.join(e)),[t]);return{join:r,quit:e.useCallback((()=>t.$RTC.quit()),[t]),shock:e.useCallback((()=>t.$RTC.shock()),[t]),toggleMicro:e.useCallback((e=>t.$RTC.toggleMicro(e)),[t]),detectMicro:e.useCallback((()=>t.$RTC.detectMicro()),[t])}},useRTCEventCallback:function(t,r,n){const s=o(),i=()=>s.$RTC.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.$RTC.on(t,r),i)),a),i},useSelfInfo:function(){const t=o(),[r,n]=e.useState(t.selfInfo||{}),s=e=>n(e);return e.useEffect((()=>(t.on("selfInfoUpdate",s),()=>t.off("selfInfoUpdate",s))),[t]),[r,e.useCallback((async e=>await t.setSelfInfo(e)),[t])]},useSnapshot:function(){const t=o(),[r,n]=e.useState(t.snapshot);return e.useEffect((()=>{const e=e=>n(e);return t.on("keyframes",e),()=>t.off("keyframes",e)})),r},useUserList:function(){const t=o(),[r,n]=e.useState(t.userList),s=e=>n(e);return e.useEffect((()=>(t.on("userListUpdate",s),()=>t.off("userListUpdate",s))),[t]),r},useWebSocketEventCallback:function(t,r,n){const s=o(),i=()=>s.off(t,r),a=n?[s,t].concat(n):[s,t];return e.useEffect((()=>(s.on(t,r),i)),a),i}}}})(),n})()}));
|