Skip to content

Commit

Permalink
chore: add type docs for webrtc info and webrtc support list methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DeividVeloso committed Jan 19, 2021
1 parent 883deb6 commit 7ff94ab
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 2 deletions.
61 changes: 61 additions & 0 deletions packages/js/docs/ts/classes/telnyxrtc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -950,3 +952,62 @@ Name | Type | Description |
**Returns:** Promise<MediaTrackConstraints\>

`Promise<MediaTrackConstraints>` 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.
2 changes: 1 addition & 1 deletion packages/js/examples/vanilla/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!-- Include the Telnyx WEBRTC JS SDK -->
<script
type="text/javascript"
src="https://unpkg.com/@telnyx/webrtc"
src="../../lib/bundle.js"
></script>

<!-- To style up the demo a little -->
Expand Down
51 changes: 50 additions & 1 deletion packages/js/src/TelnyxRTC.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 7ff94ab

Please sign in to comment.