index.html 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351
  1. <!doctype html>
  2. <html class="default no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>@urtc/sdk-web</title>
  7. <meta name="description" content="Documentation for @urtc/sdk-web">
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="stylesheet" href="assets/css/main.css">
  10. </head>
  11. <body>
  12. <header>
  13. <div class="tsd-page-toolbar">
  14. <div class="container">
  15. <div class="table-wrap">
  16. <div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
  17. <div class="field">
  18. <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
  19. <input id="tsd-search-field" type="text" />
  20. </div>
  21. <ul class="results">
  22. <li class="state loading">Preparing search index...</li>
  23. <li class="state failure">The search index is not available</li>
  24. </ul>
  25. <a href="index.html" class="title">@urtc/sdk-web</a>
  26. </div>
  27. <div class="table-cell" id="tsd-widgets">
  28. <div id="tsd-filter">
  29. <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
  30. <div class="tsd-filter-group">
  31. <div class="tsd-select" id="tsd-filter-visibility">
  32. <span class="tsd-select-label">All</span>
  33. <ul class="tsd-select-list">
  34. <li data-value="public">Public</li>
  35. <li data-value="protected">Public/Protected</li>
  36. <li data-value="private" class="selected">All</li>
  37. </ul>
  38. </div>
  39. <input type="checkbox" id="tsd-filter-inherited" checked />
  40. <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
  41. <input type="checkbox" id="tsd-filter-externals" checked />
  42. <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
  43. </div>
  44. </div>
  45. <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="tsd-page-title">
  51. <div class="container">
  52. <ul class="tsd-breadcrumb">
  53. <li>
  54. <a href="index.html">Globals</a>
  55. </li>
  56. </ul>
  57. <h1>@urtc/sdk-web</h1>
  58. </div>
  59. </div>
  60. </header>
  61. <div class="container container-main">
  62. <div class="row">
  63. <div class="col-8 col-content">
  64. <section class="tsd-panel-group tsd-index-group">
  65. <h2>Index</h2>
  66. <section class="tsd-panel tsd-index-panel">
  67. <div class="tsd-index-content">
  68. <section class="tsd-index-section tsd-is-external">
  69. <h3>Classes</h3>
  70. <ul class="tsd-index-list">
  71. <li class="tsd-kind-class tsd-is-external"><a href="classes/client.html" class="tsd-kind-icon">Client</a></li>
  72. <li class="tsd-kind-class tsd-is-external"><a href="classes/localstream.html" class="tsd-kind-icon">Local<wbr>Stream</a></li>
  73. <li class="tsd-kind-class tsd-is-external"><a href="classes/remotestream.html" class="tsd-kind-icon">Remote<wbr>Stream</a></li>
  74. <li class="tsd-kind-class tsd-is-external"><a href="classes/rtcerror.html" class="tsd-kind-icon">Rtc<wbr>Error</a></li>
  75. <li class="tsd-kind-class tsd-is-external"><a href="classes/stream.html" class="tsd-kind-icon">Stream</a></li>
  76. <li class="tsd-kind-class tsd-is-external"><a href="classes/user.html" class="tsd-kind-icon">User</a></li>
  77. </ul>
  78. </section>
  79. <section class="tsd-index-section tsd-is-external">
  80. <h3>Interfaces</h3>
  81. <ul class="tsd-index-list">
  82. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/audiostats.html" class="tsd-kind-icon">Audio<wbr>Stats</a></li>
  83. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/clientoptions.html" class="tsd-kind-icon">Client<wbr>Options</a></li>
  84. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/clientplugin.html" class="tsd-kind-icon">Client<wbr>Plugin</a></li>
  85. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/connectionstates.html" class="tsd-kind-icon">Connection<wbr>States</a></li>
  86. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/customvideoprofile.html" class="tsd-kind-icon">Custom<wbr>Video<wbr>Profile</a></li>
  87. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/devicedetectionoptions.html" class="tsd-kind-icon">Device<wbr>Detection<wbr>Options</a></li>
  88. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/joinoptions.html" class="tsd-kind-icon">Join<wbr>Options</a></li>
  89. <li class="tsd-kind-interface tsd-has-type-parameter tsd-is-external"><a href="interfaces/listener.html" class="tsd-kind-icon">Listener</a></li>
  90. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/localstreamoptions.html" class="tsd-kind-icon">Local<wbr>Stream<wbr>Options</a></li>
  91. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/networkstats.html" class="tsd-kind-icon">Network<wbr>Stats</a></li>
  92. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/playoptions.html" class="tsd-kind-icon">Play<wbr>Options</a></li>
  93. <li class="tsd-kind-interface tsd-has-type-parameter tsd-is-external"><a href="interfaces/rtcevent.html" class="tsd-kind-icon">Rtc<wbr>Event</a></li>
  94. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/serverconfig.html" class="tsd-kind-icon">Server<wbr>Config</a></li>
  95. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/streamplugin.html" class="tsd-kind-icon">Stream<wbr>Plugin</a></li>
  96. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/streamstats.html" class="tsd-kind-icon">Stream<wbr>Stats</a></li>
  97. <li class="tsd-kind-interface tsd-is-external"><a href="interfaces/videostats.html" class="tsd-kind-icon">Video<wbr>Stats</a></li>
  98. </ul>
  99. </section>
  100. <section class="tsd-index-section tsd-is-external">
  101. <h3>Type aliases</h3>
  102. <ul class="tsd-index-list">
  103. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#audiocodec" class="tsd-kind-icon">Audio<wbr>Codec</a></li>
  104. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#connectionstate" class="tsd-kind-icon">Connection<wbr>State</a></li>
  105. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#errorcode" class="tsd-kind-icon">Error<wbr>Code</a></li>
  106. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#loglevel" class="tsd-kind-icon">Log<wbr>Level</a></li>
  107. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#mediatype" class="tsd-kind-icon">Media<wbr>Type</a></li>
  108. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#playervideofittype" class="tsd-kind-icon">Player<wbr>Video<wbr>Fit<wbr>Type</a></li>
  109. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#roletype" class="tsd-kind-icon">Role<wbr>Type</a></li>
  110. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#roomtype" class="tsd-kind-icon">Room<wbr>Type</a></li>
  111. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcconnectionevent" class="tsd-kind-icon">Rtc<wbr>Connection<wbr>Event</a></li>
  112. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcconnectioneventtype" class="tsd-kind-icon">Rtc<wbr>Connection<wbr>Event<wbr>Type</a></li>
  113. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtceventtype" class="tsd-kind-icon">Rtc<wbr>Event<wbr>Type</a></li>
  114. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcstreamevent" class="tsd-kind-icon">Rtc<wbr>Stream<wbr>Event</a></li>
  115. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcstreameventtype" class="tsd-kind-icon">Rtc<wbr>Stream<wbr>Event<wbr>Type</a></li>
  116. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcuserevent" class="tsd-kind-icon">Rtc<wbr>User<wbr>Event</a></li>
  117. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#rtcusereventtype" class="tsd-kind-icon">Rtc<wbr>User<wbr>Event<wbr>Type</a></li>
  118. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#screenprofile" class="tsd-kind-icon">Screen<wbr>Profile</a></li>
  119. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#switchdevicetype" class="tsd-kind-icon">Switch<wbr>Device<wbr>Type</a></li>
  120. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#videocodec" class="tsd-kind-icon">Video<wbr>Codec</a></li>
  121. <li class="tsd-kind-type-alias tsd-is-external"><a href="index.html#videoprofile" class="tsd-kind-icon">Video<wbr>Profile</a></li>
  122. </ul>
  123. </section>
  124. <section class="tsd-index-section tsd-is-external">
  125. <h3>Variables</h3>
  126. <ul class="tsd-index-list">
  127. <li class="tsd-kind-variable tsd-is-external"><a href="index.html#version" class="tsd-kind-icon">version</a></li>
  128. </ul>
  129. </section>
  130. <section class="tsd-index-section ">
  131. <h3>Functions</h3>
  132. <ul class="tsd-index-list">
  133. <li class="tsd-kind-function"><a href="index.html#createclient" class="tsd-kind-icon">create<wbr>Client</a></li>
  134. <li class="tsd-kind-function"><a href="index.html#createstream" class="tsd-kind-icon">create<wbr>Stream</a></li>
  135. <li class="tsd-kind-function tsd-is-external"><a href="index.html#devicedetection" class="tsd-kind-icon">device<wbr>Detection</a></li>
  136. <li class="tsd-kind-function tsd-is-external"><a href="index.html#generatetoken" class="tsd-kind-icon">generate<wbr>Token</a></li>
  137. <li class="tsd-kind-function tsd-is-external"><a href="index.html#getcameras" class="tsd-kind-icon">get<wbr>Cameras</a></li>
  138. <li class="tsd-kind-function tsd-is-external"><a href="index.html#getdevices" class="tsd-kind-icon">get<wbr>Devices</a></li>
  139. <li class="tsd-kind-function tsd-is-external"><a href="index.html#getloudspeakers" class="tsd-kind-icon">get<wbr>Loudspeakers</a></li>
  140. <li class="tsd-kind-function tsd-is-external"><a href="index.html#getmicrophones" class="tsd-kind-icon">get<wbr>Microphones</a></li>
  141. <li class="tsd-kind-function tsd-is-external"><a href="index.html#issupportscreenshare" class="tsd-kind-icon">is<wbr>Support<wbr>Screen<wbr>Share</a></li>
  142. <li class="tsd-kind-function tsd-is-external"><a href="index.html#issupportwebrtc" class="tsd-kind-icon">is<wbr>Support<wbr>WebRTC</a></li>
  143. <li class="tsd-kind-function"><a href="index.html#reportlog" class="tsd-kind-icon">report<wbr>Log</a></li>
  144. <li class="tsd-kind-function"><a href="index.html#setloglevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a></li>
  145. <li class="tsd-kind-function tsd-is-external"><a href="index.html#setservers" class="tsd-kind-icon">set<wbr>Servers</a></li>
  146. </ul>
  147. </section>
  148. </div>
  149. </section>
  150. </section>
  151. <section class="tsd-panel-group tsd-member-group tsd-is-external">
  152. <h2>Type aliases</h2>
  153. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  154. <a name="audiocodec" class="tsd-anchor"></a>
  155. <h3>Audio<wbr>Codec</h3>
  156. <div class="tsd-signature tsd-kind-icon">Audio<wbr>Codec<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"opus"</span></div>
  157. <aside class="tsd-sources">
  158. </aside>
  159. <div class="tsd-comment tsd-typography">
  160. <div class="lead">
  161. <p>音频编解码格式</p>
  162. </div>
  163. </div>
  164. </section>
  165. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  166. <a name="connectionstate" class="tsd-anchor"></a>
  167. <h3>Connection<wbr>State</h3>
  168. <div class="tsd-signature tsd-kind-icon">Connection<wbr>State<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"OPEN"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"CONNECTING"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"CLOSING"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"RECONNECTING"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"CLOSED"</span></div>
  169. <aside class="tsd-sources">
  170. </aside>
  171. <div class="tsd-comment tsd-typography">
  172. <div class="lead">
  173. <p>连接状态类型:</p>
  174. <ul>
  175. <li>OPEN - 已连接</li>
  176. <li>CONNECTING - 连接中</li>
  177. <li>CLOSING - 断开中</li>
  178. <li>RECONNECTING - 重连中</li>
  179. <li>CLOSED - 已断开</li>
  180. </ul>
  181. </div>
  182. </div>
  183. </section>
  184. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  185. <a name="errorcode" class="tsd-anchor"></a>
  186. <h3>Error<wbr>Code</h3>
  187. <div class="tsd-signature tsd-kind-icon">Error<wbr>Code<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">typeof </span><span class="tsd-signature-type">RtcError</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">Exclude</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">keyof </span><span class="tsd-signature-symbol">typeof </span><span class="tsd-signature-type">RtcError</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"prototype"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"getCode"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"stackTraceLimit"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"prepareStackTrace"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"captureStackTrace"</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">]</span></div>
  188. <aside class="tsd-sources">
  189. </aside>
  190. <div class="tsd-comment tsd-typography">
  191. <div class="lead">
  192. <p>URTC 错误代码</p>
  193. </div>
  194. <p>通用错误及代码</p>
  195. <ul>
  196. <li>1000 - 非法参数</li>
  197. <li>1001 - 非法操作</li>
  198. <li>1002 - 不支持</li>
  199. <li>1003 - 不存在</li>
  200. <li>1004 - 请求失败</li>
  201. <li>1999 - 其他错误</li>
  202. </ul>
  203. <p>房间相关错误及代码</p>
  204. <ul>
  205. <li>2000 - 网关不可达</li>
  206. <li>2001 - 获取 Access Token 失败</li>
  207. <li>2002 - Access Token 非法</li>
  208. <li>2003 - Websocket 连接失败</li>
  209. <li>2004 - 加入房间失败</li>
  210. <li>2005 - 未加入房间</li>
  211. <li>2006 - 正在加入房间</li>
  212. <li>2007 - 正在离开房间</li>
  213. <li>2008 - 角色类型不匹配</li>
  214. <li>2009 - 信令服务器地址错误</li>
  215. </ul>
  216. <p>流相关错误及代码</p>
  217. <ul>
  218. <li>3000 - 流不存在</li>
  219. <li>3001 - 同类型的流已存在</li>
  220. <li>3002 - 音频不存在</li>
  221. <li>3003 - 视频不存在</li>
  222. <li>3004 - [中止错误] 尽管用户和操作系统都授予了访问设备硬件的权利,而且未出现可能抛出NotReadableError异常的硬件问题,但仍然有一些问题的出现导致了设备无法被使用。</li>
  223. <li>3005 - [拒绝错误] 用户拒绝了当前的浏览器实例的访问请求;或者用户拒绝了当前会话的访问;或者用户在全局范围内拒绝了所有媒体访问请求。</li>
  224. <li>3006 - [找不到错误] 找不到满足请求参数的媒体类型。</li>
  225. <li>3007 - [无法读取错误] 尽管用户已经授权使用相应的设备,操作系统上某个硬件、浏览器或者网页层面发生的错误导致设备无法被访问。</li>
  226. <li>3008 - [无法满足要求错误] 指定的要求无法被设备满足。</li>
  227. <li>3009 - 流连接失败</li>
  228. <li>3010 - 流正在重连</li>
  229. <li>3011 - 流尚未发布</li>
  230. <li>3012 - 流正在发布</li>
  231. <li>3013 - 流正在取消发布</li>
  232. <li>3014 - 流已经发布</li>
  233. <li>3015 - 流尚未订阅</li>
  234. <li>3016 - 流正在订阅</li>
  235. <li>3017 - 流正在取消订阅</li>
  236. <li>3018 - 流已经订阅</li>
  237. <li>3019 - 自动播放被禁止错误</li>
  238. </ul>
  239. </div>
  240. </section>
  241. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  242. <a name="loglevel" class="tsd-anchor"></a>
  243. <h3>Log<wbr>Level</h3>
  244. <div class="tsd-signature tsd-kind-icon">Log<wbr>Level<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"debug"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"info"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"warn"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"error"</span></div>
  245. <aside class="tsd-sources">
  246. </aside>
  247. <div class="tsd-comment tsd-typography">
  248. <div class="lead">
  249. <p>日志级别</p>
  250. </div>
  251. </div>
  252. </section>
  253. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  254. <a name="mediatype" class="tsd-anchor"></a>
  255. <h3>Media<wbr>Type</h3>
  256. <div class="tsd-signature tsd-kind-icon">Media<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"main"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"auxiliary"</span></div>
  257. <aside class="tsd-sources">
  258. </aside>
  259. <div class="tsd-comment tsd-typography">
  260. <div class="lead">
  261. <p>流的媒体类型, main - 主视频流,auxiliary - 辅助视频流,通常是一个屏幕分享流</p>
  262. </div>
  263. </div>
  264. </section>
  265. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  266. <a name="playervideofittype" class="tsd-anchor"></a>
  267. <h3>Player<wbr>Video<wbr>Fit<wbr>Type</h3>
  268. <div class="tsd-signature tsd-kind-icon">Player<wbr>Video<wbr>Fit<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"cover"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"contain"</span></div>
  269. <aside class="tsd-sources">
  270. </aside>
  271. <div class="tsd-comment tsd-typography">
  272. <div class="lead">
  273. <p>视频播放时的显示模式</p>
  274. <ul>
  275. <li>cover 模式:优先保证视窗被填满。</li>
  276. <li>contain 模式:优先保证视频内容全部显示。
  277. 播放摄像头视频流默认使用 cover 模式,屏幕共享视频流默认使用 contain 模式。</li>
  278. </ul>
  279. </div>
  280. </div>
  281. </section>
  282. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  283. <a name="roletype" class="tsd-anchor"></a>
  284. <h3>Role<wbr>Type</h3>
  285. <div class="tsd-signature tsd-kind-icon">Role<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"pull"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"push"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"push-and-pull"</span></div>
  286. <aside class="tsd-sources">
  287. </aside>
  288. <div class="tsd-comment tsd-typography">
  289. <div class="lead">
  290. <p>用户角色</p>
  291. </div>
  292. </div>
  293. </section>
  294. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  295. <a name="roomtype" class="tsd-anchor"></a>
  296. <h3>Room<wbr>Type</h3>
  297. <div class="tsd-signature tsd-kind-icon">Room<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"rtc"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"live"</span></div>
  298. <aside class="tsd-sources">
  299. </aside>
  300. <div class="tsd-comment tsd-typography">
  301. <div class="lead">
  302. <p>房间类型</p>
  303. </div>
  304. </div>
  305. </section>
  306. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  307. <a name="rtcconnectionevent" class="tsd-anchor"></a>
  308. <h3>Rtc<wbr>Connection<wbr>Event</h3>
  309. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>Connection<wbr>Event<span class="tsd-signature-symbol">:</span> <a href="interfaces/rtcevent.html" class="tsd-signature-type">RtcEvent</a><span class="tsd-signature-symbol">&lt;</span><a href="index.html#rtcconnectioneventtype" class="tsd-signature-type">RtcConnectionEventType</a><span class="tsd-signature-symbol">, </span><a href="interfaces/connectionstates.html" class="tsd-signature-type">ConnectionStates</a><span class="tsd-signature-symbol">&gt;</span></div>
  310. <aside class="tsd-sources">
  311. </aside>
  312. <div class="tsd-comment tsd-typography">
  313. <div class="lead">
  314. <p>Rtc 连接事件,事件类型参见 <a href="index.html#rtcconnectioneventtype">RtcConnectionEventType</a></p>
  315. </div>
  316. </div>
  317. </section>
  318. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  319. <a name="rtcconnectioneventtype" class="tsd-anchor"></a>
  320. <h3>Rtc<wbr>Connection<wbr>Event<wbr>Type</h3>
  321. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>Connection<wbr>Event<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"connection-state-changed"</span></div>
  322. <aside class="tsd-sources">
  323. </aside>
  324. <div class="tsd-comment tsd-typography">
  325. <div class="lead">
  326. <p>Rtc 客户端连接事件类型:</p>
  327. </div>
  328. <p><a href="index.html#rtcconnectionevent">连接事件</a></p>
  329. <ul>
  330. <li>connection-state-changed - 连接状态改变</li>
  331. </ul>
  332. <dl class="tsd-comment-tags">
  333. <dt>example</dt>
  334. <dd><pre><code class="language-js">client.on(<span class="hljs-string">&#x27;connection-state-changed&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
  335. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`连接状态:<span class="hljs-subst">${event.data.previous}</span> =&gt; <span class="hljs-subst">${event.data.current}</span>`</span>);
  336. });</code></pre>
  337. </dd>
  338. </dl>
  339. </div>
  340. </section>
  341. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  342. <a name="rtceventtype" class="tsd-anchor"></a>
  343. <h3>Rtc<wbr>Event<wbr>Type</h3>
  344. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>Event<wbr>Type<span class="tsd-signature-symbol">:</span> <a href="index.html#rtcusereventtype" class="tsd-signature-type">RtcUserEventType</a><span class="tsd-signature-symbol"> | </span><a href="index.html#rtcstreameventtype" class="tsd-signature-type">RtcStreamEventType</a><span class="tsd-signature-symbol"> | </span><a href="index.html#rtcconnectioneventtype" class="tsd-signature-type">RtcConnectionEventType</a></div>
  345. <aside class="tsd-sources">
  346. </aside>
  347. <div class="tsd-comment tsd-typography">
  348. <div class="lead">
  349. <p>Rtc 事件类型</p>
  350. </div>
  351. </div>
  352. </section>
  353. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  354. <a name="rtcstreamevent" class="tsd-anchor"></a>
  355. <h3>Rtc<wbr>Stream<wbr>Event</h3>
  356. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>Stream<wbr>Event<span class="tsd-signature-symbol">:</span> <a href="interfaces/rtcevent.html" class="tsd-signature-type">RtcEvent</a><span class="tsd-signature-symbol">&lt;</span><a href="index.html#rtcstreameventtype" class="tsd-signature-type">RtcStreamEventType</a><span class="tsd-signature-symbol">, </span><a href="classes/stream.html" class="tsd-signature-type">Stream</a><span class="tsd-signature-symbol"> | </span><a href="classes/localstream.html" class="tsd-signature-type">LocalStream</a><span class="tsd-signature-symbol"> | </span><a href="classes/remotestream.html" class="tsd-signature-type">RemoteStream</a><span class="tsd-signature-symbol">&gt;</span></div>
  357. <aside class="tsd-sources">
  358. </aside>
  359. <div class="tsd-comment tsd-typography">
  360. <div class="lead">
  361. <p>Rtc 流事件,事件类型参见 <a href="index.html#rtcstreameventtype">RtcStreamEventType</a></p>
  362. </div>
  363. </div>
  364. </section>
  365. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  366. <a name="rtcstreameventtype" class="tsd-anchor"></a>
  367. <h3>Rtc<wbr>Stream<wbr>Event<wbr>Type</h3>
  368. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>Stream<wbr>Event<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"stream-added"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"stream-removed"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"stream-subscribed"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"stream-published"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"mute-audio"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"unmute-audio"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"mute-video"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"unmute-video"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"first-key-frame"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"screenshare-stopped"</span></div>
  369. <aside class="tsd-sources">
  370. </aside>
  371. <div class="tsd-comment tsd-typography">
  372. <div class="lead">
  373. <p>Rtc 流事件类型:</p>
  374. </div>
  375. <p><a href="index.html#rtcstreamevent">流事件</a></p>
  376. <ul>
  377. <li>stream-added - 有远端流加入,此时事件中的 data 为 <a href="classes/remotestream.html">RemoteStream</a> 远端流</li>
  378. <li>stream-removed - 有远端流移除,此时事件中的 data 为 <a href="classes/remotestream.html">RemoteStream</a> 远端流</li>
  379. <li>stream-subscribed - 远端流订阅完成,此时事件中的 data 为 <a href="classes/remotestream.html">RemoteStream</a> 远端流</li>
  380. <li>stream-published - 本地流发布完成,此时事件中的 data 为 <a href="classes/localstream.html">LocalStream</a> 本地流</li>
  381. <li>mute-audio - 流的音频被 mute</li>
  382. <li>unmute-audio - 流的音频被取消 mute</li>
  383. <li>mute-video - 流的视频被 mute</li>
  384. <li>unmute-video - 流的视频被取消 mute</li>
  385. <li>first-key-frame - 接收到远端流的首帧</li>
  386. </ul>
  387. <dl class="tsd-comment-tags">
  388. <dt>example</dt>
  389. <dd><pre><code class="language-js">client.on(<span class="hljs-string">&#x27;stream-add&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
  390. client.subscribe(event.data);
  391. });</code></pre>
  392. <p><strong>特别地,以下事件需在单条流上进行监听</strong></p>
  393. <ul>
  394. <li>screenshare-stopped - 屏幕共享流被中止,此时事件中的 data 为 <a href="classes/localstream.html">LocalStream</a> 本地流</li>
  395. </ul>
  396. </dd>
  397. <dt>example</dt>
  398. <dd><pre><code class="language-js">localStream.on(<span class="hljs-string">&#x27;screenshare-stopped&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
  399. client.unpublish(event.data);
  400. event.data.destroy();
  401. });</code></pre>
  402. </dd>
  403. </dl>
  404. </div>
  405. </section>
  406. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  407. <a name="rtcuserevent" class="tsd-anchor"></a>
  408. <h3>Rtc<wbr>User<wbr>Event</h3>
  409. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>User<wbr>Event<span class="tsd-signature-symbol">:</span> <a href="interfaces/rtcevent.html" class="tsd-signature-type">RtcEvent</a><span class="tsd-signature-symbol">&lt;</span><a href="index.html#rtcusereventtype" class="tsd-signature-type">RtcUserEventType</a><span class="tsd-signature-symbol">, </span><a href="classes/user.html" class="tsd-signature-type">User</a><span class="tsd-signature-symbol">&gt;</span></div>
  410. <aside class="tsd-sources">
  411. </aside>
  412. <div class="tsd-comment tsd-typography">
  413. <div class="lead">
  414. <p>Rtc 用户事件,事件类型参见 <a href="index.html#rtcusereventtype">RtcUserEventType</a></p>
  415. </div>
  416. </div>
  417. </section>
  418. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  419. <a name="rtcusereventtype" class="tsd-anchor"></a>
  420. <h3>Rtc<wbr>User<wbr>Event<wbr>Type</h3>
  421. <div class="tsd-signature tsd-kind-icon">Rtc<wbr>User<wbr>Event<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"user-joined"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"user-left"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"kick-off"</span></div>
  422. <aside class="tsd-sources">
  423. </aside>
  424. <div class="tsd-comment tsd-typography">
  425. <div class="lead">
  426. <p>Rtc 用户事件类型:</p>
  427. </div>
  428. <p><a href="index.html#rtcuserevent">用户事件</a></p>
  429. <ul>
  430. <li>user-joined - 有用户加入房间</li>
  431. <li>user-left - 有用户离开房间</li>
  432. <li>kick-off - 当前用户被踢出房间</li>
  433. </ul>
  434. <dl class="tsd-comment-tags">
  435. <dt>example</dt>
  436. <dd><pre><code class="language-js">client.on(<span class="hljs-string">&#x27;user-joined&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
  437. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`用户 <span class="hljs-subst">${event.data.id}</span> 加入`</span>);
  438. });</code></pre>
  439. </dd>
  440. </dl>
  441. </div>
  442. </section>
  443. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  444. <a name="screenprofile" class="tsd-anchor"></a>
  445. <h3>Screen<wbr>Profile</h3>
  446. <div class="tsd-signature tsd-kind-icon">Screen<wbr>Profile<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"480p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"480p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"720p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"720p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"1080p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"1080p_2"</span></div>
  447. <aside class="tsd-sources">
  448. </aside>
  449. <div class="tsd-comment tsd-typography">
  450. <div class="lead">
  451. <p>预设的屏幕共享视频 Profile</p>
  452. </div>
  453. <table>
  454. <thead>
  455. <tr>
  456. <th align="center">名称</th>
  457. <th align="center">视频宽</th>
  458. <th align="center">视频高</th>
  459. <th align="center">帧率 (fps)</th>
  460. <th align="center">码率 (kbps)</th>
  461. </tr>
  462. </thead>
  463. <tbody><tr>
  464. <td align="center">480p</td>
  465. <td align="center">640</td>
  466. <td align="center">480</td>
  467. <td align="center">5</td>
  468. <td align="center">600</td>
  469. </tr>
  470. <tr>
  471. <td align="center">480p_2</td>
  472. <td align="center">640</td>
  473. <td align="center">480</td>
  474. <td align="center">30</td>
  475. <td align="center">1000</td>
  476. </tr>
  477. <tr>
  478. <td align="center">720p</td>
  479. <td align="center">1280</td>
  480. <td align="center">720</td>
  481. <td align="center">5</td>
  482. <td align="center">1000</td>
  483. </tr>
  484. <tr>
  485. <td align="center">720p_2</td>
  486. <td align="center">1280</td>
  487. <td align="center">720</td>
  488. <td align="center">30</td>
  489. <td align="center">2000</td>
  490. </tr>
  491. <tr>
  492. <td align="center">1080p</td>
  493. <td align="center">1920</td>
  494. <td align="center">1080</td>
  495. <td align="center">5</td>
  496. <td align="center">1500</td>
  497. </tr>
  498. <tr>
  499. <td align="center">1080p_2</td>
  500. <td align="center">1920</td>
  501. <td align="center">1080</td>
  502. <td align="center">30</td>
  503. <td align="center">2500</td>
  504. </tr>
  505. </tbody></table>
  506. </div>
  507. </section>
  508. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  509. <a name="switchdevicetype" class="tsd-anchor"></a>
  510. <h3>Switch<wbr>Device<wbr>Type</h3>
  511. <div class="tsd-signature tsd-kind-icon">Switch<wbr>Device<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"audio"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"video"</span></div>
  512. <aside class="tsd-sources">
  513. </aside>
  514. <div class="tsd-comment tsd-typography">
  515. <div class="lead">
  516. <p>切换设备的类型</p>
  517. </div>
  518. </div>
  519. </section>
  520. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  521. <a name="videocodec" class="tsd-anchor"></a>
  522. <h3>Video<wbr>Codec</h3>
  523. <div class="tsd-signature tsd-kind-icon">Video<wbr>Codec<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"vp8"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"h264"</span></div>
  524. <aside class="tsd-sources">
  525. </aside>
  526. <div class="tsd-comment tsd-typography">
  527. <div class="lead">
  528. <p>视频编解码格式</p>
  529. </div>
  530. </div>
  531. </section>
  532. <section class="tsd-panel tsd-member tsd-kind-type-alias tsd-is-external">
  533. <a name="videoprofile" class="tsd-anchor"></a>
  534. <h3>Video<wbr>Profile</h3>
  535. <div class="tsd-signature tsd-kind-icon">Video<wbr>Profile<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"180p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"180p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"240p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"360p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"360p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"480p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"720p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"720p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"720p_3"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"1080p"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"1080p_2"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"1080p_3"</span></div>
  536. <aside class="tsd-sources">
  537. </aside>
  538. <div class="tsd-comment tsd-typography">
  539. <div class="lead">
  540. <p>预设的视频 Profile</p>
  541. </div>
  542. <table>
  543. <thead>
  544. <tr>
  545. <th align="center">名称</th>
  546. <th align="center">视频宽</th>
  547. <th align="center">视频高</th>
  548. <th align="center">帧率 (fps)</th>
  549. <th align="center">码率 (kbps)</th>
  550. </tr>
  551. </thead>
  552. <tbody><tr>
  553. <td align="center">180p</td>
  554. <td align="center">240</td>
  555. <td align="center">180</td>
  556. <td align="center">15</td>
  557. <td align="center">200</td>
  558. </tr>
  559. <tr>
  560. <td align="center">180p_2</td>
  561. <td align="center">320</td>
  562. <td align="center">180</td>
  563. <td align="center">15</td>
  564. <td align="center">300</td>
  565. </tr>
  566. <tr>
  567. <td align="center">240p</td>
  568. <td align="center">320</td>
  569. <td align="center">240</td>
  570. <td align="center">15</td>
  571. <td align="center">400</td>
  572. </tr>
  573. <tr>
  574. <td align="center">360p</td>
  575. <td align="center">480</td>
  576. <td align="center">360</td>
  577. <td align="center">15</td>
  578. <td align="center">400</td>
  579. </tr>
  580. <tr>
  581. <td align="center">360p_2</td>
  582. <td align="center">640</td>
  583. <td align="center">360</td>
  584. <td align="center">15</td>
  585. <td align="center">500</td>
  586. </tr>
  587. <tr>
  588. <td align="center">480p</td>
  589. <td align="center">640</td>
  590. <td align="center">480</td>
  591. <td align="center">15</td>
  592. <td align="center">600</td>
  593. </tr>
  594. <tr>
  595. <td align="center">720p</td>
  596. <td align="center">1280</td>
  597. <td align="center">720</td>
  598. <td align="center">15</td>
  599. <td align="center">1000</td>
  600. </tr>
  601. <tr>
  602. <td align="center">720p_2</td>
  603. <td align="center">1280</td>
  604. <td align="center">720</td>
  605. <td align="center">15</td>
  606. <td align="center">1500</td>
  607. </tr>
  608. <tr>
  609. <td align="center">720p_3</td>
  610. <td align="center">1280</td>
  611. <td align="center">720</td>
  612. <td align="center">30</td>
  613. <td align="center">2000</td>
  614. </tr>
  615. <tr>
  616. <td align="center">1080p</td>
  617. <td align="center">1920</td>
  618. <td align="center">1080</td>
  619. <td align="center">15</td>
  620. <td align="center">1500</td>
  621. </tr>
  622. <tr>
  623. <td align="center">1080p_2</td>
  624. <td align="center">1920</td>
  625. <td align="center">1080</td>
  626. <td align="center">15</td>
  627. <td align="center">2000</td>
  628. </tr>
  629. <tr>
  630. <td align="center">1080p_3</td>
  631. <td align="center">1920</td>
  632. <td align="center">1080</td>
  633. <td align="center">30</td>
  634. <td align="center">2500</td>
  635. </tr>
  636. </tbody></table>
  637. </div>
  638. </section>
  639. </section>
  640. <section class="tsd-panel-group tsd-member-group tsd-is-external">
  641. <h2>Variables</h2>
  642. <section class="tsd-panel tsd-member tsd-kind-variable tsd-is-external">
  643. <a name="version" class="tsd-anchor"></a>
  644. <h3><span class="tsd-flag ts-flagConst">Const</span> version</h3>
  645. <div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = __VERSION__</span></div>
  646. <aside class="tsd-sources">
  647. </aside>
  648. <div class="tsd-comment tsd-typography">
  649. <div class="lead">
  650. <p>当前 sdk 的版本号</p>
  651. </div>
  652. </div>
  653. </section>
  654. </section>
  655. <section class="tsd-panel-group tsd-member-group ">
  656. <h2>Functions</h2>
  657. <section class="tsd-panel tsd-member tsd-kind-function">
  658. <a name="createclient" class="tsd-anchor"></a>
  659. <h3>create<wbr>Client</h3>
  660. <ul class="tsd-signatures tsd-kind-function">
  661. <li class="tsd-signature tsd-kind-icon">create<wbr>Client<span class="tsd-signature-symbol">(</span>appId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><a href="interfaces/clientoptions.html" class="tsd-signature-type">ClientOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="classes/client.html" class="tsd-signature-type">Client</a></li>
  662. </ul>
  663. <ul class="tsd-descriptions">
  664. <li class="tsd-description">
  665. <aside class="tsd-sources">
  666. </aside>
  667. <div class="tsd-comment tsd-typography">
  668. <div class="lead">
  669. <p>创建客户端</p>
  670. </div>
  671. <dl class="tsd-comment-tags">
  672. <dt>example</dt>
  673. <dd><pre><code class="language-js"><span class="hljs-keyword">const</span> client = createClient(<span class="hljs-string">&#x27;AppID&#x27;</span>);
  674. client
  675. .join(<span class="hljs-string">&#x27;roomId&#x27;</span>, <span class="hljs-string">&#x27;userId&#x27;</span>, <span class="hljs-string">&#x27;token&#x27;</span>)
  676. .then(<span class="hljs-function">() =&gt;</span> {
  677. client.publish(localStream);
  678. })
  679. .catch(<span class="hljs-function">(<span class="hljs-params">err</span>) =&gt;</span> {
  680. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`加入房间失败 <span class="hljs-subst">${err}</span>`</span>);
  681. });</code></pre>
  682. </dd>
  683. <dt>throws</dt>
  684. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  685. </dd>
  686. </dl>
  687. </div>
  688. <h4 class="tsd-parameters-title">Parameters</h4>
  689. <ul class="tsd-parameters">
  690. <li>
  691. <h5>appId: <span class="tsd-signature-type">string</span></h5>
  692. <div class="tsd-comment tsd-typography">
  693. <p>应用 ID,可在控制台查看</p>
  694. </div>
  695. </li>
  696. <li>
  697. <h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <a href="interfaces/clientoptions.html" class="tsd-signature-type">ClientOptions</a></h5>
  698. <div class="tsd-comment tsd-typography">
  699. <p>定义客户端的属性</p>
  700. </div>
  701. </li>
  702. </ul>
  703. <h4 class="tsd-returns-title">Returns <a href="classes/client.html" class="tsd-signature-type">Client</a></h4>
  704. </li>
  705. </ul>
  706. </section>
  707. <section class="tsd-panel tsd-member tsd-kind-function">
  708. <a name="createstream" class="tsd-anchor"></a>
  709. <h3>create<wbr>Stream</h3>
  710. <ul class="tsd-signatures tsd-kind-function">
  711. <li class="tsd-signature tsd-kind-icon">create<wbr>Stream<span class="tsd-signature-symbol">(</span>opts<span class="tsd-signature-symbol">: </span><a href="interfaces/localstreamoptions.html" class="tsd-signature-type">LocalStreamOptions</a>, id<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="classes/localstream.html" class="tsd-signature-type">LocalStream</a></li>
  712. </ul>
  713. <ul class="tsd-descriptions">
  714. <li class="tsd-description">
  715. <aside class="tsd-sources">
  716. </aside>
  717. <div class="tsd-comment tsd-typography">
  718. <div class="lead">
  719. <p>创建本地流</p>
  720. </div>
  721. <dl class="tsd-comment-tags">
  722. <dt>example</dt>
  723. <dd><pre><code class="language-js"><span class="hljs-keyword">const</span> localStream = createStream({ <span class="hljs-attr">audio</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">video</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">screen</span>: <span class="hljs-literal">false</span> });
  724. localStream
  725. .init()
  726. .then(<span class="hljs-function">() =&gt;</span> {
  727. localStream
  728. .play(container)
  729. .catch(<span class="hljs-function">(<span class="hljs-params">err</span>) =&gt;</span> {<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`播放失败: <span class="hljs-subst">${err}</span>`</span>)});
  730. })
  731. .catch(<span class="hljs-function">(<span class="hljs-params">err</span>) =&gt;</span> {
  732. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`本地流初始化失败 <span class="hljs-subst">${err}</span>`</span>);
  733. });</code></pre>
  734. </dd>
  735. <dt>throws</dt>
  736. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  737. </dd>
  738. </dl>
  739. </div>
  740. <h4 class="tsd-parameters-title">Parameters</h4>
  741. <ul class="tsd-parameters">
  742. <li>
  743. <h5>opts: <a href="interfaces/localstreamoptions.html" class="tsd-signature-type">LocalStreamOptions</a></h5>
  744. <div class="tsd-comment tsd-typography">
  745. <p>必传,定义本地音视频流的属性</p>
  746. <blockquote>
  747. <p>注:</p>
  748. <ol>
  749. <li>video, screen 不可同时为 true</li>
  750. <li>audio, video, screen 不可同时为 false</li>
  751. <li>若指定了 file,则 init 时将优先使用 file 来创建初始化本地流的视频</li>
  752. <li>screenAudio 在不同浏览器上表现不同,参见 <a href="interfaces/localstreamoptions.html">LocalStreamOptions</a></li>
  753. </ol>
  754. </blockquote>
  755. </div>
  756. </li>
  757. <li>
  758. <h5><span class="tsd-flag ts-flagOptional">Optional</span> id: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
  759. <div class="tsd-comment tsd-typography">
  760. <p>选传,指定本地流的 ID,请注意创建多条流时,不可传入重复值</p>
  761. </div>
  762. </li>
  763. </ul>
  764. <h4 class="tsd-returns-title">Returns <a href="classes/localstream.html" class="tsd-signature-type">LocalStream</a></h4>
  765. </li>
  766. </ul>
  767. </section>
  768. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  769. <a name="devicedetection" class="tsd-anchor"></a>
  770. <h3>device<wbr>Detection</h3>
  771. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  772. <li class="tsd-signature tsd-kind-icon">device<wbr>Detection<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><a href="interfaces/devicedetectionoptions.html" class="tsd-signature-type">DeviceDetectionOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
  773. </ul>
  774. <ul class="tsd-descriptions">
  775. <li class="tsd-description">
  776. <aside class="tsd-sources">
  777. </aside>
  778. <div class="tsd-comment tsd-typography">
  779. <div class="lead">
  780. <p>设备可用性检测 - 创建包含麦克风音频或摄像头视频的本地流时,有可能因为麦克风或摄像头设备问题(如驱动问题,或未经授权等),导致无法正确创建。此方法可用于设备检测,根据检测结果,再决定创建本地流时启用麦克风或摄像头或麦克风和摄像头</p>
  781. </div>
  782. <dl class="tsd-comment-tags">
  783. <dt>example</dt>
  784. <dd><pre><code class="language-js">deviceDetection({<span class="hljs-attr">audio</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">video</span>: <span class="hljs-literal">true</span>})
  785. .then(<span class="hljs-function">() =&gt;</span> {
  786. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;设备可用&#x27;</span>);
  787. })
  788. .catch(<span class="hljs-function"><span class="hljs-params">err</span> =&gt;</span> {
  789. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`设备不可用,<span class="hljs-subst">${err}</span>`</span>);
  790. });</code></pre>
  791. </dd>
  792. <dt>reject</dt>
  793. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  794. </dd>
  795. </dl>
  796. </div>
  797. <h4 class="tsd-parameters-title">Parameters</h4>
  798. <ul class="tsd-parameters">
  799. <li>
  800. <h5>options: <a href="interfaces/devicedetectionoptions.html" class="tsd-signature-type">DeviceDetectionOptions</a></h5>
  801. <div class="tsd-comment tsd-typography">
  802. <p>需指定设备时,请传入设备 ID</p>
  803. </div>
  804. </li>
  805. </ul>
  806. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
  807. </li>
  808. </ul>
  809. </section>
  810. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  811. <a name="generatetoken" class="tsd-anchor"></a>
  812. <h3>generate<wbr>Token</h3>
  813. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  814. <li class="tsd-signature tsd-kind-icon">generate<wbr>Token<span class="tsd-signature-symbol">(</span>appId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, appKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, roomId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, userId<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">string</span></li>
  815. </ul>
  816. <ul class="tsd-descriptions">
  817. <li class="tsd-description">
  818. <aside class="tsd-sources">
  819. </aside>
  820. <div class="tsd-comment tsd-typography">
  821. <div class="lead">
  822. <p>根据 AppId,AppKey,RoomId,UserId 生成 token,用于开发阶段临时快速的加入房间并验证功能,由于 AppKey 不可暴露于公网,因此生产环境中不建议使用此方法生成 token。</p>
  823. </div>
  824. <dl class="tsd-comment-tags">
  825. <dt>example</dt>
  826. <dd><pre><code class="language-js"><span class="hljs-keyword">const</span> token = generateToken(<span class="hljs-string">&#x27;urtc-xxx&#x27;</span>, <span class="hljs-string">&#x27;yyy&#x27;</span>, <span class="hljs-string">&#x27;roomId&#x27;</span>, <span class="hljs-string">&#x27;userId&#x27;</span>);
  827. client.join(<span class="hljs-string">&#x27;roomId&#x27;</span>, <span class="hljs-string">&#x27;userId&#x27;</span>, token);</code></pre>
  828. </dd>
  829. </dl>
  830. </div>
  831. <h4 class="tsd-parameters-title">Parameters</h4>
  832. <ul class="tsd-parameters">
  833. <li>
  834. <h5>appId: <span class="tsd-signature-type">string</span></h5>
  835. <div class="tsd-comment tsd-typography">
  836. <p>应用 ID,可在控制台查看</p>
  837. </div>
  838. </li>
  839. <li>
  840. <h5>appKey: <span class="tsd-signature-type">string</span></h5>
  841. <div class="tsd-comment tsd-typography">
  842. <p>应用密钥,可在控制台查看</p>
  843. </div>
  844. </li>
  845. <li>
  846. <h5>roomId: <span class="tsd-signature-type">string</span></h5>
  847. <div class="tsd-comment tsd-typography">
  848. <p>房间 ID</p>
  849. </div>
  850. </li>
  851. <li>
  852. <h5>userId: <span class="tsd-signature-type">string</span></h5>
  853. <div class="tsd-comment tsd-typography">
  854. <p>用户 ID</p>
  855. </div>
  856. </li>
  857. </ul>
  858. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
  859. </li>
  860. </ul>
  861. </section>
  862. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  863. <a name="getcameras" class="tsd-anchor"></a>
  864. <h3>get<wbr>Cameras</h3>
  865. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  866. <li class="tsd-signature tsd-kind-icon">get<wbr>Cameras<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li>
  867. </ul>
  868. <ul class="tsd-descriptions">
  869. <li class="tsd-description">
  870. <aside class="tsd-sources">
  871. </aside>
  872. <div class="tsd-comment tsd-typography">
  873. <div class="lead">
  874. <p>获取摄像头设备列表,点击 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo">MediaDeviceInfo</a> 查看详情</p>
  875. </div>
  876. <dl class="tsd-comment-tags">
  877. <dt>example</dt>
  878. <dd><pre><code class="language-js">getCameras()
  879. .then(<span class="hljs-function"><span class="hljs-params">devices</span> =&gt;</span> {
  880. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表成功:`</span>, devices);
  881. })
  882. .catch(<span class="hljs-function"><span class="hljs-params">err</span> =&gt;</span> {
  883. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表失败:<span class="hljs-subst">${err}</span>`</span>);
  884. });</code></pre>
  885. </dd>
  886. <dt>reject</dt>
  887. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  888. </dd>
  889. </dl>
  890. </div>
  891. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
  892. </li>
  893. </ul>
  894. </section>
  895. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  896. <a name="getdevices" class="tsd-anchor"></a>
  897. <h3>get<wbr>Devices</h3>
  898. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  899. <li class="tsd-signature tsd-kind-icon">get<wbr>Devices<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li>
  900. </ul>
  901. <ul class="tsd-descriptions">
  902. <li class="tsd-description">
  903. <aside class="tsd-sources">
  904. </aside>
  905. <div class="tsd-comment tsd-typography">
  906. <div class="lead">
  907. <p>获取音视频输入/输出设备列表,点击 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo">MediaDeviceInfo</a> 查看详情</p>
  908. </div>
  909. <dl class="tsd-comment-tags">
  910. <dt>example</dt>
  911. <dd><pre><code class="language-js">getDevices()
  912. .then(<span class="hljs-function"><span class="hljs-params">devices</span> =&gt;</span> {
  913. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表成功:`</span>, devices);
  914. })
  915. .catch(<span class="hljs-function"><span class="hljs-params">err</span> =&gt;</span> {
  916. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表失败:<span class="hljs-subst">${err}</span>`</span>);
  917. });</code></pre>
  918. </dd>
  919. <dt>reject</dt>
  920. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  921. </dd>
  922. </dl>
  923. </div>
  924. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
  925. </li>
  926. </ul>
  927. </section>
  928. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  929. <a name="getloudspeakers" class="tsd-anchor"></a>
  930. <h3>get<wbr>Loudspeakers</h3>
  931. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  932. <li class="tsd-signature tsd-kind-icon">get<wbr>Loudspeakers<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li>
  933. </ul>
  934. <ul class="tsd-descriptions">
  935. <li class="tsd-description">
  936. <aside class="tsd-sources">
  937. </aside>
  938. <div class="tsd-comment tsd-typography">
  939. <div class="lead">
  940. <p>获取扬声器设备列表,点击 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo">MediaDeviceInfo</a> 查看详情</p>
  941. </div>
  942. <dl class="tsd-comment-tags">
  943. <dt>example</dt>
  944. <dd><pre><code class="language-js">getLoudspeakers()
  945. .then(<span class="hljs-function"><span class="hljs-params">devices</span> =&gt;</span> {
  946. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表成功:`</span>, devices);
  947. })
  948. .catch(<span class="hljs-function"><span class="hljs-params">err</span> =&gt;</span> {
  949. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表失败:<span class="hljs-subst">${err}</span>`</span>);
  950. });</code></pre>
  951. </dd>
  952. <dt>reject</dt>
  953. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  954. </dd>
  955. </dl>
  956. </div>
  957. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
  958. </li>
  959. </ul>
  960. </section>
  961. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  962. <a name="getmicrophones" class="tsd-anchor"></a>
  963. <h3>get<wbr>Microphones</h3>
  964. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  965. <li class="tsd-signature tsd-kind-icon">get<wbr>Microphones<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li>
  966. </ul>
  967. <ul class="tsd-descriptions">
  968. <li class="tsd-description">
  969. <aside class="tsd-sources">
  970. </aside>
  971. <div class="tsd-comment tsd-typography">
  972. <div class="lead">
  973. <p>获取麦克风设备列表,点击 <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo">MediaDeviceInfo</a> 查看详情</p>
  974. </div>
  975. <dl class="tsd-comment-tags">
  976. <dt>example</dt>
  977. <dd><pre><code class="language-js">getMicrophones()
  978. .then(<span class="hljs-function"><span class="hljs-params">devices</span> =&gt;</span> {
  979. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表成功:`</span>, devices);
  980. })
  981. .catch(<span class="hljs-function"><span class="hljs-params">err</span> =&gt;</span> {
  982. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`获取设备列表失败:<span class="hljs-subst">${err}</span>`</span>);
  983. });</code></pre>
  984. </dd>
  985. <dt>reject</dt>
  986. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  987. </dd>
  988. </dl>
  989. </div>
  990. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MediaDeviceInfo</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
  991. </li>
  992. </ul>
  993. </section>
  994. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  995. <a name="issupportscreenshare" class="tsd-anchor"></a>
  996. <h3>is<wbr>Support<wbr>Screen<wbr>Share</h3>
  997. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  998. <li class="tsd-signature tsd-kind-icon">is<wbr>Support<wbr>Screen<wbr>Share<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
  999. </ul>
  1000. <ul class="tsd-descriptions">
  1001. <li class="tsd-description">
  1002. <aside class="tsd-sources">
  1003. </aside>
  1004. <div class="tsd-comment tsd-typography">
  1005. <div class="lead">
  1006. <p>检测浏览器是否支持屏幕共享</p>
  1007. </div>
  1008. <dl class="tsd-comment-tags">
  1009. <dt>example</dt>
  1010. <dd><pre><code class="language-js"><span class="hljs-keyword">if</span> (!isSupportScreenShare()) {
  1011. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`当前浏览器不支持屏幕共享`</span>);
  1012. }</code></pre>
  1013. </dd>
  1014. </dl>
  1015. </div>
  1016. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
  1017. </li>
  1018. </ul>
  1019. </section>
  1020. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  1021. <a name="issupportwebrtc" class="tsd-anchor"></a>
  1022. <h3>is<wbr>Support<wbr>WebRTC</h3>
  1023. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  1024. <li class="tsd-signature tsd-kind-icon">is<wbr>Support<wbr>WebRTC<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
  1025. </ul>
  1026. <ul class="tsd-descriptions">
  1027. <li class="tsd-description">
  1028. <aside class="tsd-sources">
  1029. </aside>
  1030. <div class="tsd-comment tsd-typography">
  1031. <div class="lead">
  1032. <p>检测浏览器是否完全(可访问本地音视频设备)支持 WebRTC。</p>
  1033. </div>
  1034. <dl class="tsd-comment-tags">
  1035. <dt>example</dt>
  1036. <dd><pre><code class="language-js"><span class="hljs-keyword">if</span> (!isSupportWebRTC()) {
  1037. <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`当前浏览器不完全支持 WebRTC,建议使用 Chrome 浏览器,iOS 系统建议使用 Safari 浏览器`</span>);
  1038. }</code></pre>
  1039. </dd>
  1040. </dl>
  1041. </div>
  1042. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
  1043. </li>
  1044. </ul>
  1045. </section>
  1046. <section class="tsd-panel tsd-member tsd-kind-function">
  1047. <a name="reportlog" class="tsd-anchor"></a>
  1048. <h3>report<wbr>Log</h3>
  1049. <ul class="tsd-signatures tsd-kind-function">
  1050. <li class="tsd-signature tsd-kind-icon">report<wbr>Log<span class="tsd-signature-symbol">(</span>enable<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
  1051. </ul>
  1052. <ul class="tsd-descriptions">
  1053. <li class="tsd-description">
  1054. <aside class="tsd-sources">
  1055. </aside>
  1056. <div class="tsd-comment tsd-typography">
  1057. <div class="lead">
  1058. <p>开启/关闭操作/错误/状态日志的上报,未调用时,默认开启上报日志</p>
  1059. </div>
  1060. <dl class="tsd-comment-tags">
  1061. <dt>example</dt>
  1062. <dd><pre><code class="language-js">reportLog(<span class="hljs-literal">false</span>); <span class="hljs-comment">// 关闭日志上报,关闭后,在线上出现错误时,将无法根据日志进行排查</span></code></pre>
  1063. </dd>
  1064. </dl>
  1065. </div>
  1066. <h4 class="tsd-parameters-title">Parameters</h4>
  1067. <ul class="tsd-parameters">
  1068. <li>
  1069. <h5>enable: <span class="tsd-signature-type">boolean</span></h5>
  1070. <div class="tsd-comment tsd-typography">
  1071. <p>是否开启上报</p>
  1072. </div>
  1073. </li>
  1074. </ul>
  1075. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
  1076. </li>
  1077. </ul>
  1078. </section>
  1079. <section class="tsd-panel tsd-member tsd-kind-function">
  1080. <a name="setloglevel" class="tsd-anchor"></a>
  1081. <h3>set<wbr>Log<wbr>Level</h3>
  1082. <ul class="tsd-signatures tsd-kind-function">
  1083. <li class="tsd-signature tsd-kind-icon">set<wbr>Log<wbr>Level<span class="tsd-signature-symbol">(</span>level<span class="tsd-signature-symbol">: </span><a href="index.html#loglevel" class="tsd-signature-type">LogLevel</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
  1084. </ul>
  1085. <ul class="tsd-descriptions">
  1086. <li class="tsd-description">
  1087. <aside class="tsd-sources">
  1088. </aside>
  1089. <div class="tsd-comment tsd-typography">
  1090. <div class="lead">
  1091. <p>设置日志打印级别,用于打印出更多日志来调试或定位问题</p>
  1092. </div>
  1093. <dl class="tsd-comment-tags">
  1094. <dt>example</dt>
  1095. <dd><pre><code class="language-js">setLogLevel(<span class="hljs-string">&#x27;info&#x27;</span>);</code></pre>
  1096. </dd>
  1097. </dl>
  1098. </div>
  1099. <h4 class="tsd-parameters-title">Parameters</h4>
  1100. <ul class="tsd-parameters">
  1101. <li>
  1102. <h5>level: <a href="index.html#loglevel" class="tsd-signature-type">LogLevel</a></h5>
  1103. <div class="tsd-comment tsd-typography">
  1104. <p>日志级别,有 &#39;debug&#39;, &#39;info&#39;, &#39;warn&#39;, &#39;error&#39; 级别;</p>
  1105. </div>
  1106. </li>
  1107. </ul>
  1108. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
  1109. </li>
  1110. </ul>
  1111. </section>
  1112. <section class="tsd-panel tsd-member tsd-kind-function tsd-is-external">
  1113. <a name="setservers" class="tsd-anchor"></a>
  1114. <h3>set<wbr>Servers</h3>
  1115. <ul class="tsd-signatures tsd-kind-function tsd-is-external">
  1116. <li class="tsd-signature tsd-kind-icon">set<wbr>Servers<span class="tsd-signature-symbol">(</span>conf<span class="tsd-signature-symbol">: </span><a href="interfaces/serverconfig.html" class="tsd-signature-type">ServerConfig</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
  1117. </ul>
  1118. <ul class="tsd-descriptions">
  1119. <li class="tsd-description">
  1120. <aside class="tsd-sources">
  1121. </aside>
  1122. <div class="tsd-comment tsd-typography">
  1123. <div class="lead">
  1124. <p>用于私有化部署时,指定部署的服务器地址</p>
  1125. </div>
  1126. <dl class="tsd-comment-tags">
  1127. <dt>example</dt>
  1128. <dd><pre><code class="language-js">setServers({
  1129. <span class="hljs-attr">gateway</span>: <span class="hljs-string">&#x27;https://private-rtc.com&#x27;</span>, <span class="hljs-comment">// 指定网关</span>
  1130. <span class="hljs-attr">log</span>: <span class="hljs-string">&#x27;https://log.private-rtc.com&#x27;</span>, <span class="hljs-comment">// 指定日志服务器</span>
  1131. });</code></pre>
  1132. <p><strong>特别地,单信令服务器时,不需要网关进行分配信令服务器,可以直接指定信令服务器</strong></p>
  1133. <pre><code class="language-js">setServers({
  1134. <span class="hljs-attr">signal</span>: <span class="hljs-string">&#x27;wss://private-rtc.com:5005&#x27;</span>, <span class="hljs-comment">// 直接指定信令服务器</span>
  1135. <span class="hljs-attr">log</span>: <span class="hljs-string">&#x27;https://log.private-rtc.com&#x27;</span>, <span class="hljs-comment">// 指定日志服务器</span>
  1136. });</code></pre>
  1137. </dd>
  1138. <dt>throws</dt>
  1139. <dd><p><a href="classes/rtcerror.html">RtcError</a></p>
  1140. </dd>
  1141. </dl>
  1142. </div>
  1143. <h4 class="tsd-parameters-title">Parameters</h4>
  1144. <ul class="tsd-parameters">
  1145. <li>
  1146. <h5>conf: <a href="interfaces/serverconfig.html" class="tsd-signature-type">ServerConfig</a></h5>
  1147. <div class="tsd-comment tsd-typography">
  1148. <p>服务器配置,具体描述参见 ServerConfig 的说明</p>
  1149. </div>
  1150. </li>
  1151. </ul>
  1152. <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
  1153. </li>
  1154. </ul>
  1155. </section>
  1156. </section>
  1157. </div>
  1158. <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
  1159. <nav class="tsd-navigation primary">
  1160. <ul>
  1161. <li class="globals current ">
  1162. <a href="index.html"><em>Globals</em></a>
  1163. </li>
  1164. </ul>
  1165. </nav>
  1166. <nav class="tsd-navigation secondary menu-sticky">
  1167. <ul class="before-current">
  1168. <li class=" tsd-kind-class tsd-is-external">
  1169. <a href="classes/client.html" class="tsd-kind-icon">Client</a>
  1170. </li>
  1171. <li class=" tsd-kind-class tsd-is-external">
  1172. <a href="classes/localstream.html" class="tsd-kind-icon">Local<wbr>Stream</a>
  1173. </li>
  1174. <li class=" tsd-kind-class tsd-is-external">
  1175. <a href="classes/remotestream.html" class="tsd-kind-icon">Remote<wbr>Stream</a>
  1176. </li>
  1177. <li class=" tsd-kind-class tsd-is-external">
  1178. <a href="classes/rtcerror.html" class="tsd-kind-icon">Rtc<wbr>Error</a>
  1179. </li>
  1180. <li class=" tsd-kind-class tsd-is-external">
  1181. <a href="classes/stream.html" class="tsd-kind-icon">Stream</a>
  1182. </li>
  1183. <li class=" tsd-kind-class tsd-is-external">
  1184. <a href="classes/user.html" class="tsd-kind-icon">User</a>
  1185. </li>
  1186. <li class=" tsd-kind-interface tsd-is-external">
  1187. <a href="interfaces/audiostats.html" class="tsd-kind-icon">Audio<wbr>Stats</a>
  1188. </li>
  1189. <li class=" tsd-kind-interface tsd-is-external">
  1190. <a href="interfaces/clientoptions.html" class="tsd-kind-icon">Client<wbr>Options</a>
  1191. </li>
  1192. <li class=" tsd-kind-interface tsd-is-external">
  1193. <a href="interfaces/clientplugin.html" class="tsd-kind-icon">Client<wbr>Plugin</a>
  1194. </li>
  1195. <li class=" tsd-kind-interface tsd-is-external">
  1196. <a href="interfaces/connectionstates.html" class="tsd-kind-icon">Connection<wbr>States</a>
  1197. </li>
  1198. <li class=" tsd-kind-interface tsd-is-external">
  1199. <a href="interfaces/customvideoprofile.html" class="tsd-kind-icon">Custom<wbr>Video<wbr>Profile</a>
  1200. </li>
  1201. <li class=" tsd-kind-interface tsd-is-external">
  1202. <a href="interfaces/devicedetectionoptions.html" class="tsd-kind-icon">Device<wbr>Detection<wbr>Options</a>
  1203. </li>
  1204. <li class=" tsd-kind-interface tsd-is-external">
  1205. <a href="interfaces/joinoptions.html" class="tsd-kind-icon">Join<wbr>Options</a>
  1206. </li>
  1207. <li class=" tsd-kind-interface tsd-has-type-parameter tsd-is-external">
  1208. <a href="interfaces/listener.html" class="tsd-kind-icon">Listener</a>
  1209. </li>
  1210. <li class=" tsd-kind-interface tsd-is-external">
  1211. <a href="interfaces/localstreamoptions.html" class="tsd-kind-icon">Local<wbr>Stream<wbr>Options</a>
  1212. </li>
  1213. <li class=" tsd-kind-interface tsd-is-external">
  1214. <a href="interfaces/networkstats.html" class="tsd-kind-icon">Network<wbr>Stats</a>
  1215. </li>
  1216. <li class=" tsd-kind-interface tsd-is-external">
  1217. <a href="interfaces/playoptions.html" class="tsd-kind-icon">Play<wbr>Options</a>
  1218. </li>
  1219. <li class=" tsd-kind-interface tsd-has-type-parameter tsd-is-external">
  1220. <a href="interfaces/rtcevent.html" class="tsd-kind-icon">Rtc<wbr>Event</a>
  1221. </li>
  1222. <li class=" tsd-kind-interface tsd-is-external">
  1223. <a href="interfaces/serverconfig.html" class="tsd-kind-icon">Server<wbr>Config</a>
  1224. </li>
  1225. <li class=" tsd-kind-interface tsd-is-external">
  1226. <a href="interfaces/streamplugin.html" class="tsd-kind-icon">Stream<wbr>Plugin</a>
  1227. </li>
  1228. <li class=" tsd-kind-interface tsd-is-external">
  1229. <a href="interfaces/streamstats.html" class="tsd-kind-icon">Stream<wbr>Stats</a>
  1230. </li>
  1231. <li class=" tsd-kind-interface tsd-is-external">
  1232. <a href="interfaces/videostats.html" class="tsd-kind-icon">Video<wbr>Stats</a>
  1233. </li>
  1234. <li class=" tsd-kind-type-alias tsd-is-external">
  1235. <a href="index.html#audiocodec" class="tsd-kind-icon">Audio<wbr>Codec</a>
  1236. </li>
  1237. <li class=" tsd-kind-type-alias tsd-is-external">
  1238. <a href="index.html#connectionstate" class="tsd-kind-icon">Connection<wbr>State</a>
  1239. </li>
  1240. <li class=" tsd-kind-type-alias tsd-is-external">
  1241. <a href="index.html#errorcode" class="tsd-kind-icon">Error<wbr>Code</a>
  1242. </li>
  1243. <li class=" tsd-kind-type-alias tsd-is-external">
  1244. <a href="index.html#loglevel" class="tsd-kind-icon">Log<wbr>Level</a>
  1245. </li>
  1246. <li class=" tsd-kind-type-alias tsd-is-external">
  1247. <a href="index.html#mediatype" class="tsd-kind-icon">Media<wbr>Type</a>
  1248. </li>
  1249. <li class=" tsd-kind-type-alias tsd-is-external">
  1250. <a href="index.html#playervideofittype" class="tsd-kind-icon">Player<wbr>Video<wbr>Fit<wbr>Type</a>
  1251. </li>
  1252. <li class=" tsd-kind-type-alias tsd-is-external">
  1253. <a href="index.html#roletype" class="tsd-kind-icon">Role<wbr>Type</a>
  1254. </li>
  1255. <li class=" tsd-kind-type-alias tsd-is-external">
  1256. <a href="index.html#roomtype" class="tsd-kind-icon">Room<wbr>Type</a>
  1257. </li>
  1258. <li class=" tsd-kind-type-alias tsd-is-external">
  1259. <a href="index.html#rtcconnectionevent" class="tsd-kind-icon">Rtc<wbr>Connection<wbr>Event</a>
  1260. </li>
  1261. <li class=" tsd-kind-type-alias tsd-is-external">
  1262. <a href="index.html#rtcconnectioneventtype" class="tsd-kind-icon">Rtc<wbr>Connection<wbr>Event<wbr>Type</a>
  1263. </li>
  1264. <li class=" tsd-kind-type-alias tsd-is-external">
  1265. <a href="index.html#rtceventtype" class="tsd-kind-icon">Rtc<wbr>Event<wbr>Type</a>
  1266. </li>
  1267. <li class=" tsd-kind-type-alias tsd-is-external">
  1268. <a href="index.html#rtcstreamevent" class="tsd-kind-icon">Rtc<wbr>Stream<wbr>Event</a>
  1269. </li>
  1270. <li class=" tsd-kind-type-alias tsd-is-external">
  1271. <a href="index.html#rtcstreameventtype" class="tsd-kind-icon">Rtc<wbr>Stream<wbr>Event<wbr>Type</a>
  1272. </li>
  1273. <li class=" tsd-kind-type-alias tsd-is-external">
  1274. <a href="index.html#rtcuserevent" class="tsd-kind-icon">Rtc<wbr>User<wbr>Event</a>
  1275. </li>
  1276. <li class=" tsd-kind-type-alias tsd-is-external">
  1277. <a href="index.html#rtcusereventtype" class="tsd-kind-icon">Rtc<wbr>User<wbr>Event<wbr>Type</a>
  1278. </li>
  1279. <li class=" tsd-kind-type-alias tsd-is-external">
  1280. <a href="index.html#screenprofile" class="tsd-kind-icon">Screen<wbr>Profile</a>
  1281. </li>
  1282. <li class=" tsd-kind-type-alias tsd-is-external">
  1283. <a href="index.html#switchdevicetype" class="tsd-kind-icon">Switch<wbr>Device<wbr>Type</a>
  1284. </li>
  1285. <li class=" tsd-kind-type-alias tsd-is-external">
  1286. <a href="index.html#videocodec" class="tsd-kind-icon">Video<wbr>Codec</a>
  1287. </li>
  1288. <li class=" tsd-kind-type-alias tsd-is-external">
  1289. <a href="index.html#videoprofile" class="tsd-kind-icon">Video<wbr>Profile</a>
  1290. </li>
  1291. <li class=" tsd-kind-variable tsd-is-external">
  1292. <a href="index.html#version" class="tsd-kind-icon">version</a>
  1293. </li>
  1294. <li class=" tsd-kind-function">
  1295. <a href="index.html#createclient" class="tsd-kind-icon">create<wbr>Client</a>
  1296. </li>
  1297. <li class=" tsd-kind-function">
  1298. <a href="index.html#createstream" class="tsd-kind-icon">create<wbr>Stream</a>
  1299. </li>
  1300. <li class=" tsd-kind-function tsd-is-external">
  1301. <a href="index.html#devicedetection" class="tsd-kind-icon">device<wbr>Detection</a>
  1302. </li>
  1303. <li class=" tsd-kind-function tsd-is-external">
  1304. <a href="index.html#generatetoken" class="tsd-kind-icon">generate<wbr>Token</a>
  1305. </li>
  1306. <li class=" tsd-kind-function tsd-is-external">
  1307. <a href="index.html#getcameras" class="tsd-kind-icon">get<wbr>Cameras</a>
  1308. </li>
  1309. <li class=" tsd-kind-function tsd-is-external">
  1310. <a href="index.html#getdevices" class="tsd-kind-icon">get<wbr>Devices</a>
  1311. </li>
  1312. <li class=" tsd-kind-function tsd-is-external">
  1313. <a href="index.html#getloudspeakers" class="tsd-kind-icon">get<wbr>Loudspeakers</a>
  1314. </li>
  1315. <li class=" tsd-kind-function tsd-is-external">
  1316. <a href="index.html#getmicrophones" class="tsd-kind-icon">get<wbr>Microphones</a>
  1317. </li>
  1318. <li class=" tsd-kind-function tsd-is-external">
  1319. <a href="index.html#issupportscreenshare" class="tsd-kind-icon">is<wbr>Support<wbr>Screen<wbr>Share</a>
  1320. </li>
  1321. <li class=" tsd-kind-function tsd-is-external">
  1322. <a href="index.html#issupportwebrtc" class="tsd-kind-icon">is<wbr>Support<wbr>WebRTC</a>
  1323. </li>
  1324. <li class=" tsd-kind-function">
  1325. <a href="index.html#reportlog" class="tsd-kind-icon">report<wbr>Log</a>
  1326. </li>
  1327. <li class=" tsd-kind-function">
  1328. <a href="index.html#setloglevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
  1329. </li>
  1330. <li class=" tsd-kind-function tsd-is-external">
  1331. <a href="index.html#setservers" class="tsd-kind-icon">set<wbr>Servers</a>
  1332. </li>
  1333. </ul>
  1334. </nav>
  1335. </div>
  1336. </div>
  1337. </div>
  1338. <footer class="with-border-bottom">
  1339. <div class="container">
  1340. <h2>Legend</h2>
  1341. <div class="tsd-legend-group">
  1342. </div>
  1343. </div>
  1344. </footer>
  1345. <div class="container tsd-generator">
  1346. <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
  1347. </div>
  1348. <div class="overlay"></div>
  1349. <script src="assets/js/main.js"></script>
  1350. </body>
  1351. </html>