From 7ff94ab4cbf1c1d991b5b5903994dbbf518b01de Mon Sep 17 00:00:00 2001 From: Deivid Veloso Date: Tue, 19 Jan 2021 17:17:15 -0300 Subject: [PATCH] chore: add type docs for webrtc info and webrtc support list methods --- packages/js/docs/ts/classes/telnyxrtc.md | 61 ++++++++++++++++++++++++ packages/js/examples/vanilla/index.html | 2 +- packages/js/src/TelnyxRTC.ts | 51 +++++++++++++++++++- 3 files changed, 112 insertions(+), 2 deletions(-) diff --git a/packages/js/docs/ts/classes/telnyxrtc.md b/packages/js/docs/ts/classes/telnyxrtc.md index 4f5d558d..a431d866 100644 --- a/packages/js/docs/ts/classes/telnyxrtc.md +++ b/packages/js/docs/ts/classes/telnyxrtc.md @@ -69,6 +69,8 @@ client.connect(); * [on](telnyxrtc.md#on) * [setAudioSettings](telnyxrtc.md#setaudiosettings) * [setVideoSettings](telnyxrtc.md#setvideosettings) +* [webRTCInfo](telnyxrtc.md#webrtcinfo) +* [webRTCSupportedBrowserList](telnyxrtc.md#webrtcsupportedbrowserlist) ## Constructors @@ -950,3 +952,62 @@ Name | Type | Description | **Returns:** Promise `Promise` Video constraints applied to the client. + +___ + +### webRTCInfo + +▸ `Static`**webRTCInfo**(): any + +Checks if the running browser has support for TelnyRTC + +**`examples`** + +If your browser has supported + +```js +const info = TelnyxRTC.webRTCInfo(); +console.log(info) // => 'This browser does not support @telnyx/webrtc. \nPlease, use Chrome|Firefox|Safari.' +``` + +### Error handling + +An error will be thrown if your browser doesn't supported TelnyxWebRTC + +```js +const info = TelnyxRTC.webRTCInfo(); +console.log(info) // => {browserName: "Chrome", browserVersion: 87, supportWebRTC: true, supportWebRTCAudio: true, …} +``` + +**Returns:** any + +an object with telnyx webrtc information. + +___ + +### webRTCSupportedBrowserList + +▸ `Static`**webRTCSupportedBrowserList**(): {}[] + +Returns the WebRTC supported browser list. + +The following table indicates the browsers supported by TelnyxRTC. +We support the most recent (N) and the two previous (N-2) versions of these browsers unless otherwise indicated. + +| | Chrome | Firefox | Safari | Edge | +|---|---|---|---|---| +| Android | [x] | [x] | [ ] | [ ] | +| iOS | [x] | [x] | [x] | [ ] | +| Linux | [x] | [x] | [ ] | [ ] | +| MacOS | [x] | [x] | [x] | [x] | +| Windows | [x] | [x] | [ ] | [x] | + +**`examples`** +```js +const browserList = TelnyxRTC.webRTCSupportedBrowserList(); +console.log(browserList) // => [{"operationSystem": "Android", "supported": [{"browserName": "Chrome", "features": ["video", "audio"], "supported": "full"},{...}] +``` + +**Returns:** {}[] + +an array with supported operational systems and browsers. diff --git a/packages/js/examples/vanilla/index.html b/packages/js/examples/vanilla/index.html index 2b523764..94d50586 100644 --- a/packages/js/examples/vanilla/index.html +++ b/packages/js/examples/vanilla/index.html @@ -17,7 +17,7 @@ diff --git a/packages/js/src/TelnyxRTC.ts b/packages/js/src/TelnyxRTC.ts index cd50932b..0390a42c 100644 --- a/packages/js/src/TelnyxRTC.ts +++ b/packages/js/src/TelnyxRTC.ts @@ -1,7 +1,10 @@ /* eslint-disable no-useless-constructor */ import TelnyxRTCClient from './Modules/Verto'; import { ICallOptions, IClientOptions } from './utils/interfaces'; -import { getWebRTCInfo, getWebRTCSupportedBrowserList } from './Modules/Verto/webrtc/helpers'; +import { + getWebRTCInfo, + getWebRTCSupportedBrowserList, +} from './Modules/Verto/webrtc/helpers'; /** * The `TelnyxRTC` client connects your application to the Telnyx backend, @@ -128,10 +131,56 @@ export default class TelnyxRTC extends TelnyxRTCClient { return super.newCall(options); } + /** + * Checks if the running browser has support for TelnyRTC + * + * @return an object with telnyx webrtc information. + * + * @examples + * + * If your browser has supported + * + * ```js + * const info = TelnyxRTC.webRTCInfo(); + * console.log(info) // => 'This browser does not support @telnyx/webrtc. \nPlease, use Chrome|Firefox|Safari.' + * ``` + * + * ### Error handling + * + * An error will be thrown if your browser doesn't supported TelnyxRTC + * + * ```js + * const info = TelnyxRTC.webRTCInfo(); + * console.log(info) // => {browserName: "Chrome", browserVersion: 87, supportWebRTC: true, supportWebRTCAudio: true, …} + * ``` + */ public static webRTCInfo() { return getWebRTCInfo(); } + /** + * Returns the WebRTC supported browser list. + * + * The following table indicates the browsers supported by TelnyxRTC. + * We support the most recent (N) and the two previous (N-2) versions of these browsers unless otherwise indicated. + * + * | | Chrome | Firefox | Safari | Edge | + * |---|---|---|---|---| + * | Android | [x] | [x] | [ ] | [ ] | + * | iOS | [x] | [x] | [x] | [ ] | + * | Linux | [x] | [x] | [ ] | [ ] | + * | MacOS | [x] | [x] | [x] | [x] | + * | Windows | [x] | [x] | [ ] | [x] | + * + * @return an array with supported operational systems and browsers. + * + * @examples + * + * ```js + * const browserList = TelnyxRTC.webRTCSupportedBrowserList(); + * console.log(browserList) // => [{"operationSystem": "Android", "supported": [{"browserName": "Chrome", "features": ["video", "audio"], "supported": "full"},{...}] + * ``` + */ public static webRTCSupportedBrowserList() { return getWebRTCSupportedBrowserList(); }