index.html 78 KB

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