Skip to content

Commit

Permalink
documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
TingChen2020 committed Aug 31, 2020
1 parent 25ef711 commit d7becd2
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 59 deletions.
185 changes: 179 additions & 6 deletions src/src/Classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,181 @@ export class VideoEncoderConfiguration {
*/
minFrameRate?: VideoFrameRate
/**
* Bitrate of the video (Kbps). Refer to the table below and set your bitrate. If you set a bitrate beyond the proper range,
* the SDK automatically adjusts it to a value within the range.
* Bitrate of the video (Kbps). Refer to the table below and set your bitrate. If you set a bitrate beyond the proper range, the SDK automatically adjusts it to a value within the range.
* You can also choose from the following options:
* - [`Standard`]{@link BitRate.Standard}: (Recommended) The standard bitrate mode. In this mode, the bitrates differ between the `LiveBroadcasting` and `Communication` profiles:
* - In the `Communication` profile, the video bitrate is the same as the base bitrate.
* - In the `LiveBroadcasting` profile, the video bitrate is twice the base bitrate.
* - [`Compatible`]{@link BitRate.Compatible}: The compatible bitrate mode. In this mode, the bitrate stays the same regardless of the profile. If you choose this mode for the `LiveBroadcasting` profile, the video frame rate may be lower than the set value.
*
* Agora uses different video codecs for different profiles to optimize the user experience. For example, the Communication profile prioritizes the smoothness while the `LiveBroadcasting` profile prioritizes the video quality (a higher bitrate). Therefore, We recommend setting this parameter as [`Standard`]{@link BitRate.Standard}.
*
* **Video Bitrate Table**
* <table>
* <tr>
* <th>Resolution</th>
* <th>Frame rate<p>(fps)</th>
* <th>Base Bitrate<p>(Kbps, for Communication)</th>
* <th>Live Bitrate<p>(Kbps, for Live Broadcasting)</th>
* </tr>
* <tr>
* <td>160*120</td>
* <td>15</td>
* <td>65</td>
* <td>130</td>
* </tr>
* <tr>
* <td>120*120</td>
* <td>15</td>
* <td>50</td>
* <td>100</td>
* </tr>
* <tr>
* <td>320*180</td>
* <td>15</td>
* <td>140</td>
* <td>280</td>
* </tr>
* <tr>
* <td>180*180</td>
* <td>15</td>
* <td>100</td>
* <td>200</td>
* </tr>
* <tr>
* <td>240*180</td>
* <td>15</td>
* <td>120</td>
* <td>240</td>
* </tr>
* <tr>
* <td>320*240</td>
* <td>15</td>
* <td>200</td>
* <td>400</td>
* </tr>
* <tr>
* <td>240*240</td>
* <td>15</td>
* <td>140</td>
* <td>280</td>
* </tr>
* <tr>
* <td>424*240</td>
* <td>15</td>
* <td>220</td>
* <td>440</td>
* </tr>
* <tr>
* <td>640*360</td>
* <td>15</td>
* <td>400</td>
* <td>800</td>
* </tr>
* <tr>
* <td>360*360</td>
* <td>15</td>
* <td>260</td>
* <td>520</td>
* </tr>
* <tr>
* <td>640*360</td>
* <td>30</td>
* <td>600</td>
* <td>1200</td>
* </tr>
* <tr>
* <td>360*360</td>
* <td>30</td>
* <td>400</td>
* <td>800</td>
* </tr>
* <tr>
* <td>480*360</td>
* <td>15</td>
* <td>320</td>
* <td>640</td>
* </tr>
* <tr>
* <td>480*360</td>
* <td>30</td>
* <td>490</td>
* <td>980</td>
* </tr>
* <tr>
* <td>640*480</td>
* <td>15</td>
* <td>500</td>
* <td>1000</td>
* </tr>
* <tr>
* <td>480*480</td>
* <td>15</td>
* <td>400</td>
* <td>800</td>
* </tr>
* <tr>
* <td>640*480</td>
* <td>30</td>
* <td>750</td>
* <td>1500</td>
* </tr>
* <tr>
* <td>480*480</td>
* <td>30</td>
* <td>600</td>
* <td>1200</td>
* </tr>
* <tr>
* <td>848*480</td>
* <td>15</td>
* <td>610</td>
* <td>1220</td>
* </tr>
* <tr>
* <td>848*480</td>
* <td>30</td>
* <td>930</td>
* <td>1860</td>
* </tr>
* <tr>
* <td>640*480</td>
* <td>10</td>
* <td>400</td>
* <td>800</td>
* </tr>
* <tr>
* <td>1280*720</td>
* <td>15</td>
* <td>1130</td>
* <td>2260</td>
* </tr>
* <tr>
* <td>1280*720</td>
* <td>30</td>
* <td>1710</td>
* <td>3420</td>
* </tr>
* <tr>
* <td>960*720</td>
* <td>15</td>
* <td>910</td>
* <td>1820</td>
* </tr>
* <tr>
* <td>960*720</td>
* <td>30</td>
* <td>1380</td>
* <td>2760</td>
* </tr>
* </table>
*
* **Note**
*
* The base bitrate in this table applies to the Communication profile.
* The `LiveBroadcasting` profile generally requires a higher bitrate for better video quality.
* We recommend setting the bitrate mode as [`Standard`]{@link BitRate.Standard}. You can also set the bitrate as the base bitrate value &times; 2.
*
*/
bitrate?: number
/**
Expand Down Expand Up @@ -683,19 +856,19 @@ export interface AudioVolumeInfo {
*/
export interface Rect {
/**
* The x coordinate of the left side of the rectangular area.
* The horizontal coordinate of the left side of the rectangular area.
*/
left: number
/**
* The y coordinate of the upper side of the rectangular area.
* The vertical coordinate of the upper side of the rectangular area.
*/
top: number
/**
* The x coordinate of the right side of the rectangular area.
* The horizontal coordinate of the right side of the rectangular area.
*/
right: number
/**
* The y coordinate of the bottom side of the rectangular area.
* The vertical coordinate of the bottom side of the rectangular area.
*/
bottom: number
}
Expand Down
15 changes: 8 additions & 7 deletions src/src/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,7 @@ export enum CameraCaptureOutputPreference {
*/
Auto = 0,
/**
* 1: Prioritizes the system performance. The SDK chooses the dimension and frame rate of the local camera capture closest to those set by setVideoEncoderConfiguration.
* [`setVideoEncoderConfiguration`]{@link RtcEngine.setVideoEncoderConfiguration}
* 1: Prioritizes the system performance. The SDK chooses the dimension and frame rate of the local camera capture closest to those set by [`setVideoEncoderConfiguration`]{@link RtcEngine.setVideoEncoderConfiguration}.
*/
Performance = 1,
/**
Expand Down Expand Up @@ -731,7 +730,7 @@ export enum ChannelMediaRelayError {
}

/**
* The event code in AgoraChannelMediaRelayEvent.
* The event code in `ChannelMediaRelayEvent`.
* @enum {number}
*/
export enum ChannelMediaRelayEvent {
Expand All @@ -740,7 +739,7 @@ export enum ChannelMediaRelayEvent {
*/
Disconnect = 0,
/**
* 1: The network reconnects.//TODO 为什么是 reconnects?
* 1: The network reconnects.
*/
Connected = 1,
/**
Expand Down Expand Up @@ -947,9 +946,9 @@ export enum ConnectionStateType {
* 4: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues.
* - If the SDK cannot rejoin the channel within 10 seconds after being disconnected from Agora’s edge server, the SDK triggers the [`ConnectionLost`]{@link RtcEngineEvents.ConnectionLost} callback, stays in the [`Reconnecting`]{@link ConnectionStateType.Reconnecting} state, and keeps rejoining the channel.
*
* - If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora’s edge server, the SDK triggers the [`ConnectionStateChanged`]{@link RtcEngineEvents.ConnectionStateChanged} callback, switches to the Failed state, and stops rejoining the channel.
* - If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora’s edge server, the SDK triggers the [`ConnectionStateChanged`]{@link RtcEngineEvents.ConnectionStateChanged} callback, switches to the [`Failed`]{@link ConnectionStateType.Failed} state, and stops rejoining the channel.
* [`ConnectionStateChanged`]{@link RtcEngineEvents.ConnectionStateChanged}
* @see [`Failed`]{@link ConnectionStateType.Failed}
*
*/
Reconnecting = 4,
/**
Expand Down Expand Up @@ -2384,7 +2383,9 @@ export enum WarningCode {
/**
* 105: The server rejects the request to look up the channel.
* The server cannot process this request or the request is illegal.
* **DEPRECATED** Use [`RejectedByServer(10)`]{@link ConnectionChangedReason.RejectedByServer} in the reason parameter
* **Deprecated**
*
* Use [`RejectedByServer(10)`]{@link ConnectionChangedReason.RejectedByServer} in the reason parameter
* of [`ConnectionStateChanged`]{@link RtcEngineEvents.ConnectionStateChanged}.
*
*/
Expand Down
24 changes: 12 additions & 12 deletions src/src/RtcChannel.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
}

/**
* Destroys all [`RtcChannel`]{@link RtcChannel} instance.
* Destroys all [`RtcChannel`]{@link RtcChannel} instances.
*/
static destroyAll() {
channels.forEach(async (value, key) => {
Expand All @@ -103,11 +103,11 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
}

/**
* Adds the channel event handler.
* Adds the [`RtcChannelEvents`]{@link RtcChannelEvents} handler.
*
* After setting the channel event handler, you can listen for channel events and receive the statistics of the corresponding [`RtcChannel`]{@link RtcChannel} instance.
* After setting the [`RtcChannelEvents`]{@link RtcChannelEvents} handler, you can listen for channel events and receive the statistics of the corresponding [`RtcChannel`]{@link RtcChannel} instance.
* @param event The event type.
* @param listener The event handler.
* @param listener The [`RtcChannelEvents`]{@link RtcChannelEvents} handler.
*/
addListener<EventType extends keyof RtcChannelEvents>(event: EventType, listener: RtcChannelEvents[EventType]): Subscription {
const callback = (res: any) => {
Expand All @@ -132,11 +132,11 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
}

/**
* Removes the channel event handler.
* Removes the [`RtcChannelEvents`]{@link RtcChannelEvents} handler.
*
* For callback events that you only want to listen for once, call this method to remove the specific [`RtcEngineEvents`]{@link RtcEngineEvents} objects after you have received them.
* @param event The event type.
* @param listener The event handler.
* @param listener The [`RtcChannelEvents`]{@link RtcChannelEvents} handler.
*/
removeListener<EventType extends keyof RtcChannelEvents>(event: EventType, listener: RtcChannelEvents[EventType]) {
const map = this._listeners.get(event);
Expand All @@ -146,7 +146,7 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
}

/**
* Removes all of the engine event handlers.
* Removes all the [`RtcChannelEvents`]{@link RtcChannelEvents} handlers.
* @param event The event type.
*/
removeAllListeners<EventType extends keyof RtcChannelEvents>(event?: EventType) {
Expand Down Expand Up @@ -188,10 +188,10 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
* - Ensure that the app ID you use to generate the token is the same with the app ID used when creating the [`RtcEngine`]{@link RtcEngine} instance.
*
* @param token The token generated at your server.
* - In situations not requiring high security: You can use the temporary token generated at Console. For details, see Get a temporary token.
* - In situations requiring high security: Set it as the token generated at your server. For details, see Generate a token.
* - In situations not requiring high security: You can use the temporary token generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#temptoken).
* - In situations requiring high security: Set it as the token generated at your server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#generatetoken).
* @param optionalInfo Additional information about the channel. This parameter can be set as null. Other users in the channel do not receive this information.
* @param optionalUid The user ID. A 32-bit unsigned integer with a value ranging from 1 to (232-1). This parameter must be unique. If uid is not assigned (or set as 0), the SDK assigns a uid and reports it in the onJoinChannelSuccess callback. The app must maintain this user ID.
* @param optionalUid The user ID. A 32-bit unsigned integer with a value ranging from 1 to (232-1). This parameter must be unique. If uid is not assigned (or set as 0), the SDK assigns a uid and reports it in the [`JoinChannelSuccess`]{@link RtcChannelEvents.JoinChannelSuccess} callback. The app must maintain this user ID.
* @param options The channel media options.
*
*/
Expand Down Expand Up @@ -260,7 +260,7 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
/**
* Publishes the local stream to the channel.
* You must keep the following restrictions in mind when calling this method.
* Otherwise, the SDK returns the [`Refused(-5)`]{@link ErrorCode.Refused}
* Otherwise, the SDK returns the [`Refused(-5)`]{@link ErrorCode.Refused}:
* - This method publishes one stream only to the channel corresponding to the current [`RtcChannel`]{@link RtcChannel} instance.
* - In a Live-Broadcast channel, only a host can call this method. To switch the client role, call [`setClientRole`]{@link RtcChannel.setClientRole} of the current [`RtcChannel`]{@link RtcChannel} instance.
* - You can publish a stream to only one channel at a time. For details, see the advanced guide Join Multiple Channels.
Expand Down Expand Up @@ -611,7 +611,7 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
*
* **Note**
* - Do not use this method for CDN streaming.
* - Before calling this method, ensure that you have called [`setEncryptionSecret`]{@link RtcEngine.setEncryptionSecret} to enable encryption.
* - Before calling this method, ensure that you have called [`setEncryptionSecret`]{@link RtcChannel.setEncryptionSecret} to enable encryption.
*
* @param encryptionMode Sets the encryption mode.
*
Expand Down
Loading

0 comments on commit d7becd2

Please sign in to comment.