├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitignore ├── .prettierrc ├── .travis.yml ├── LICENSE ├── README.md ├── dist ├── index.css ├── index.d.ts ├── index.js ├── index.js.map ├── index.modern.js ├── index.modern.js.map └── index.test.d.ts ├── docs ├── .nojekyll ├── assets │ ├── highlight.css │ ├── icons.css │ ├── icons.png │ ├── icons@2x.png │ ├── main.js │ ├── search.js │ ├── style.css │ ├── widgets.png │ └── widgets@2x.png ├── index.html └── modules.html ├── example ├── README.md ├── nextjs │ ├── README.md │ ├── next-env.d.ts │ ├── next.config.js │ ├── package-lock.json │ ├── package.json │ ├── pages │ │ ├── Videocall.tsx │ │ ├── _app.tsx │ │ └── index.tsx │ ├── styles │ │ └── globals.css │ └── tsconfig.json ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── src │ ├── App.tsx │ ├── index.css │ ├── index.tsx │ ├── react-app-env.d.ts │ └── setupTests.ts └── tsconfig.json ├── package-lock.json ├── package.json ├── src └── index.tsx ├── tsconfig.json └── tsconfig.test.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/ 2 | dist/ 3 | node_modules/ 4 | .snapshots/ 5 | *.min.js -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "extends": [ 4 | "standard", 5 | "standard-react", 6 | "plugin:prettier/recommended", 7 | "plugin:react/recommended", 8 | "prettier/standard", 9 | "prettier/react", 10 | "plugin:@typescript-eslint/eslint-recommended" 11 | ], 12 | "env": { 13 | "node": true 14 | }, 15 | "parserOptions": { 16 | "ecmaVersion": 2020, 17 | "ecmaFeatures": { 18 | "legacyDecorators": true, 19 | "jsx": true 20 | } 21 | }, 22 | "settings": { 23 | "react": { 24 | "version": "16" 25 | } 26 | }, 27 | "rules": { 28 | "space-before-function-paren": 0, 29 | "react/prop-types": 0, 30 | "react/jsx-handler-names": 0, 31 | "react/jsx-fragments": 0, 32 | "react/no-unused-prop-types": 0, 33 | "jsx-uses-vars": true, 34 | "jsx-uses-react": true, 35 | "import/export": 0 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # See https://help.github.com/ignore-files/ for more about ignoring files. 3 | 4 | # dependencies 5 | node_modules 6 | 7 | # builds 8 | build 9 | # dist hosts the github release 10 | .rpt2_cache 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | .env.local 16 | .env.development.local 17 | .env.test.local 18 | .env.production.local 19 | 20 | npm-debug.log* 21 | yarn-debug.log* 22 | yarn-error.log* 23 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "jsxSingleQuote": true, 4 | "semi": false, 5 | "tabWidth": 2, 6 | "bracketSpacing": true, 7 | "jsxBracketSameLine": false, 8 | "arrowParens": "always", 9 | "trailingComma": "none" 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 12 4 | - 10 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Agora 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Agora RTC SDK React Wrapper (Archive) 2 | 3 | ### Agora now offers an official React SDK! 4 | The React SDK (2.x) repo is available [here](https://github.com/AgoraIO-Extensions/agora-rtc-react/). 5 | It's released as v2.x under the same [npm package](https://www.npmjs.com/package/agora-rtc-react/v/2.0.0-beta.0). 6 | 7 | ### Links for 2.x 8 | - [Docs](https://docs-beta.agora.io/en/video-calling/get-started/get-started-sdk?platform=react-js) 9 | - [API Reference](https://api-ref.agora.io/en/video-sdk/reactjs/2.x/index.html) 10 | - [NPM Package](https://www.npmjs.com/package/agora-rtc-react/v/2.0.0-beta.0) 11 | - [GitHub Repo](https://github.com/AgoraIO-Extensions/agora-rtc-react/) 12 | 13 | --- 14 | 15 | ## 1.x (this repo) 16 | A react (react.js) wrapper for [Agora RTC NG SDK](https://www.npmjs.com/package/agora-rtc-sdk-ng). 17 | 18 | This wrapper supports **React >= v16.8** 19 | 20 | ## Install 21 | ```bash 22 | npm install agora-rtc-react 23 | ``` 24 | 25 | ## Usage 26 | ```tsx 27 | import React from "react"; 28 | import { AgoraVideoPlayer, createClient, createMicrophoneAndCameraTracks } from "agora-rtc-react"; 29 | 30 | const config = {mode: "rtc", codec: "vp8"} 31 | 32 | const useClient = createClient(config); 33 | const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks(); 34 | 35 | const App = () => { 36 | const client = useClient(); 37 | const { ready, tracks } = useMicrophoneAndCameraTracks(); 38 | 39 | return ( 40 | ready && 41 | ) 42 | } 43 | 44 | ``` 45 | 46 | ## Example 47 | A full videocall example using the wrapper can be found [here](https://github.com/AgoraIO-Community/agora-rtc-react/wiki/Example). 48 | 49 | ## Reference 50 | You can view the methods in the wrapper [here](https://agoraio-community.github.io/Agora-RTC-React). 51 | -------------------------------------------------------------------------------- /dist/index.css: -------------------------------------------------------------------------------- 1 | /* add css module styles here (optional) */ 2 | 3 | ._3ybTi { 4 | margin: 2em; 5 | padding: 0.5em; 6 | border: 2px solid #000; 7 | font-size: 2em; 8 | text-align: center; 9 | } 10 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module Agora React Wrapper 3 | */ 4 | import React from 'react'; 5 | import AgoraRTC, { BufferSourceAudioTrackInitConfig, CameraVideoTrackInitConfig, ClientConfig, CustomAudioTrackInitConfig, CustomVideoTrackInitConfig, IAgoraRTCClient, IBufferSourceAudioTrack, ICameraVideoTrack, ILocalAudioTrack, ILocalVideoTrack, IMicrophoneAudioTrack, IRemoteVideoTrack, MicrophoneAudioTrackInitConfig, ScreenVideoTrackInitConfig, VideoPlayerConfig } from 'agora-rtc-sdk-ng'; 6 | export default AgoraRTC; 7 | export * from 'agora-rtc-sdk-ng'; 8 | /** 9 | * @ignore 10 | */ 11 | export interface AgoraRTCError { 12 | code: AgoraRTCErrorCode; 13 | message: string; 14 | data?: any; 15 | name: string; 16 | } 17 | /** 18 | * @ignore 19 | */ 20 | export declare enum AgoraRTCErrorCode { 21 | UNEXPECTED_ERROR = "UNEXPECTED_ERROR", 22 | UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE", 23 | TIMEOUT = "TIMEOUT", 24 | INVALID_PARAMS = "INVALID_PARAMS", 25 | NOT_SUPPORTED = "NOT_SUPPORTED", 26 | INVALID_OPERATION = "INVALID_OPERATION", 27 | OPERATION_ABORTED = "OPERATION_ABORTED", 28 | WEB_SECURITY_RESTRICT = "WEB_SECURITY_RESTRICT", 29 | NETWORK_ERROR = "NETWORK_ERROR", 30 | NETWORK_TIMEOUT = "NETWORK_TIMEOUT", 31 | NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR", 32 | API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT", 33 | ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED", 34 | DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND", 35 | ELECTRON_IS_NULL = "ELECTRON_IS_NULL", 36 | ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR", 37 | CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE", 38 | CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL", 39 | MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID", 40 | PERMISSION_DENIED = "PERMISSION_DENIED", 41 | CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED", 42 | TRACK_IS_DISABLED = "TRACK_IS_DISABLED", 43 | SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED", 44 | LOW_STREAM_ENCODING_ERROR = "LOW_STREAM_ENCODING_ERROR", 45 | INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID", 46 | CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER", 47 | CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER", 48 | VOID_GATEWAY_ADDRESS = "VOID_GATEWAY_ADDRESS", 49 | UID_CONFLICT = "UID_CONFLICT", 50 | INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK", 51 | INVALID_TRACK = "INVALID_TRACK", 52 | SENDER_NOT_FOUND = "SENDER_NOT_FOUND", 53 | CREATE_OFFER_FAILED = "CREATE_OFFER_FAILED", 54 | SET_ANSWER_FAILED = "SET_ANSWER_FAILED", 55 | ICE_FAILED = "ICE_FAILED", 56 | PC_CLOSED = "PC_CLOSED", 57 | SENDER_REPLACE_FAILED = "SENDER_REPLACE_FAILED", 58 | GATEWAY_P2P_LOST = "GATEWAY_P2P_LOST", 59 | NO_ICE_CANDIDATE = "NO_ICE_CANDIDATE", 60 | CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS", 61 | EXIST_DISABLED_VIDEO_TRACK = "EXIST_DISABLED_VIDEO_TRACK", 62 | INVALID_REMOTE_USER = "INVALID_REMOTE_USER", 63 | REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED", 64 | CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED", 65 | CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH", 66 | FETCH_AUDIO_FILE_FAILED = "FETCH_AUDIO_FILE_FAILED", 67 | READ_LOCAL_AUDIO_FILE_ERROR = "READ_LOCAL_AUDIO_FILE_ERROR", 68 | DECODE_AUDIO_FILE_FAILED = "DECODE_AUDIO_FILE_FAILED", 69 | WS_ABORT = "WS_ABORT", 70 | WS_DISCONNECT = "WS_DISCONNECT", 71 | WS_ERR = "WS_ERR", 72 | LIVE_STREAMING_TASK_CONFLICT = "LIVE_STREAMING_TASK_CONFLICT", 73 | LIVE_STREAMING_INVALID_ARGUMENT = "LIVE_STREAMING_INVALID_ARGUMENT", 74 | LIVE_STREAMING_INTERNAL_SERVER_ERROR = "LIVE_STREAMING_INTERNAL_SERVER_ERROR", 75 | LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED", 76 | LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED", 77 | LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR", 78 | LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM", 79 | LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT", 80 | LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE", 81 | LIVE_STREAMING_WARN_FREQUENT_REQUEST = "LIVE_STREAMING_WARN_FREQUENT_REQUEST", 82 | WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR", 83 | BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR", 84 | CROSS_CHANNEL_WAIT_STATUS_ERROR = "CROSS_CHANNEL_WAIT_STATUS_ERROR", 85 | CROSS_CHANNEL_FAILED_JOIN_SRC = "CROSS_CHANNEL_FAILED_JOIN_SEC", 86 | CROSS_CHANNEL_FAILED_JOIN_DEST = "CROSS_CHANNEL_FAILED_JOIN_DEST", 87 | CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST", 88 | CROSS_CHANNEL_SERVER_ERROR_RESPONSE = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE", 89 | METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE" 90 | } 91 | /** 92 | * Initializes a Web SDK client and stores the instance for the lifecycle of the application 93 | * @param config Configuration for the Web SDK Client instance 94 | * @returns React hook that gives access to the Web SDK Client instance 95 | * @category Wrapper 96 | */ 97 | export declare const createClient: (config: ClientConfig) => () => IAgoraRTCClient; 98 | /** 99 | * Creates and stores the camera and microphone tracks 100 | * @param audioConfig Config for the audio track 101 | * @param videoConfig Config for the video track 102 | * @returns React hook that can be used to access the camera and microphone tracks 103 | * @category Wrapper 104 | */ 105 | export declare function createMicrophoneAndCameraTracks(audioConfig?: MicrophoneAudioTrackInitConfig | undefined, videoConfig?: CameraVideoTrackInitConfig | undefined): () => { 106 | ready: boolean; 107 | tracks: [IMicrophoneAudioTrack, ICameraVideoTrack] | null; 108 | error: AgoraRTCError | null; 109 | }; 110 | /** 111 | * Creates and stores the buffer source audio track 112 | * @param config Config for the buffer source audio track 113 | * @returns React hook that can be used to access the buffer source audio track 114 | * @category Wrapper 115 | */ 116 | export declare function createBufferSourceAudioTrack(config: BufferSourceAudioTrackInitConfig): () => { 117 | ready: boolean; 118 | track: IBufferSourceAudioTrack | null; 119 | error: AgoraRTCError | null; 120 | }; 121 | /** 122 | * Creates and stores the camera track 123 | * @param config Config for the camera track 124 | * @returns React hook that can be used to access the camera track 125 | * @category Wrapper 126 | */ 127 | export declare function createCameraVideoTrack(config?: CameraVideoTrackInitConfig): () => { 128 | ready: boolean; 129 | track: ICameraVideoTrack | null; 130 | error: AgoraRTCError | null; 131 | }; 132 | /** 133 | * Creates and stores the custom audio track 134 | * @param config Config for the custom audio track 135 | * @returns React hook that can be used to access the custom audio track 136 | * @category Wrapper 137 | */ 138 | export declare function createCustomAudioTrack(config: CustomAudioTrackInitConfig): () => { 139 | ready: boolean; 140 | track: ILocalAudioTrack | null; 141 | error: AgoraRTCError | null; 142 | }; 143 | /** 144 | * Creates and stores the custom video track 145 | * @param config Config for the custom video track 146 | * @returns React hook that can be used to access the custom video track 147 | * @category Wrapper 148 | */ 149 | export declare function createCustomVideoTrack(config: CustomVideoTrackInitConfig): () => { 150 | ready: boolean; 151 | track: ILocalVideoTrack | null; 152 | error: AgoraRTCError | null; 153 | }; 154 | /** 155 | * Creates and stores the microphone track 156 | * @param config Config for the microphone track 157 | * @returns React hook that can be used to access the microphone track 158 | * @category Wrapper 159 | */ 160 | export declare function createMicrophoneAudioTrack(config?: MicrophoneAudioTrackInitConfig): () => { 161 | ready: boolean; 162 | track: IMicrophoneAudioTrack | null; 163 | error: AgoraRTCError | null; 164 | }; 165 | /** 166 | * Creates and stores the screenshare tracks 167 | * @param config Config for the screenshare tracks 168 | * @param withAudio Try and create audio track as well (needs browser support) 169 | * @returns React hook that can be used to access the screenshare tracks 170 | * @category Wrapper 171 | */ 172 | export declare function createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio?: 'enable' | 'disable' | 'auto'): () => { 173 | ready: boolean; 174 | tracks: ILocalVideoTrack | [ILocalVideoTrack, ILocalAudioTrack]; 175 | error: AgoraRTCError | null; 176 | }; 177 | /** 178 | * A React component to render the local or remote videoTrack 179 | * @param props videoTrack and video config 180 | * @returns An HTML div element containing the provided videoTrack 181 | */ 182 | export declare const AgoraVideoPlayer: (props: React.DetailedHTMLProps, HTMLDivElement> & { 183 | videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack; 184 | } & { 185 | config?: VideoPlayerConfig; 186 | }) => JSX.Element; 187 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 2 | 3 | var React = require('react'); 4 | var React__default = _interopDefault(React); 5 | var AgoraRTC = require('agora-rtc-sdk-ng'); 6 | var AgoraRTC__default = _interopDefault(AgoraRTC); 7 | 8 | function _objectWithoutPropertiesLoose(source, excluded) { 9 | if (source == null) return {}; 10 | var target = {}; 11 | var sourceKeys = Object.keys(source); 12 | var key, i; 13 | 14 | for (i = 0; i < sourceKeys.length; i++) { 15 | key = sourceKeys[i]; 16 | if (excluded.indexOf(key) >= 0) continue; 17 | target[key] = source[key]; 18 | } 19 | 20 | return target; 21 | } 22 | 23 | (function (AgoraRTCErrorCode) { 24 | AgoraRTCErrorCode["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR"; 25 | AgoraRTCErrorCode["UNEXPECTED_RESPONSE"] = "UNEXPECTED_RESPONSE"; 26 | AgoraRTCErrorCode["TIMEOUT"] = "TIMEOUT"; 27 | AgoraRTCErrorCode["INVALID_PARAMS"] = "INVALID_PARAMS"; 28 | AgoraRTCErrorCode["NOT_SUPPORTED"] = "NOT_SUPPORTED"; 29 | AgoraRTCErrorCode["INVALID_OPERATION"] = "INVALID_OPERATION"; 30 | AgoraRTCErrorCode["OPERATION_ABORTED"] = "OPERATION_ABORTED"; 31 | AgoraRTCErrorCode["WEB_SECURITY_RESTRICT"] = "WEB_SECURITY_RESTRICT"; 32 | AgoraRTCErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; 33 | AgoraRTCErrorCode["NETWORK_TIMEOUT"] = "NETWORK_TIMEOUT"; 34 | AgoraRTCErrorCode["NETWORK_RESPONSE_ERROR"] = "NETWORK_RESPONSE_ERROR"; 35 | AgoraRTCErrorCode["API_INVOKE_TIMEOUT"] = "API_INVOKE_TIMEOUT"; 36 | AgoraRTCErrorCode["ENUMERATE_DEVICES_FAILED"] = "ENUMERATE_DEVICES_FAILED"; 37 | AgoraRTCErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND"; 38 | AgoraRTCErrorCode["ELECTRON_IS_NULL"] = "ELECTRON_IS_NULL"; 39 | AgoraRTCErrorCode["ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR"] = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR"; 40 | AgoraRTCErrorCode["CHROME_PLUGIN_NO_RESPONSE"] = "CHROME_PLUGIN_NO_RESPONSE"; 41 | AgoraRTCErrorCode["CHROME_PLUGIN_NOT_INSTALL"] = "CHROME_PLUGIN_NOT_INSTALL"; 42 | AgoraRTCErrorCode["MEDIA_OPTION_INVALID"] = "MEDIA_OPTION_INVALID"; 43 | AgoraRTCErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED"; 44 | AgoraRTCErrorCode["CONSTRAINT_NOT_SATISFIED"] = "CONSTRAINT_NOT_SATISFIED"; 45 | AgoraRTCErrorCode["TRACK_IS_DISABLED"] = "TRACK_IS_DISABLED"; 46 | AgoraRTCErrorCode["SHARE_AUDIO_NOT_ALLOWED"] = "SHARE_AUDIO_NOT_ALLOWED"; 47 | AgoraRTCErrorCode["LOW_STREAM_ENCODING_ERROR"] = "LOW_STREAM_ENCODING_ERROR"; 48 | AgoraRTCErrorCode["INVALID_UINT_UID_FROM_STRING_UID"] = "INVALID_UINT_UID_FROM_STRING_UID"; 49 | AgoraRTCErrorCode["CAN_NOT_GET_PROXY_SERVER"] = "CAN_NOT_GET_PROXY_SERVER"; 50 | AgoraRTCErrorCode["CAN_NOT_GET_GATEWAY_SERVER"] = "CAN_NOT_GET_GATEWAY_SERVER"; 51 | AgoraRTCErrorCode["VOID_GATEWAY_ADDRESS"] = "VOID_GATEWAY_ADDRESS"; 52 | AgoraRTCErrorCode["UID_CONFLICT"] = "UID_CONFLICT"; 53 | AgoraRTCErrorCode["INVALID_LOCAL_TRACK"] = "INVALID_LOCAL_TRACK"; 54 | AgoraRTCErrorCode["INVALID_TRACK"] = "INVALID_TRACK"; 55 | AgoraRTCErrorCode["SENDER_NOT_FOUND"] = "SENDER_NOT_FOUND"; 56 | AgoraRTCErrorCode["CREATE_OFFER_FAILED"] = "CREATE_OFFER_FAILED"; 57 | AgoraRTCErrorCode["SET_ANSWER_FAILED"] = "SET_ANSWER_FAILED"; 58 | AgoraRTCErrorCode["ICE_FAILED"] = "ICE_FAILED"; 59 | AgoraRTCErrorCode["PC_CLOSED"] = "PC_CLOSED"; 60 | AgoraRTCErrorCode["SENDER_REPLACE_FAILED"] = "SENDER_REPLACE_FAILED"; 61 | AgoraRTCErrorCode["GATEWAY_P2P_LOST"] = "GATEWAY_P2P_LOST"; 62 | AgoraRTCErrorCode["NO_ICE_CANDIDATE"] = "NO_ICE_CANDIDATE"; 63 | AgoraRTCErrorCode["CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS"] = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS"; 64 | AgoraRTCErrorCode["EXIST_DISABLED_VIDEO_TRACK"] = "EXIST_DISABLED_VIDEO_TRACK"; 65 | AgoraRTCErrorCode["INVALID_REMOTE_USER"] = "INVALID_REMOTE_USER"; 66 | AgoraRTCErrorCode["REMOTE_USER_IS_NOT_PUBLISHED"] = "REMOTE_USER_IS_NOT_PUBLISHED"; 67 | AgoraRTCErrorCode["CUSTOM_REPORT_SEND_FAILED"] = "CUSTOM_REPORT_SEND_FAILED"; 68 | AgoraRTCErrorCode["CUSTOM_REPORT_FREQUENCY_TOO_HIGH"] = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH"; 69 | AgoraRTCErrorCode["FETCH_AUDIO_FILE_FAILED"] = "FETCH_AUDIO_FILE_FAILED"; 70 | AgoraRTCErrorCode["READ_LOCAL_AUDIO_FILE_ERROR"] = "READ_LOCAL_AUDIO_FILE_ERROR"; 71 | AgoraRTCErrorCode["DECODE_AUDIO_FILE_FAILED"] = "DECODE_AUDIO_FILE_FAILED"; 72 | AgoraRTCErrorCode["WS_ABORT"] = "WS_ABORT"; 73 | AgoraRTCErrorCode["WS_DISCONNECT"] = "WS_DISCONNECT"; 74 | AgoraRTCErrorCode["WS_ERR"] = "WS_ERR"; 75 | AgoraRTCErrorCode["LIVE_STREAMING_TASK_CONFLICT"] = "LIVE_STREAMING_TASK_CONFLICT"; 76 | AgoraRTCErrorCode["LIVE_STREAMING_INVALID_ARGUMENT"] = "LIVE_STREAMING_INVALID_ARGUMENT"; 77 | AgoraRTCErrorCode["LIVE_STREAMING_INTERNAL_SERVER_ERROR"] = "LIVE_STREAMING_INTERNAL_SERVER_ERROR"; 78 | AgoraRTCErrorCode["LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED"] = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED"; 79 | AgoraRTCErrorCode["LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED"] = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED"; 80 | AgoraRTCErrorCode["LIVE_STREAMING_CDN_ERROR"] = "LIVE_STREAMING_CDN_ERROR"; 81 | AgoraRTCErrorCode["LIVE_STREAMING_INVALID_RAW_STREAM"] = "LIVE_STREAMING_INVALID_RAW_STREAM"; 82 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT"] = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT"; 83 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE"] = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE"; 84 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_FREQUENT_REQUEST"] = "LIVE_STREAMING_WARN_FREQUENT_REQUEST"; 85 | AgoraRTCErrorCode["WEBGL_INTERNAL_ERROR"] = "WEBGL_INTERNAL_ERROR"; 86 | AgoraRTCErrorCode["BEAUTY_PROCESSOR_INTERNAL_ERROR"] = "BEAUTY_PROCESSOR_INTERNAL_ERROR"; 87 | AgoraRTCErrorCode["CROSS_CHANNEL_WAIT_STATUS_ERROR"] = "CROSS_CHANNEL_WAIT_STATUS_ERROR"; 88 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_JOIN_SRC"] = "CROSS_CHANNEL_FAILED_JOIN_SEC"; 89 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_JOIN_DEST"] = "CROSS_CHANNEL_FAILED_JOIN_DEST"; 90 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST"] = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST"; 91 | AgoraRTCErrorCode["CROSS_CHANNEL_SERVER_ERROR_RESPONSE"] = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE"; 92 | AgoraRTCErrorCode["METADATA_OUT_OF_RANGE"] = "METADATA_OUT_OF_RANGE"; 93 | })(exports.AgoraRTCErrorCode || (exports.AgoraRTCErrorCode = {})); 94 | 95 | var createClient = function createClient(config) { 96 | var client; 97 | 98 | function createClosure() { 99 | if (!client) { 100 | client = AgoraRTC__default.createClient(config); 101 | } 102 | 103 | return client; 104 | } 105 | 106 | return function () { 107 | return createClosure(); 108 | }; 109 | }; 110 | function createMicrophoneAndCameraTracks(audioConfig, videoConfig) { 111 | var createClosure = function createClosure() { 112 | try { 113 | return Promise.resolve(AgoraRTC__default.createMicrophoneAndCameraTracks(audioConfig, videoConfig)).then(function (_AgoraRTC$createMicro) { 114 | tracks = _AgoraRTC$createMicro; 115 | return tracks; 116 | }); 117 | } catch (e) { 118 | return Promise.reject(e); 119 | } 120 | }; 121 | 122 | var tracks = null; 123 | return function useMicrophoneAndCameraTracks() { 124 | var _useState = React.useState(false), 125 | ready = _useState[0], 126 | setReady = _useState[1]; 127 | 128 | var _useState2 = React.useState(null), 129 | agoraRTCError = _useState2[0], 130 | setAgoraRTCError = _useState2[1]; 131 | 132 | var ref = React.useRef(tracks); 133 | React.useEffect(function () { 134 | if (ref.current === null) { 135 | createClosure().then(function (tracks) { 136 | ref.current = tracks; 137 | setReady(true); 138 | }, function (e) { 139 | setAgoraRTCError(e); 140 | }); 141 | } else { 142 | setReady(true); 143 | } 144 | 145 | return function () { 146 | tracks = null; 147 | }; 148 | }, []); 149 | return { 150 | ready: ready, 151 | tracks: ref.current, 152 | error: agoraRTCError 153 | }; 154 | }; 155 | } 156 | function createBufferSourceAudioTrack(config) { 157 | var createClosure = function createClosure() { 158 | try { 159 | return Promise.resolve(AgoraRTC__default.createBufferSourceAudioTrack(config)).then(function (_AgoraRTC$createBuffe) { 160 | track = _AgoraRTC$createBuffe; 161 | return track; 162 | }); 163 | } catch (e) { 164 | return Promise.reject(e); 165 | } 166 | }; 167 | 168 | var track = null; 169 | return function useBufferSourceAudioTrack() { 170 | var _useState3 = React.useState(false), 171 | ready = _useState3[0], 172 | setReady = _useState3[1]; 173 | 174 | var _useState4 = React.useState(null), 175 | agoraRTCError = _useState4[0], 176 | setAgoraRTCError = _useState4[1]; 177 | 178 | var ref = React.useRef(track); 179 | React.useEffect(function () { 180 | if (ref.current === null) { 181 | createClosure().then(function (track) { 182 | ref.current = track; 183 | setReady(true); 184 | }, function (e) { 185 | setAgoraRTCError(e); 186 | }); 187 | } else { 188 | setReady(true); 189 | } 190 | 191 | return function () { 192 | track = null; 193 | }; 194 | }, []); 195 | return { 196 | ready: ready, 197 | track: ref.current, 198 | error: agoraRTCError 199 | }; 200 | }; 201 | } 202 | function createCameraVideoTrack(config) { 203 | var createClosure = function createClosure() { 204 | try { 205 | return Promise.resolve(AgoraRTC__default.createCameraVideoTrack(config)).then(function (_AgoraRTC$createCamer) { 206 | track = _AgoraRTC$createCamer; 207 | return track; 208 | }); 209 | } catch (e) { 210 | return Promise.reject(e); 211 | } 212 | }; 213 | 214 | var track = null; 215 | return function useCameraVideoTrack() { 216 | var _useState5 = React.useState(false), 217 | ready = _useState5[0], 218 | setReady = _useState5[1]; 219 | 220 | var _useState6 = React.useState(null), 221 | agoraRTCError = _useState6[0], 222 | setAgoraRTCError = _useState6[1]; 223 | 224 | var ref = React.useRef(track); 225 | React.useEffect(function () { 226 | if (ref.current === null) { 227 | createClosure().then(function (track) { 228 | ref.current = track; 229 | setReady(true); 230 | }, function (e) { 231 | setAgoraRTCError(e); 232 | }); 233 | } else { 234 | setReady(true); 235 | } 236 | 237 | return function () { 238 | track = null; 239 | }; 240 | }, []); 241 | return { 242 | ready: ready, 243 | track: ref.current, 244 | error: agoraRTCError 245 | }; 246 | }; 247 | } 248 | function createCustomAudioTrack(config) { 249 | var createClosure = function createClosure() { 250 | try { 251 | return Promise.resolve(AgoraRTC__default.createCustomAudioTrack(config)).then(function (_AgoraRTC$createCusto) { 252 | track = _AgoraRTC$createCusto; 253 | return track; 254 | }); 255 | } catch (e) { 256 | return Promise.reject(e); 257 | } 258 | }; 259 | 260 | var track = null; 261 | return function useCustomAudioTrack() { 262 | var _useState7 = React.useState(false), 263 | ready = _useState7[0], 264 | setReady = _useState7[1]; 265 | 266 | var _useState8 = React.useState(null), 267 | agoraRTCError = _useState8[0], 268 | setAgoraRTCError = _useState8[1]; 269 | 270 | var ref = React.useRef(track); 271 | React.useEffect(function () { 272 | if (ref.current === null) { 273 | createClosure().then(function (track) { 274 | ref.current = track; 275 | setReady(true); 276 | }, function (e) { 277 | setAgoraRTCError(e); 278 | }); 279 | } else { 280 | setReady(true); 281 | } 282 | 283 | return function () { 284 | track = null; 285 | }; 286 | }, []); 287 | return { 288 | ready: ready, 289 | track: ref.current, 290 | error: agoraRTCError 291 | }; 292 | }; 293 | } 294 | function createCustomVideoTrack(config) { 295 | var createClosure = function createClosure() { 296 | try { 297 | return Promise.resolve(AgoraRTC__default.createCustomVideoTrack(config)).then(function (_AgoraRTC$createCusto2) { 298 | track = _AgoraRTC$createCusto2; 299 | return track; 300 | }); 301 | } catch (e) { 302 | return Promise.reject(e); 303 | } 304 | }; 305 | 306 | var track = null; 307 | return function useCustomVideoTrack() { 308 | var _useState9 = React.useState(false), 309 | ready = _useState9[0], 310 | setReady = _useState9[1]; 311 | 312 | var _useState10 = React.useState(null), 313 | agoraRTCError = _useState10[0], 314 | setAgoraRTCError = _useState10[1]; 315 | 316 | var ref = React.useRef(track); 317 | React.useEffect(function () { 318 | if (ref.current === null) { 319 | createClosure().then(function (track) { 320 | ref.current = track; 321 | setReady(true); 322 | }, function (e) { 323 | setAgoraRTCError(e); 324 | }); 325 | } else { 326 | setReady(true); 327 | } 328 | 329 | return function () { 330 | track = null; 331 | }; 332 | }, []); 333 | return { 334 | ready: ready, 335 | track: ref.current, 336 | error: agoraRTCError 337 | }; 338 | }; 339 | } 340 | function createMicrophoneAudioTrack(config) { 341 | var createClosure = function createClosure() { 342 | try { 343 | return Promise.resolve(AgoraRTC__default.createMicrophoneAudioTrack(config)).then(function (_AgoraRTC$createMicro2) { 344 | track = _AgoraRTC$createMicro2; 345 | return track; 346 | }); 347 | } catch (e) { 348 | return Promise.reject(e); 349 | } 350 | }; 351 | 352 | var track = null; 353 | return function useMicrophoneAudioTrack() { 354 | var _useState11 = React.useState(false), 355 | ready = _useState11[0], 356 | setReady = _useState11[1]; 357 | 358 | var _useState12 = React.useState(null), 359 | agoraRTCError = _useState12[0], 360 | setAgoraRTCError = _useState12[1]; 361 | 362 | var ref = React.useRef(track); 363 | React.useEffect(function () { 364 | if (ref.current === null) { 365 | createClosure().then(function (track) { 366 | ref.current = track; 367 | setReady(true); 368 | }, function (e) { 369 | setAgoraRTCError(e); 370 | }); 371 | } else { 372 | setReady(true); 373 | } 374 | 375 | return function () { 376 | track = null; 377 | }; 378 | }, []); 379 | return { 380 | ready: ready, 381 | track: ref.current, 382 | error: agoraRTCError 383 | }; 384 | }; 385 | } 386 | function createScreenVideoTrack(config, withAudio) { 387 | var createClosure = function createClosure() { 388 | try { 389 | return Promise.resolve(AgoraRTC__default.createScreenVideoTrack(config, withAudio)).then(function (_AgoraRTC$createScree) { 390 | tracks = _AgoraRTC$createScree; 391 | return tracks; 392 | }); 393 | } catch (e) { 394 | return Promise.reject(e); 395 | } 396 | }; 397 | 398 | var tracks; 399 | return function useScreenVideoTrack() { 400 | var _useState13 = React.useState(false), 401 | ready = _useState13[0], 402 | setReady = _useState13[1]; 403 | 404 | var _useState14 = React.useState(null), 405 | agoraRTCError = _useState14[0], 406 | setAgoraRTCError = _useState14[1]; 407 | 408 | var ref = React.useRef(tracks); 409 | React.useEffect(function () { 410 | if (ref.current === undefined) { 411 | createClosure().then(function (tracks) { 412 | ref.current = tracks; 413 | setReady(true); 414 | }, function (e) { 415 | setAgoraRTCError(e); 416 | }); 417 | } else { 418 | setReady(true); 419 | } 420 | }, []); 421 | return { 422 | ready: ready, 423 | tracks: ref.current, 424 | error: agoraRTCError 425 | }; 426 | }; 427 | } 428 | var AgoraVideoPlayer = function AgoraVideoPlayer(props) { 429 | var vidDiv = React.useRef(null); 430 | 431 | var videoTrack = props.videoTrack, 432 | config = props.config, 433 | other = _objectWithoutPropertiesLoose(props, ["videoTrack", "config"]); 434 | 435 | React.useLayoutEffect(function () { 436 | if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config); 437 | return function () { 438 | videoTrack.stop(); 439 | }; 440 | }, [videoTrack]); 441 | return React__default.createElement("div", Object.assign({}, other, { 442 | ref: vidDiv 443 | })); 444 | }; 445 | 446 | Object.keys(AgoraRTC).forEach(function (k) { 447 | if (k !== 'default') Object.defineProperty(exports, k, { 448 | enumerable: true, 449 | get: function () { 450 | return AgoraRTC[k]; 451 | } 452 | }); 453 | }); 454 | exports.AgoraVideoPlayer = AgoraVideoPlayer; 455 | exports.createBufferSourceAudioTrack = createBufferSourceAudioTrack; 456 | exports.createCameraVideoTrack = createCameraVideoTrack; 457 | exports.createClient = createClient; 458 | exports.createCustomAudioTrack = createCustomAudioTrack; 459 | exports.createCustomVideoTrack = createCustomVideoTrack; 460 | exports.createMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks; 461 | exports.createMicrophoneAudioTrack = createMicrophoneAudioTrack; 462 | exports.createScreenVideoTrack = createScreenVideoTrack; 463 | exports.default = AgoraRTC__default; 464 | //# sourceMappingURL=index.js.map 465 | -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["/**\n * @module Agora React Wrapper\n */\nimport React, { RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport AgoraRTC, {\n BufferSourceAudioTrackInitConfig,\n CameraVideoTrackInitConfig,\n ClientConfig,\n CustomAudioTrackInitConfig,\n CustomVideoTrackInitConfig,\n IAgoraRTCClient,\n IBufferSourceAudioTrack,\n ICameraVideoTrack,\n ILocalAudioTrack,\n ILocalVideoTrack,\n IMicrophoneAudioTrack,\n IRemoteVideoTrack,\n MicrophoneAudioTrackInitConfig,\n ScreenVideoTrackInitConfig,\n VideoPlayerConfig\n} from 'agora-rtc-sdk-ng'\n\nexport default AgoraRTC;\nexport * from 'agora-rtc-sdk-ng';\n\n/**\n * @ignore\n */\nexport interface AgoraRTCError {\n code: AgoraRTCErrorCode;\n message: string;\n data?: any;\n name: string;\n}\n\n/**\n * @ignore\n */\nexport enum AgoraRTCErrorCode {\n UNEXPECTED_ERROR = \"UNEXPECTED_ERROR\",\n UNEXPECTED_RESPONSE = \"UNEXPECTED_RESPONSE\",\n TIMEOUT = \"TIMEOUT\",\n INVALID_PARAMS = \"INVALID_PARAMS\",\n NOT_SUPPORTED = \"NOT_SUPPORTED\",\n INVALID_OPERATION = \"INVALID_OPERATION\",\n OPERATION_ABORTED = \"OPERATION_ABORTED\",\n WEB_SECURITY_RESTRICT = \"WEB_SECURITY_RESTRICT\",\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NETWORK_TIMEOUT = \"NETWORK_TIMEOUT\",\n NETWORK_RESPONSE_ERROR = \"NETWORK_RESPONSE_ERROR\",\n API_INVOKE_TIMEOUT = \"API_INVOKE_TIMEOUT\",\n ENUMERATE_DEVICES_FAILED = \"ENUMERATE_DEVICES_FAILED\",\n DEVICE_NOT_FOUND = \"DEVICE_NOT_FOUND\",\n ELECTRON_IS_NULL = \"ELECTRON_IS_NULL\",\n ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = \"ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR\",\n CHROME_PLUGIN_NO_RESPONSE = \"CHROME_PLUGIN_NO_RESPONSE\",\n CHROME_PLUGIN_NOT_INSTALL = \"CHROME_PLUGIN_NOT_INSTALL\",\n MEDIA_OPTION_INVALID = \"MEDIA_OPTION_INVALID\",\n PERMISSION_DENIED = \"PERMISSION_DENIED\",\n CONSTRAINT_NOT_SATISFIED = \"CONSTRAINT_NOT_SATISFIED\",\n TRACK_IS_DISABLED = \"TRACK_IS_DISABLED\",\n SHARE_AUDIO_NOT_ALLOWED = \"SHARE_AUDIO_NOT_ALLOWED\",\n LOW_STREAM_ENCODING_ERROR = \"LOW_STREAM_ENCODING_ERROR\",\n INVALID_UINT_UID_FROM_STRING_UID = \"INVALID_UINT_UID_FROM_STRING_UID\",\n CAN_NOT_GET_PROXY_SERVER = \"CAN_NOT_GET_PROXY_SERVER\",\n CAN_NOT_GET_GATEWAY_SERVER = \"CAN_NOT_GET_GATEWAY_SERVER\",\n VOID_GATEWAY_ADDRESS = \"VOID_GATEWAY_ADDRESS\",\n UID_CONFLICT = \"UID_CONFLICT\",\n INVALID_LOCAL_TRACK = \"INVALID_LOCAL_TRACK\",\n INVALID_TRACK = \"INVALID_TRACK\",\n SENDER_NOT_FOUND = \"SENDER_NOT_FOUND\",\n CREATE_OFFER_FAILED = \"CREATE_OFFER_FAILED\",\n SET_ANSWER_FAILED = \"SET_ANSWER_FAILED\",\n ICE_FAILED = \"ICE_FAILED\",\n PC_CLOSED = \"PC_CLOSED\",\n SENDER_REPLACE_FAILED = \"SENDER_REPLACE_FAILED\",\n GATEWAY_P2P_LOST = \"GATEWAY_P2P_LOST\",\n NO_ICE_CANDIDATE = \"NO_ICE_CANDIDATE\",\n CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = \"CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS\",\n EXIST_DISABLED_VIDEO_TRACK = \"EXIST_DISABLED_VIDEO_TRACK\",\n INVALID_REMOTE_USER = \"INVALID_REMOTE_USER\",\n REMOTE_USER_IS_NOT_PUBLISHED = \"REMOTE_USER_IS_NOT_PUBLISHED\",\n CUSTOM_REPORT_SEND_FAILED = \"CUSTOM_REPORT_SEND_FAILED\",\n CUSTOM_REPORT_FREQUENCY_TOO_HIGH = \"CUSTOM_REPORT_FREQUENCY_TOO_HIGH\",\n FETCH_AUDIO_FILE_FAILED = \"FETCH_AUDIO_FILE_FAILED\",\n READ_LOCAL_AUDIO_FILE_ERROR = \"READ_LOCAL_AUDIO_FILE_ERROR\",\n DECODE_AUDIO_FILE_FAILED = \"DECODE_AUDIO_FILE_FAILED\",\n WS_ABORT = \"WS_ABORT\",\n WS_DISCONNECT = \"WS_DISCONNECT\",\n WS_ERR = \"WS_ERR\",\n LIVE_STREAMING_TASK_CONFLICT = \"LIVE_STREAMING_TASK_CONFLICT\",\n LIVE_STREAMING_INVALID_ARGUMENT = \"LIVE_STREAMING_INVALID_ARGUMENT\",\n LIVE_STREAMING_INTERNAL_SERVER_ERROR = \"LIVE_STREAMING_INTERNAL_SERVER_ERROR\",\n LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = \"LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED\",\n LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = \"LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED\",\n LIVE_STREAMING_CDN_ERROR = \"LIVE_STREAMING_CDN_ERROR\",\n LIVE_STREAMING_INVALID_RAW_STREAM = \"LIVE_STREAMING_INVALID_RAW_STREAM\",\n LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = \"LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT\",\n LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = \"LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE\",\n LIVE_STREAMING_WARN_FREQUENT_REQUEST = \"LIVE_STREAMING_WARN_FREQUENT_REQUEST\",\n WEBGL_INTERNAL_ERROR = \"WEBGL_INTERNAL_ERROR\",\n BEAUTY_PROCESSOR_INTERNAL_ERROR = \"BEAUTY_PROCESSOR_INTERNAL_ERROR\",\n CROSS_CHANNEL_WAIT_STATUS_ERROR = \"CROSS_CHANNEL_WAIT_STATUS_ERROR\",\n CROSS_CHANNEL_FAILED_JOIN_SRC = \"CROSS_CHANNEL_FAILED_JOIN_SEC\",\n CROSS_CHANNEL_FAILED_JOIN_DEST = \"CROSS_CHANNEL_FAILED_JOIN_DEST\",\n CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = \"CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST\",\n CROSS_CHANNEL_SERVER_ERROR_RESPONSE = \"CROSS_CHANNEL_SERVER_ERROR_RESPONSE\",\n METADATA_OUT_OF_RANGE = \"METADATA_OUT_OF_RANGE\"\n}\n\n/**\n * Initializes a Web SDK client and stores the instance for the lifecycle of the application \n * @param config Configuration for the Web SDK Client instance\n * @returns React hook that gives access to the Web SDK Client instance\n * @category Wrapper\n */\nexport const createClient = (config: ClientConfig) => {\n let client: IAgoraRTCClient\n function createClosure() {\n if (!client) {\n client = AgoraRTC.createClient(config)\n }\n return client\n }\n return () => createClosure()\n}\n\n/**\n * Creates and stores the camera and microphone tracks\n * @param audioConfig Config for the audio track\n * @param videoConfig Config for the video track\n * @returns React hook that can be used to access the camera and microphone tracks\n * @category Wrapper\n */\nexport function createMicrophoneAndCameraTracks(\n audioConfig?: MicrophoneAudioTrackInitConfig | undefined,\n videoConfig?: CameraVideoTrackInitConfig | undefined\n) {\n let tracks: [IMicrophoneAudioTrack, ICameraVideoTrack] | null = null\n async function createClosure() {\n tracks = await AgoraRTC.createMicrophoneAndCameraTracks(\n audioConfig,\n videoConfig\n )\n return tracks\n }\n return function useMicrophoneAndCameraTracks() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(tracks)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((tracks) => {\n ref.current = tracks\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n tracks = null\n }\n }, [])\n return { ready, tracks: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the buffer source audio track\n * @param config Config for the buffer source audio track\n * @returns React hook that can be used to access the buffer source audio track\n * @category Wrapper\n */\nexport function createBufferSourceAudioTrack(\n config: BufferSourceAudioTrackInitConfig\n) {\n let track: IBufferSourceAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createBufferSourceAudioTrack(config)\n return track\n }\n return function useBufferSourceAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the camera track\n * @param config Config for the camera track\n * @returns React hook that can be used to access the camera track\n * @category Wrapper\n */\nexport function createCameraVideoTrack(config?: CameraVideoTrackInitConfig) {\n let track: ICameraVideoTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCameraVideoTrack(config)\n return track\n }\n return function useCameraVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the custom audio track\n * @param config Config for the custom audio track\n * @returns React hook that can be used to access the custom audio track\n * @category Wrapper\n */\nexport function createCustomAudioTrack(config: CustomAudioTrackInitConfig) {\n let track: ILocalAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCustomAudioTrack(config)\n return track\n }\n return function useCustomAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the custom video track\n * @param config Config for the custom video track\n * @returns React hook that can be used to access the custom video track\n * @category Wrapper\n */\nexport function createCustomVideoTrack(config: CustomVideoTrackInitConfig) {\n let track: ILocalVideoTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCustomVideoTrack(config)\n return track\n }\n return function useCustomVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the microphone track\n * @param config Config for the microphone track\n * @returns React hook that can be used to access the microphone track\n * @category Wrapper\n */\nexport function createMicrophoneAudioTrack(\n config?: MicrophoneAudioTrackInitConfig\n) {\n let track: IMicrophoneAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createMicrophoneAudioTrack(config)\n return track\n }\n return function useMicrophoneAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the screenshare tracks\n * @param config Config for the screenshare tracks\n * @param withAudio Try and create audio track as well (needs browser support)\n * @returns React hook that can be used to access the screenshare tracks\n * @category Wrapper\n */\nexport function createScreenVideoTrack(\n config: ScreenVideoTrackInitConfig,\n withAudio?: 'enable' | 'disable' | 'auto'\n) {\n let tracks: [ILocalVideoTrack, ILocalAudioTrack] | ILocalVideoTrack\n async function createClosure() {\n tracks = await AgoraRTC.createScreenVideoTrack(config, withAudio)\n return tracks\n }\n return function useScreenVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(tracks)\n\n useEffect(() => {\n if (ref.current === undefined) {\n createClosure().then((tracks) => {\n ref.current = tracks\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n }, [])\n return { ready, tracks: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * A React component to render the local or remote videoTrack\n * @param props videoTrack and video config \n * @returns An HTML div element containing the provided videoTrack\n */\nexport const AgoraVideoPlayer = (props: React.DetailedHTMLProps, HTMLDivElement> & { videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack } & {config?: VideoPlayerConfig}) => {\n const vidDiv: RefObject = useRef(null)\n const { videoTrack, config, ...other } = props;\n useLayoutEffect(() => {\n if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config)\n return () => {\n videoTrack.stop()\n }\n }, [videoTrack])\n\n return
\n}\n"],"names":["AgoraRTCErrorCode","createClient","config","client","createClosure","AgoraRTC","createMicrophoneAndCameraTracks","audioConfig","videoConfig","tracks","useMicrophoneAndCameraTracks","useState","ready","setReady","agoraRTCError","setAgoraRTCError","ref","useRef","useEffect","current","then","e","error","createBufferSourceAudioTrack","track","useBufferSourceAudioTrack","createCameraVideoTrack","useCameraVideoTrack","createCustomAudioTrack","useCustomAudioTrack","createCustomVideoTrack","useCustomVideoTrack","createMicrophoneAudioTrack","useMicrophoneAudioTrack","createScreenVideoTrack","withAudio","useScreenVideoTrack","undefined","AgoraVideoPlayer","props","vidDiv","videoTrack","other","useLayoutEffect","play","stop","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,WAAYA;AACVA,EAAAA,qCAAA,qBAAA;AACAA,EAAAA,wCAAA,wBAAA;AACAA,EAAAA,4BAAA,YAAA;AACAA,EAAAA,mCAAA,mBAAA;AACAA,EAAAA,kCAAA,kBAAA;AACAA,EAAAA,sCAAA,sBAAA;AACAA,EAAAA,sCAAA,sBAAA;AACAA,EAAAA,0CAAA,0BAAA;AACAA,EAAAA,kCAAA,kBAAA;AACAA,EAAAA,oCAAA,oBAAA;AACAA,EAAAA,2CAAA,2BAAA;AACAA,EAAAA,uCAAA,uBAAA;AACAA,EAAAA,6CAAA,6BAAA;AACAA,EAAAA,qCAAA,qBAAA;AACAA,EAAAA,qCAAA,qBAAA;AACAA,EAAAA,gEAAA,gD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,EAAgCjB,MAAhC;AAC7B,WAAO;AACLuC,MAAAA,UAAU,CAACI,IAAX;AACD,KAFD;AAGD,GALc,EAKZ,CAACJ,UAAD,CALY,CAAf;AAOA,SAAOK,4BAAA,MAAA,oBAASJ;AAAO1B,IAAAA,GAAG,EAAEwB;IAArB,CAAP;AACD;;;;;;;;;;;;;;;;;;;;;"} -------------------------------------------------------------------------------- /dist/index.modern.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useRef, useEffect, useLayoutEffect } from 'react'; 2 | import AgoraRTC__default from 'agora-rtc-sdk-ng'; 3 | export * from 'agora-rtc-sdk-ng'; 4 | 5 | function _objectWithoutPropertiesLoose(source, excluded) { 6 | if (source == null) return {}; 7 | var target = {}; 8 | var sourceKeys = Object.keys(source); 9 | var key, i; 10 | 11 | for (i = 0; i < sourceKeys.length; i++) { 12 | key = sourceKeys[i]; 13 | if (excluded.indexOf(key) >= 0) continue; 14 | target[key] = source[key]; 15 | } 16 | 17 | return target; 18 | } 19 | 20 | var AgoraRTCErrorCode; 21 | 22 | (function (AgoraRTCErrorCode) { 23 | AgoraRTCErrorCode["UNEXPECTED_ERROR"] = "UNEXPECTED_ERROR"; 24 | AgoraRTCErrorCode["UNEXPECTED_RESPONSE"] = "UNEXPECTED_RESPONSE"; 25 | AgoraRTCErrorCode["TIMEOUT"] = "TIMEOUT"; 26 | AgoraRTCErrorCode["INVALID_PARAMS"] = "INVALID_PARAMS"; 27 | AgoraRTCErrorCode["NOT_SUPPORTED"] = "NOT_SUPPORTED"; 28 | AgoraRTCErrorCode["INVALID_OPERATION"] = "INVALID_OPERATION"; 29 | AgoraRTCErrorCode["OPERATION_ABORTED"] = "OPERATION_ABORTED"; 30 | AgoraRTCErrorCode["WEB_SECURITY_RESTRICT"] = "WEB_SECURITY_RESTRICT"; 31 | AgoraRTCErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; 32 | AgoraRTCErrorCode["NETWORK_TIMEOUT"] = "NETWORK_TIMEOUT"; 33 | AgoraRTCErrorCode["NETWORK_RESPONSE_ERROR"] = "NETWORK_RESPONSE_ERROR"; 34 | AgoraRTCErrorCode["API_INVOKE_TIMEOUT"] = "API_INVOKE_TIMEOUT"; 35 | AgoraRTCErrorCode["ENUMERATE_DEVICES_FAILED"] = "ENUMERATE_DEVICES_FAILED"; 36 | AgoraRTCErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND"; 37 | AgoraRTCErrorCode["ELECTRON_IS_NULL"] = "ELECTRON_IS_NULL"; 38 | AgoraRTCErrorCode["ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR"] = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR"; 39 | AgoraRTCErrorCode["CHROME_PLUGIN_NO_RESPONSE"] = "CHROME_PLUGIN_NO_RESPONSE"; 40 | AgoraRTCErrorCode["CHROME_PLUGIN_NOT_INSTALL"] = "CHROME_PLUGIN_NOT_INSTALL"; 41 | AgoraRTCErrorCode["MEDIA_OPTION_INVALID"] = "MEDIA_OPTION_INVALID"; 42 | AgoraRTCErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED"; 43 | AgoraRTCErrorCode["CONSTRAINT_NOT_SATISFIED"] = "CONSTRAINT_NOT_SATISFIED"; 44 | AgoraRTCErrorCode["TRACK_IS_DISABLED"] = "TRACK_IS_DISABLED"; 45 | AgoraRTCErrorCode["SHARE_AUDIO_NOT_ALLOWED"] = "SHARE_AUDIO_NOT_ALLOWED"; 46 | AgoraRTCErrorCode["LOW_STREAM_ENCODING_ERROR"] = "LOW_STREAM_ENCODING_ERROR"; 47 | AgoraRTCErrorCode["INVALID_UINT_UID_FROM_STRING_UID"] = "INVALID_UINT_UID_FROM_STRING_UID"; 48 | AgoraRTCErrorCode["CAN_NOT_GET_PROXY_SERVER"] = "CAN_NOT_GET_PROXY_SERVER"; 49 | AgoraRTCErrorCode["CAN_NOT_GET_GATEWAY_SERVER"] = "CAN_NOT_GET_GATEWAY_SERVER"; 50 | AgoraRTCErrorCode["VOID_GATEWAY_ADDRESS"] = "VOID_GATEWAY_ADDRESS"; 51 | AgoraRTCErrorCode["UID_CONFLICT"] = "UID_CONFLICT"; 52 | AgoraRTCErrorCode["INVALID_LOCAL_TRACK"] = "INVALID_LOCAL_TRACK"; 53 | AgoraRTCErrorCode["INVALID_TRACK"] = "INVALID_TRACK"; 54 | AgoraRTCErrorCode["SENDER_NOT_FOUND"] = "SENDER_NOT_FOUND"; 55 | AgoraRTCErrorCode["CREATE_OFFER_FAILED"] = "CREATE_OFFER_FAILED"; 56 | AgoraRTCErrorCode["SET_ANSWER_FAILED"] = "SET_ANSWER_FAILED"; 57 | AgoraRTCErrorCode["ICE_FAILED"] = "ICE_FAILED"; 58 | AgoraRTCErrorCode["PC_CLOSED"] = "PC_CLOSED"; 59 | AgoraRTCErrorCode["SENDER_REPLACE_FAILED"] = "SENDER_REPLACE_FAILED"; 60 | AgoraRTCErrorCode["GATEWAY_P2P_LOST"] = "GATEWAY_P2P_LOST"; 61 | AgoraRTCErrorCode["NO_ICE_CANDIDATE"] = "NO_ICE_CANDIDATE"; 62 | AgoraRTCErrorCode["CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS"] = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS"; 63 | AgoraRTCErrorCode["EXIST_DISABLED_VIDEO_TRACK"] = "EXIST_DISABLED_VIDEO_TRACK"; 64 | AgoraRTCErrorCode["INVALID_REMOTE_USER"] = "INVALID_REMOTE_USER"; 65 | AgoraRTCErrorCode["REMOTE_USER_IS_NOT_PUBLISHED"] = "REMOTE_USER_IS_NOT_PUBLISHED"; 66 | AgoraRTCErrorCode["CUSTOM_REPORT_SEND_FAILED"] = "CUSTOM_REPORT_SEND_FAILED"; 67 | AgoraRTCErrorCode["CUSTOM_REPORT_FREQUENCY_TOO_HIGH"] = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH"; 68 | AgoraRTCErrorCode["FETCH_AUDIO_FILE_FAILED"] = "FETCH_AUDIO_FILE_FAILED"; 69 | AgoraRTCErrorCode["READ_LOCAL_AUDIO_FILE_ERROR"] = "READ_LOCAL_AUDIO_FILE_ERROR"; 70 | AgoraRTCErrorCode["DECODE_AUDIO_FILE_FAILED"] = "DECODE_AUDIO_FILE_FAILED"; 71 | AgoraRTCErrorCode["WS_ABORT"] = "WS_ABORT"; 72 | AgoraRTCErrorCode["WS_DISCONNECT"] = "WS_DISCONNECT"; 73 | AgoraRTCErrorCode["WS_ERR"] = "WS_ERR"; 74 | AgoraRTCErrorCode["LIVE_STREAMING_TASK_CONFLICT"] = "LIVE_STREAMING_TASK_CONFLICT"; 75 | AgoraRTCErrorCode["LIVE_STREAMING_INVALID_ARGUMENT"] = "LIVE_STREAMING_INVALID_ARGUMENT"; 76 | AgoraRTCErrorCode["LIVE_STREAMING_INTERNAL_SERVER_ERROR"] = "LIVE_STREAMING_INTERNAL_SERVER_ERROR"; 77 | AgoraRTCErrorCode["LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED"] = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED"; 78 | AgoraRTCErrorCode["LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED"] = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED"; 79 | AgoraRTCErrorCode["LIVE_STREAMING_CDN_ERROR"] = "LIVE_STREAMING_CDN_ERROR"; 80 | AgoraRTCErrorCode["LIVE_STREAMING_INVALID_RAW_STREAM"] = "LIVE_STREAMING_INVALID_RAW_STREAM"; 81 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT"] = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT"; 82 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE"] = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE"; 83 | AgoraRTCErrorCode["LIVE_STREAMING_WARN_FREQUENT_REQUEST"] = "LIVE_STREAMING_WARN_FREQUENT_REQUEST"; 84 | AgoraRTCErrorCode["WEBGL_INTERNAL_ERROR"] = "WEBGL_INTERNAL_ERROR"; 85 | AgoraRTCErrorCode["BEAUTY_PROCESSOR_INTERNAL_ERROR"] = "BEAUTY_PROCESSOR_INTERNAL_ERROR"; 86 | AgoraRTCErrorCode["CROSS_CHANNEL_WAIT_STATUS_ERROR"] = "CROSS_CHANNEL_WAIT_STATUS_ERROR"; 87 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_JOIN_SRC"] = "CROSS_CHANNEL_FAILED_JOIN_SEC"; 88 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_JOIN_DEST"] = "CROSS_CHANNEL_FAILED_JOIN_DEST"; 89 | AgoraRTCErrorCode["CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST"] = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST"; 90 | AgoraRTCErrorCode["CROSS_CHANNEL_SERVER_ERROR_RESPONSE"] = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE"; 91 | AgoraRTCErrorCode["METADATA_OUT_OF_RANGE"] = "METADATA_OUT_OF_RANGE"; 92 | })(AgoraRTCErrorCode || (AgoraRTCErrorCode = {})); 93 | 94 | var createClient = function createClient(config) { 95 | var client; 96 | 97 | function createClosure() { 98 | if (!client) { 99 | client = AgoraRTC__default.createClient(config); 100 | } 101 | 102 | return client; 103 | } 104 | 105 | return function () { 106 | return createClosure(); 107 | }; 108 | }; 109 | function createMicrophoneAndCameraTracks(audioConfig, videoConfig) { 110 | var createClosure = function createClosure() { 111 | try { 112 | return Promise.resolve(AgoraRTC__default.createMicrophoneAndCameraTracks(audioConfig, videoConfig)).then(function (_AgoraRTC$createMicro) { 113 | tracks = _AgoraRTC$createMicro; 114 | return tracks; 115 | }); 116 | } catch (e) { 117 | return Promise.reject(e); 118 | } 119 | }; 120 | 121 | var tracks = null; 122 | return function useMicrophoneAndCameraTracks() { 123 | var _useState = useState(false), 124 | ready = _useState[0], 125 | setReady = _useState[1]; 126 | 127 | var _useState2 = useState(null), 128 | agoraRTCError = _useState2[0], 129 | setAgoraRTCError = _useState2[1]; 130 | 131 | var ref = useRef(tracks); 132 | useEffect(function () { 133 | if (ref.current === null) { 134 | createClosure().then(function (tracks) { 135 | ref.current = tracks; 136 | setReady(true); 137 | }, function (e) { 138 | setAgoraRTCError(e); 139 | }); 140 | } else { 141 | setReady(true); 142 | } 143 | 144 | return function () { 145 | tracks = null; 146 | }; 147 | }, []); 148 | return { 149 | ready: ready, 150 | tracks: ref.current, 151 | error: agoraRTCError 152 | }; 153 | }; 154 | } 155 | function createBufferSourceAudioTrack(config) { 156 | var createClosure = function createClosure() { 157 | try { 158 | return Promise.resolve(AgoraRTC__default.createBufferSourceAudioTrack(config)).then(function (_AgoraRTC$createBuffe) { 159 | track = _AgoraRTC$createBuffe; 160 | return track; 161 | }); 162 | } catch (e) { 163 | return Promise.reject(e); 164 | } 165 | }; 166 | 167 | var track = null; 168 | return function useBufferSourceAudioTrack() { 169 | var _useState3 = useState(false), 170 | ready = _useState3[0], 171 | setReady = _useState3[1]; 172 | 173 | var _useState4 = useState(null), 174 | agoraRTCError = _useState4[0], 175 | setAgoraRTCError = _useState4[1]; 176 | 177 | var ref = useRef(track); 178 | useEffect(function () { 179 | if (ref.current === null) { 180 | createClosure().then(function (track) { 181 | ref.current = track; 182 | setReady(true); 183 | }, function (e) { 184 | setAgoraRTCError(e); 185 | }); 186 | } else { 187 | setReady(true); 188 | } 189 | 190 | return function () { 191 | track = null; 192 | }; 193 | }, []); 194 | return { 195 | ready: ready, 196 | track: ref.current, 197 | error: agoraRTCError 198 | }; 199 | }; 200 | } 201 | function createCameraVideoTrack(config) { 202 | var createClosure = function createClosure() { 203 | try { 204 | return Promise.resolve(AgoraRTC__default.createCameraVideoTrack(config)).then(function (_AgoraRTC$createCamer) { 205 | track = _AgoraRTC$createCamer; 206 | return track; 207 | }); 208 | } catch (e) { 209 | return Promise.reject(e); 210 | } 211 | }; 212 | 213 | var track = null; 214 | return function useCameraVideoTrack() { 215 | var _useState5 = useState(false), 216 | ready = _useState5[0], 217 | setReady = _useState5[1]; 218 | 219 | var _useState6 = useState(null), 220 | agoraRTCError = _useState6[0], 221 | setAgoraRTCError = _useState6[1]; 222 | 223 | var ref = useRef(track); 224 | useEffect(function () { 225 | if (ref.current === null) { 226 | createClosure().then(function (track) { 227 | ref.current = track; 228 | setReady(true); 229 | }, function (e) { 230 | setAgoraRTCError(e); 231 | }); 232 | } else { 233 | setReady(true); 234 | } 235 | 236 | return function () { 237 | track = null; 238 | }; 239 | }, []); 240 | return { 241 | ready: ready, 242 | track: ref.current, 243 | error: agoraRTCError 244 | }; 245 | }; 246 | } 247 | function createCustomAudioTrack(config) { 248 | var createClosure = function createClosure() { 249 | try { 250 | return Promise.resolve(AgoraRTC__default.createCustomAudioTrack(config)).then(function (_AgoraRTC$createCusto) { 251 | track = _AgoraRTC$createCusto; 252 | return track; 253 | }); 254 | } catch (e) { 255 | return Promise.reject(e); 256 | } 257 | }; 258 | 259 | var track = null; 260 | return function useCustomAudioTrack() { 261 | var _useState7 = useState(false), 262 | ready = _useState7[0], 263 | setReady = _useState7[1]; 264 | 265 | var _useState8 = useState(null), 266 | agoraRTCError = _useState8[0], 267 | setAgoraRTCError = _useState8[1]; 268 | 269 | var ref = useRef(track); 270 | useEffect(function () { 271 | if (ref.current === null) { 272 | createClosure().then(function (track) { 273 | ref.current = track; 274 | setReady(true); 275 | }, function (e) { 276 | setAgoraRTCError(e); 277 | }); 278 | } else { 279 | setReady(true); 280 | } 281 | 282 | return function () { 283 | track = null; 284 | }; 285 | }, []); 286 | return { 287 | ready: ready, 288 | track: ref.current, 289 | error: agoraRTCError 290 | }; 291 | }; 292 | } 293 | function createCustomVideoTrack(config) { 294 | var createClosure = function createClosure() { 295 | try { 296 | return Promise.resolve(AgoraRTC__default.createCustomVideoTrack(config)).then(function (_AgoraRTC$createCusto2) { 297 | track = _AgoraRTC$createCusto2; 298 | return track; 299 | }); 300 | } catch (e) { 301 | return Promise.reject(e); 302 | } 303 | }; 304 | 305 | var track = null; 306 | return function useCustomVideoTrack() { 307 | var _useState9 = useState(false), 308 | ready = _useState9[0], 309 | setReady = _useState9[1]; 310 | 311 | var _useState10 = useState(null), 312 | agoraRTCError = _useState10[0], 313 | setAgoraRTCError = _useState10[1]; 314 | 315 | var ref = useRef(track); 316 | useEffect(function () { 317 | if (ref.current === null) { 318 | createClosure().then(function (track) { 319 | ref.current = track; 320 | setReady(true); 321 | }, function (e) { 322 | setAgoraRTCError(e); 323 | }); 324 | } else { 325 | setReady(true); 326 | } 327 | 328 | return function () { 329 | track = null; 330 | }; 331 | }, []); 332 | return { 333 | ready: ready, 334 | track: ref.current, 335 | error: agoraRTCError 336 | }; 337 | }; 338 | } 339 | function createMicrophoneAudioTrack(config) { 340 | var createClosure = function createClosure() { 341 | try { 342 | return Promise.resolve(AgoraRTC__default.createMicrophoneAudioTrack(config)).then(function (_AgoraRTC$createMicro2) { 343 | track = _AgoraRTC$createMicro2; 344 | return track; 345 | }); 346 | } catch (e) { 347 | return Promise.reject(e); 348 | } 349 | }; 350 | 351 | var track = null; 352 | return function useMicrophoneAudioTrack() { 353 | var _useState11 = useState(false), 354 | ready = _useState11[0], 355 | setReady = _useState11[1]; 356 | 357 | var _useState12 = useState(null), 358 | agoraRTCError = _useState12[0], 359 | setAgoraRTCError = _useState12[1]; 360 | 361 | var ref = useRef(track); 362 | useEffect(function () { 363 | if (ref.current === null) { 364 | createClosure().then(function (track) { 365 | ref.current = track; 366 | setReady(true); 367 | }, function (e) { 368 | setAgoraRTCError(e); 369 | }); 370 | } else { 371 | setReady(true); 372 | } 373 | 374 | return function () { 375 | track = null; 376 | }; 377 | }, []); 378 | return { 379 | ready: ready, 380 | track: ref.current, 381 | error: agoraRTCError 382 | }; 383 | }; 384 | } 385 | function createScreenVideoTrack(config, withAudio) { 386 | var createClosure = function createClosure() { 387 | try { 388 | return Promise.resolve(AgoraRTC__default.createScreenVideoTrack(config, withAudio)).then(function (_AgoraRTC$createScree) { 389 | tracks = _AgoraRTC$createScree; 390 | return tracks; 391 | }); 392 | } catch (e) { 393 | return Promise.reject(e); 394 | } 395 | }; 396 | 397 | var tracks; 398 | return function useScreenVideoTrack() { 399 | var _useState13 = useState(false), 400 | ready = _useState13[0], 401 | setReady = _useState13[1]; 402 | 403 | var _useState14 = useState(null), 404 | agoraRTCError = _useState14[0], 405 | setAgoraRTCError = _useState14[1]; 406 | 407 | var ref = useRef(tracks); 408 | useEffect(function () { 409 | if (ref.current === undefined) { 410 | createClosure().then(function (tracks) { 411 | ref.current = tracks; 412 | setReady(true); 413 | }, function (e) { 414 | setAgoraRTCError(e); 415 | }); 416 | } else { 417 | setReady(true); 418 | } 419 | }, []); 420 | return { 421 | ready: ready, 422 | tracks: ref.current, 423 | error: agoraRTCError 424 | }; 425 | }; 426 | } 427 | var AgoraVideoPlayer = function AgoraVideoPlayer(props) { 428 | var vidDiv = useRef(null); 429 | 430 | var videoTrack = props.videoTrack, 431 | config = props.config, 432 | other = _objectWithoutPropertiesLoose(props, ["videoTrack", "config"]); 433 | 434 | useLayoutEffect(function () { 435 | if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config); 436 | return function () { 437 | videoTrack.stop(); 438 | }; 439 | }, [videoTrack]); 440 | return React.createElement("div", Object.assign({}, other, { 441 | ref: vidDiv 442 | })); 443 | }; 444 | 445 | export default AgoraRTC__default; 446 | export { AgoraRTCErrorCode, AgoraVideoPlayer, createBufferSourceAudioTrack, createCameraVideoTrack, createClient, createCustomAudioTrack, createCustomVideoTrack, createMicrophoneAndCameraTracks, createMicrophoneAudioTrack, createScreenVideoTrack }; 447 | //# sourceMappingURL=index.modern.js.map 448 | -------------------------------------------------------------------------------- /dist/index.modern.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.modern.js","sources":["../src/index.tsx"],"sourcesContent":["/**\n * @module Agora React Wrapper\n */\nimport React, { RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport AgoraRTC, {\n BufferSourceAudioTrackInitConfig,\n CameraVideoTrackInitConfig,\n ClientConfig,\n CustomAudioTrackInitConfig,\n CustomVideoTrackInitConfig,\n IAgoraRTCClient,\n IBufferSourceAudioTrack,\n ICameraVideoTrack,\n ILocalAudioTrack,\n ILocalVideoTrack,\n IMicrophoneAudioTrack,\n IRemoteVideoTrack,\n MicrophoneAudioTrackInitConfig,\n ScreenVideoTrackInitConfig,\n VideoPlayerConfig\n} from 'agora-rtc-sdk-ng'\n\nexport default AgoraRTC;\nexport * from 'agora-rtc-sdk-ng';\n\n/**\n * @ignore\n */\nexport interface AgoraRTCError {\n code: AgoraRTCErrorCode;\n message: string;\n data?: any;\n name: string;\n}\n\n/**\n * @ignore\n */\nexport enum AgoraRTCErrorCode {\n UNEXPECTED_ERROR = \"UNEXPECTED_ERROR\",\n UNEXPECTED_RESPONSE = \"UNEXPECTED_RESPONSE\",\n TIMEOUT = \"TIMEOUT\",\n INVALID_PARAMS = \"INVALID_PARAMS\",\n NOT_SUPPORTED = \"NOT_SUPPORTED\",\n INVALID_OPERATION = \"INVALID_OPERATION\",\n OPERATION_ABORTED = \"OPERATION_ABORTED\",\n WEB_SECURITY_RESTRICT = \"WEB_SECURITY_RESTRICT\",\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NETWORK_TIMEOUT = \"NETWORK_TIMEOUT\",\n NETWORK_RESPONSE_ERROR = \"NETWORK_RESPONSE_ERROR\",\n API_INVOKE_TIMEOUT = \"API_INVOKE_TIMEOUT\",\n ENUMERATE_DEVICES_FAILED = \"ENUMERATE_DEVICES_FAILED\",\n DEVICE_NOT_FOUND = \"DEVICE_NOT_FOUND\",\n ELECTRON_IS_NULL = \"ELECTRON_IS_NULL\",\n ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = \"ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR\",\n CHROME_PLUGIN_NO_RESPONSE = \"CHROME_PLUGIN_NO_RESPONSE\",\n CHROME_PLUGIN_NOT_INSTALL = \"CHROME_PLUGIN_NOT_INSTALL\",\n MEDIA_OPTION_INVALID = \"MEDIA_OPTION_INVALID\",\n PERMISSION_DENIED = \"PERMISSION_DENIED\",\n CONSTRAINT_NOT_SATISFIED = \"CONSTRAINT_NOT_SATISFIED\",\n TRACK_IS_DISABLED = \"TRACK_IS_DISABLED\",\n SHARE_AUDIO_NOT_ALLOWED = \"SHARE_AUDIO_NOT_ALLOWED\",\n LOW_STREAM_ENCODING_ERROR = \"LOW_STREAM_ENCODING_ERROR\",\n INVALID_UINT_UID_FROM_STRING_UID = \"INVALID_UINT_UID_FROM_STRING_UID\",\n CAN_NOT_GET_PROXY_SERVER = \"CAN_NOT_GET_PROXY_SERVER\",\n CAN_NOT_GET_GATEWAY_SERVER = \"CAN_NOT_GET_GATEWAY_SERVER\",\n VOID_GATEWAY_ADDRESS = \"VOID_GATEWAY_ADDRESS\",\n UID_CONFLICT = \"UID_CONFLICT\",\n INVALID_LOCAL_TRACK = \"INVALID_LOCAL_TRACK\",\n INVALID_TRACK = \"INVALID_TRACK\",\n SENDER_NOT_FOUND = \"SENDER_NOT_FOUND\",\n CREATE_OFFER_FAILED = \"CREATE_OFFER_FAILED\",\n SET_ANSWER_FAILED = \"SET_ANSWER_FAILED\",\n ICE_FAILED = \"ICE_FAILED\",\n PC_CLOSED = \"PC_CLOSED\",\n SENDER_REPLACE_FAILED = \"SENDER_REPLACE_FAILED\",\n GATEWAY_P2P_LOST = \"GATEWAY_P2P_LOST\",\n NO_ICE_CANDIDATE = \"NO_ICE_CANDIDATE\",\n CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = \"CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS\",\n EXIST_DISABLED_VIDEO_TRACK = \"EXIST_DISABLED_VIDEO_TRACK\",\n INVALID_REMOTE_USER = \"INVALID_REMOTE_USER\",\n REMOTE_USER_IS_NOT_PUBLISHED = \"REMOTE_USER_IS_NOT_PUBLISHED\",\n CUSTOM_REPORT_SEND_FAILED = \"CUSTOM_REPORT_SEND_FAILED\",\n CUSTOM_REPORT_FREQUENCY_TOO_HIGH = \"CUSTOM_REPORT_FREQUENCY_TOO_HIGH\",\n FETCH_AUDIO_FILE_FAILED = \"FETCH_AUDIO_FILE_FAILED\",\n READ_LOCAL_AUDIO_FILE_ERROR = \"READ_LOCAL_AUDIO_FILE_ERROR\",\n DECODE_AUDIO_FILE_FAILED = \"DECODE_AUDIO_FILE_FAILED\",\n WS_ABORT = \"WS_ABORT\",\n WS_DISCONNECT = \"WS_DISCONNECT\",\n WS_ERR = \"WS_ERR\",\n LIVE_STREAMING_TASK_CONFLICT = \"LIVE_STREAMING_TASK_CONFLICT\",\n LIVE_STREAMING_INVALID_ARGUMENT = \"LIVE_STREAMING_INVALID_ARGUMENT\",\n LIVE_STREAMING_INTERNAL_SERVER_ERROR = \"LIVE_STREAMING_INTERNAL_SERVER_ERROR\",\n LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = \"LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED\",\n LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = \"LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED\",\n LIVE_STREAMING_CDN_ERROR = \"LIVE_STREAMING_CDN_ERROR\",\n LIVE_STREAMING_INVALID_RAW_STREAM = \"LIVE_STREAMING_INVALID_RAW_STREAM\",\n LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = \"LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT\",\n LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = \"LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE\",\n LIVE_STREAMING_WARN_FREQUENT_REQUEST = \"LIVE_STREAMING_WARN_FREQUENT_REQUEST\",\n WEBGL_INTERNAL_ERROR = \"WEBGL_INTERNAL_ERROR\",\n BEAUTY_PROCESSOR_INTERNAL_ERROR = \"BEAUTY_PROCESSOR_INTERNAL_ERROR\",\n CROSS_CHANNEL_WAIT_STATUS_ERROR = \"CROSS_CHANNEL_WAIT_STATUS_ERROR\",\n CROSS_CHANNEL_FAILED_JOIN_SRC = \"CROSS_CHANNEL_FAILED_JOIN_SEC\",\n CROSS_CHANNEL_FAILED_JOIN_DEST = \"CROSS_CHANNEL_FAILED_JOIN_DEST\",\n CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = \"CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST\",\n CROSS_CHANNEL_SERVER_ERROR_RESPONSE = \"CROSS_CHANNEL_SERVER_ERROR_RESPONSE\",\n METADATA_OUT_OF_RANGE = \"METADATA_OUT_OF_RANGE\"\n}\n\n/**\n * Initializes a Web SDK client and stores the instance for the lifecycle of the application \n * @param config Configuration for the Web SDK Client instance\n * @returns React hook that gives access to the Web SDK Client instance\n * @category Wrapper\n */\nexport const createClient = (config: ClientConfig) => {\n let client: IAgoraRTCClient\n function createClosure() {\n if (!client) {\n client = AgoraRTC.createClient(config)\n }\n return client\n }\n return () => createClosure()\n}\n\n/**\n * Creates and stores the camera and microphone tracks\n * @param audioConfig Config for the audio track\n * @param videoConfig Config for the video track\n * @returns React hook that can be used to access the camera and microphone tracks\n * @category Wrapper\n */\nexport function createMicrophoneAndCameraTracks(\n audioConfig?: MicrophoneAudioTrackInitConfig | undefined,\n videoConfig?: CameraVideoTrackInitConfig | undefined\n) {\n let tracks: [IMicrophoneAudioTrack, ICameraVideoTrack] | null = null\n async function createClosure() {\n tracks = await AgoraRTC.createMicrophoneAndCameraTracks(\n audioConfig,\n videoConfig\n )\n return tracks\n }\n return function useMicrophoneAndCameraTracks() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(tracks)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((tracks) => {\n ref.current = tracks\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n tracks = null\n }\n }, [])\n return { ready, tracks: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the buffer source audio track\n * @param config Config for the buffer source audio track\n * @returns React hook that can be used to access the buffer source audio track\n * @category Wrapper\n */\nexport function createBufferSourceAudioTrack(\n config: BufferSourceAudioTrackInitConfig\n) {\n let track: IBufferSourceAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createBufferSourceAudioTrack(config)\n return track\n }\n return function useBufferSourceAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the camera track\n * @param config Config for the camera track\n * @returns React hook that can be used to access the camera track\n * @category Wrapper\n */\nexport function createCameraVideoTrack(config?: CameraVideoTrackInitConfig) {\n let track: ICameraVideoTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCameraVideoTrack(config)\n return track\n }\n return function useCameraVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the custom audio track\n * @param config Config for the custom audio track\n * @returns React hook that can be used to access the custom audio track\n * @category Wrapper\n */\nexport function createCustomAudioTrack(config: CustomAudioTrackInitConfig) {\n let track: ILocalAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCustomAudioTrack(config)\n return track\n }\n return function useCustomAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the custom video track\n * @param config Config for the custom video track\n * @returns React hook that can be used to access the custom video track\n * @category Wrapper\n */\nexport function createCustomVideoTrack(config: CustomVideoTrackInitConfig) {\n let track: ILocalVideoTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createCustomVideoTrack(config)\n return track\n }\n return function useCustomVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the microphone track\n * @param config Config for the microphone track\n * @returns React hook that can be used to access the microphone track\n * @category Wrapper\n */\nexport function createMicrophoneAudioTrack(\n config?: MicrophoneAudioTrackInitConfig\n) {\n let track: IMicrophoneAudioTrack | null = null\n async function createClosure() {\n track = await AgoraRTC.createMicrophoneAudioTrack(config)\n return track\n }\n return function useMicrophoneAudioTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(track)\n\n useEffect(() => {\n if (ref.current === null) {\n createClosure().then((track) => {\n ref.current = track\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n return () => {\n track = null\n }\n }, [])\n return { ready, track: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * Creates and stores the screenshare tracks\n * @param config Config for the screenshare tracks\n * @param withAudio Try and create audio track as well (needs browser support)\n * @returns React hook that can be used to access the screenshare tracks\n * @category Wrapper\n */\nexport function createScreenVideoTrack(\n config: ScreenVideoTrackInitConfig,\n withAudio?: 'enable' | 'disable' | 'auto'\n) {\n let tracks: [ILocalVideoTrack, ILocalAudioTrack] | ILocalVideoTrack\n async function createClosure() {\n tracks = await AgoraRTC.createScreenVideoTrack(config, withAudio)\n return tracks\n }\n return function useScreenVideoTrack() {\n const [ready, setReady] = useState(false)\n const [agoraRTCError, setAgoraRTCError] = useState(null)\n const ref = useRef(tracks)\n\n useEffect(() => {\n if (ref.current === undefined) {\n createClosure().then((tracks) => {\n ref.current = tracks\n setReady(true)\n }, (e) => {\n setAgoraRTCError(e)\n })\n } else {\n setReady(true)\n }\n }, [])\n return { ready, tracks: ref.current, error: agoraRTCError }\n }\n}\n\n/**\n * A React component to render the local or remote videoTrack\n * @param props videoTrack and video config \n * @returns An HTML div element containing the provided videoTrack\n */\nexport const AgoraVideoPlayer = (props: React.DetailedHTMLProps, HTMLDivElement> & { videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack } & {config?: VideoPlayerConfig}) => {\n const vidDiv: RefObject = useRef(null)\n const { videoTrack, config, ...other } = props;\n useLayoutEffect(() => {\n if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config)\n return () => {\n videoTrack.stop()\n }\n }, [videoTrack])\n\n return
\n}\n"],"names":["AgoraRTCErrorCode","createClient","config","client","createClosure","AgoraRTC","createMicrophoneAndCameraTracks","audioConfig","videoConfig","tracks","useMicrophoneAndCameraTracks","useState","ready","setReady","agoraRTCError","setAgoraRTCError","ref","useRef","useEffect","current","then","e","error","createBufferSourceAudioTrack","track","useBufferSourceAudioTrack","createCameraVideoTrack","useCameraVideoTrack","createCustomAudioTrack","useCustomAudioTrack","createCustomVideoTrack","useCustomVideoTrack","createMicrophoneAudioTrack","useMicrophoneAudioTrack","createScreenVideoTrack","withAudio","useScreenVideoTrack","undefined","AgoraVideoPlayer","props","vidDiv","videoTrack","other","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Q,CAAC,IAAD,CAAR;AACD;AACF,KAXQ,EAWN,EAXM,CAAT;AAYA,WAAO;AAAED,MAAAA,KAAK,EAALA,KAAF;AAASH,MAAAA,MAAM,EAAEO,GAAG,CAACG,OAArB;AAA8BG,MAAAA,KAAK,EAAER;AAArC,KAAP;AACD,GAlBD;AAmBD;IAOYwB,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,KAAD;AAC9B,MAAMC,MAAM,GAA8BvB,MAAM,CAAC,IAAD,CAAhD;;MACQwB,aAAiCF,MAAjCE;MAAYvC,SAAqBqC,MAArBrC;MAAWwC,sCAAUH;;AACzCI,EAAAA,eAAe,CAAC;AACd,QAAIH,MAAM,CAACrB,OAAP,KAAmB,IAAvB,EAA6BsB,UAAU,CAACG,IAAX,CAAgBJ,MAAM,CAACrB,OAAvB,EAAgCjB,MAAhC;AAC7B,WAAO;AACLuC,MAAAA,UAAU,CAACI,IAAX;AACD,KAFD;AAGD,GALc,EAKZ,CAACJ,UAAD,CALY,CAAf;AAOA,SAAOK,mBAAA,MAAA,oBAASJ;AAAO1B,IAAAA,GAAG,EAAEwB;IAArB,CAAP;AACD;;;;;"} -------------------------------------------------------------------------------- /dist/index.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/assets/highlight.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-hl-0: #000000; 3 | --dark-hl-0: #D4D4D4; 4 | --light-hl-1: #AF00DB; 5 | --dark-hl-1: #C586C0; 6 | --light-hl-2: #001080; 7 | --dark-hl-2: #9CDCFE; 8 | --light-hl-3: #A31515; 9 | --dark-hl-3: #CE9178; 10 | --light-hl-4: #0000FF; 11 | --dark-hl-4: #569CD6; 12 | --light-hl-5: #0070C1; 13 | --dark-hl-5: #4FC1FF; 14 | --light-hl-6: #795E26; 15 | --dark-hl-6: #DCDCAA; 16 | --light-hl-7: #800000; 17 | --dark-hl-7: #808080; 18 | --light-hl-8: #267F99; 19 | --dark-hl-8: #4EC9B0; 20 | --light-hl-9: #FF0000; 21 | --dark-hl-9: #9CDCFE; 22 | --light-hl-10: #000000FF; 23 | --dark-hl-10: #D4D4D4; 24 | --light-hl-11: #098658; 25 | --dark-hl-11: #B5CEA8; 26 | --light-code-background: #F5F5F5; 27 | --dark-code-background: #1E1E1E; 28 | } 29 | 30 | @media (prefers-color-scheme: light) { :root { 31 | --hl-0: var(--light-hl-0); 32 | --hl-1: var(--light-hl-1); 33 | --hl-2: var(--light-hl-2); 34 | --hl-3: var(--light-hl-3); 35 | --hl-4: var(--light-hl-4); 36 | --hl-5: var(--light-hl-5); 37 | --hl-6: var(--light-hl-6); 38 | --hl-7: var(--light-hl-7); 39 | --hl-8: var(--light-hl-8); 40 | --hl-9: var(--light-hl-9); 41 | --hl-10: var(--light-hl-10); 42 | --hl-11: var(--light-hl-11); 43 | --code-background: var(--light-code-background); 44 | } } 45 | 46 | @media (prefers-color-scheme: dark) { :root { 47 | --hl-0: var(--dark-hl-0); 48 | --hl-1: var(--dark-hl-1); 49 | --hl-2: var(--dark-hl-2); 50 | --hl-3: var(--dark-hl-3); 51 | --hl-4: var(--dark-hl-4); 52 | --hl-5: var(--dark-hl-5); 53 | --hl-6: var(--dark-hl-6); 54 | --hl-7: var(--dark-hl-7); 55 | --hl-8: var(--dark-hl-8); 56 | --hl-9: var(--dark-hl-9); 57 | --hl-10: var(--dark-hl-10); 58 | --hl-11: var(--dark-hl-11); 59 | --code-background: var(--dark-code-background); 60 | } } 61 | 62 | body.light { 63 | --hl-0: var(--light-hl-0); 64 | --hl-1: var(--light-hl-1); 65 | --hl-2: var(--light-hl-2); 66 | --hl-3: var(--light-hl-3); 67 | --hl-4: var(--light-hl-4); 68 | --hl-5: var(--light-hl-5); 69 | --hl-6: var(--light-hl-6); 70 | --hl-7: var(--light-hl-7); 71 | --hl-8: var(--light-hl-8); 72 | --hl-9: var(--light-hl-9); 73 | --hl-10: var(--light-hl-10); 74 | --hl-11: var(--light-hl-11); 75 | --code-background: var(--light-code-background); 76 | } 77 | 78 | body.dark { 79 | --hl-0: var(--dark-hl-0); 80 | --hl-1: var(--dark-hl-1); 81 | --hl-2: var(--dark-hl-2); 82 | --hl-3: var(--dark-hl-3); 83 | --hl-4: var(--dark-hl-4); 84 | --hl-5: var(--dark-hl-5); 85 | --hl-6: var(--dark-hl-6); 86 | --hl-7: var(--dark-hl-7); 87 | --hl-8: var(--dark-hl-8); 88 | --hl-9: var(--dark-hl-9); 89 | --hl-10: var(--dark-hl-10); 90 | --hl-11: var(--dark-hl-11); 91 | --code-background: var(--dark-code-background); 92 | } 93 | 94 | .hl-0 { color: var(--hl-0); } 95 | .hl-1 { color: var(--hl-1); } 96 | .hl-2 { color: var(--hl-2); } 97 | .hl-3 { color: var(--hl-3); } 98 | .hl-4 { color: var(--hl-4); } 99 | .hl-5 { color: var(--hl-5); } 100 | .hl-6 { color: var(--hl-6); } 101 | .hl-7 { color: var(--hl-7); } 102 | .hl-8 { color: var(--hl-8); } 103 | .hl-9 { color: var(--hl-9); } 104 | .hl-10 { color: var(--hl-10); } 105 | .hl-11 { color: var(--hl-11); } 106 | pre, code { background: var(--code-background); } 107 | -------------------------------------------------------------------------------- /docs/assets/icons.css: -------------------------------------------------------------------------------- 1 | .tsd-kind-icon { 2 | display: block; 3 | position: relative; 4 | padding-left: 20px; 5 | text-indent: -20px; 6 | } 7 | .tsd-kind-icon:before { 8 | content: ""; 9 | display: inline-block; 10 | vertical-align: middle; 11 | width: 17px; 12 | height: 17px; 13 | margin: 0 3px 2px 0; 14 | background-image: url(./icons.png); 15 | } 16 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { 17 | .tsd-kind-icon:before { 18 | background-image: url(./icons@2x.png); 19 | background-size: 238px 204px; 20 | } 21 | } 22 | 23 | .tsd-signature.tsd-kind-icon:before { 24 | background-position: 0 -153px; 25 | } 26 | 27 | .tsd-kind-object-literal > .tsd-kind-icon:before { 28 | background-position: 0px -17px; 29 | } 30 | .tsd-kind-object-literal.tsd-is-protected > .tsd-kind-icon:before { 31 | background-position: -17px -17px; 32 | } 33 | .tsd-kind-object-literal.tsd-is-private > .tsd-kind-icon:before { 34 | background-position: -34px -17px; 35 | } 36 | 37 | .tsd-kind-class > .tsd-kind-icon:before { 38 | background-position: 0px -34px; 39 | } 40 | .tsd-kind-class.tsd-is-protected > .tsd-kind-icon:before { 41 | background-position: -17px -34px; 42 | } 43 | .tsd-kind-class.tsd-is-private > .tsd-kind-icon:before { 44 | background-position: -34px -34px; 45 | } 46 | 47 | .tsd-kind-class.tsd-has-type-parameter > .tsd-kind-icon:before { 48 | background-position: 0px -51px; 49 | } 50 | .tsd-kind-class.tsd-has-type-parameter.tsd-is-protected 51 | > .tsd-kind-icon:before { 52 | background-position: -17px -51px; 53 | } 54 | .tsd-kind-class.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { 55 | background-position: -34px -51px; 56 | } 57 | 58 | .tsd-kind-interface > .tsd-kind-icon:before { 59 | background-position: 0px -68px; 60 | } 61 | .tsd-kind-interface.tsd-is-protected > .tsd-kind-icon:before { 62 | background-position: -17px -68px; 63 | } 64 | .tsd-kind-interface.tsd-is-private > .tsd-kind-icon:before { 65 | background-position: -34px -68px; 66 | } 67 | 68 | .tsd-kind-interface.tsd-has-type-parameter > .tsd-kind-icon:before { 69 | background-position: 0px -85px; 70 | } 71 | .tsd-kind-interface.tsd-has-type-parameter.tsd-is-protected 72 | > .tsd-kind-icon:before { 73 | background-position: -17px -85px; 74 | } 75 | .tsd-kind-interface.tsd-has-type-parameter.tsd-is-private 76 | > .tsd-kind-icon:before { 77 | background-position: -34px -85px; 78 | } 79 | 80 | .tsd-kind-namespace > .tsd-kind-icon:before { 81 | background-position: 0px -102px; 82 | } 83 | .tsd-kind-namespace.tsd-is-protected > .tsd-kind-icon:before { 84 | background-position: -17px -102px; 85 | } 86 | .tsd-kind-namespace.tsd-is-private > .tsd-kind-icon:before { 87 | background-position: -34px -102px; 88 | } 89 | 90 | .tsd-kind-module > .tsd-kind-icon:before { 91 | background-position: 0px -102px; 92 | } 93 | .tsd-kind-module.tsd-is-protected > .tsd-kind-icon:before { 94 | background-position: -17px -102px; 95 | } 96 | .tsd-kind-module.tsd-is-private > .tsd-kind-icon:before { 97 | background-position: -34px -102px; 98 | } 99 | 100 | .tsd-kind-enum > .tsd-kind-icon:before { 101 | background-position: 0px -119px; 102 | } 103 | .tsd-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 104 | background-position: -17px -119px; 105 | } 106 | .tsd-kind-enum.tsd-is-private > .tsd-kind-icon:before { 107 | background-position: -34px -119px; 108 | } 109 | 110 | .tsd-kind-enum-member > .tsd-kind-icon:before { 111 | background-position: 0px -136px; 112 | } 113 | .tsd-kind-enum-member.tsd-is-protected > .tsd-kind-icon:before { 114 | background-position: -17px -136px; 115 | } 116 | .tsd-kind-enum-member.tsd-is-private > .tsd-kind-icon:before { 117 | background-position: -34px -136px; 118 | } 119 | 120 | .tsd-kind-signature > .tsd-kind-icon:before { 121 | background-position: 0px -153px; 122 | } 123 | .tsd-kind-signature.tsd-is-protected > .tsd-kind-icon:before { 124 | background-position: -17px -153px; 125 | } 126 | .tsd-kind-signature.tsd-is-private > .tsd-kind-icon:before { 127 | background-position: -34px -153px; 128 | } 129 | 130 | .tsd-kind-type-alias > .tsd-kind-icon:before { 131 | background-position: 0px -170px; 132 | } 133 | .tsd-kind-type-alias.tsd-is-protected > .tsd-kind-icon:before { 134 | background-position: -17px -170px; 135 | } 136 | .tsd-kind-type-alias.tsd-is-private > .tsd-kind-icon:before { 137 | background-position: -34px -170px; 138 | } 139 | 140 | .tsd-kind-type-alias.tsd-has-type-parameter > .tsd-kind-icon:before { 141 | background-position: 0px -187px; 142 | } 143 | .tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-protected 144 | > .tsd-kind-icon:before { 145 | background-position: -17px -187px; 146 | } 147 | .tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-private 148 | > .tsd-kind-icon:before { 149 | background-position: -34px -187px; 150 | } 151 | 152 | .tsd-kind-variable > .tsd-kind-icon:before { 153 | background-position: -136px -0px; 154 | } 155 | .tsd-kind-variable.tsd-is-protected > .tsd-kind-icon:before { 156 | background-position: -153px -0px; 157 | } 158 | .tsd-kind-variable.tsd-is-private > .tsd-kind-icon:before { 159 | background-position: -119px -0px; 160 | } 161 | .tsd-kind-variable.tsd-parent-kind-class > .tsd-kind-icon:before { 162 | background-position: -51px -0px; 163 | } 164 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-inherited 165 | > .tsd-kind-icon:before { 166 | background-position: -68px -0px; 167 | } 168 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected 169 | > .tsd-kind-icon:before { 170 | background-position: -85px -0px; 171 | } 172 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 173 | > .tsd-kind-icon:before { 174 | background-position: -102px -0px; 175 | } 176 | .tsd-kind-variable.tsd-parent-kind-class.tsd-is-private 177 | > .tsd-kind-icon:before { 178 | background-position: -119px -0px; 179 | } 180 | .tsd-kind-variable.tsd-parent-kind-enum > .tsd-kind-icon:before { 181 | background-position: -170px -0px; 182 | } 183 | .tsd-kind-variable.tsd-parent-kind-enum.tsd-is-protected 184 | > .tsd-kind-icon:before { 185 | background-position: -187px -0px; 186 | } 187 | .tsd-kind-variable.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 188 | background-position: -119px -0px; 189 | } 190 | .tsd-kind-variable.tsd-parent-kind-interface > .tsd-kind-icon:before { 191 | background-position: -204px -0px; 192 | } 193 | .tsd-kind-variable.tsd-parent-kind-interface.tsd-is-inherited 194 | > .tsd-kind-icon:before { 195 | background-position: -221px -0px; 196 | } 197 | 198 | .tsd-kind-property > .tsd-kind-icon:before { 199 | background-position: -136px -0px; 200 | } 201 | .tsd-kind-property.tsd-is-protected > .tsd-kind-icon:before { 202 | background-position: -153px -0px; 203 | } 204 | .tsd-kind-property.tsd-is-private > .tsd-kind-icon:before { 205 | background-position: -119px -0px; 206 | } 207 | .tsd-kind-property.tsd-parent-kind-class > .tsd-kind-icon:before { 208 | background-position: -51px -0px; 209 | } 210 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-inherited 211 | > .tsd-kind-icon:before { 212 | background-position: -68px -0px; 213 | } 214 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-protected 215 | > .tsd-kind-icon:before { 216 | background-position: -85px -0px; 217 | } 218 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 219 | > .tsd-kind-icon:before { 220 | background-position: -102px -0px; 221 | } 222 | .tsd-kind-property.tsd-parent-kind-class.tsd-is-private 223 | > .tsd-kind-icon:before { 224 | background-position: -119px -0px; 225 | } 226 | .tsd-kind-property.tsd-parent-kind-enum > .tsd-kind-icon:before { 227 | background-position: -170px -0px; 228 | } 229 | .tsd-kind-property.tsd-parent-kind-enum.tsd-is-protected 230 | > .tsd-kind-icon:before { 231 | background-position: -187px -0px; 232 | } 233 | .tsd-kind-property.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 234 | background-position: -119px -0px; 235 | } 236 | .tsd-kind-property.tsd-parent-kind-interface > .tsd-kind-icon:before { 237 | background-position: -204px -0px; 238 | } 239 | .tsd-kind-property.tsd-parent-kind-interface.tsd-is-inherited 240 | > .tsd-kind-icon:before { 241 | background-position: -221px -0px; 242 | } 243 | 244 | .tsd-kind-get-signature > .tsd-kind-icon:before { 245 | background-position: -136px -17px; 246 | } 247 | .tsd-kind-get-signature.tsd-is-protected > .tsd-kind-icon:before { 248 | background-position: -153px -17px; 249 | } 250 | .tsd-kind-get-signature.tsd-is-private > .tsd-kind-icon:before { 251 | background-position: -119px -17px; 252 | } 253 | .tsd-kind-get-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 254 | background-position: -51px -17px; 255 | } 256 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-inherited 257 | > .tsd-kind-icon:before { 258 | background-position: -68px -17px; 259 | } 260 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected 261 | > .tsd-kind-icon:before { 262 | background-position: -85px -17px; 263 | } 264 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 265 | > .tsd-kind-icon:before { 266 | background-position: -102px -17px; 267 | } 268 | .tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-private 269 | > .tsd-kind-icon:before { 270 | background-position: -119px -17px; 271 | } 272 | .tsd-kind-get-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 273 | background-position: -170px -17px; 274 | } 275 | .tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-protected 276 | > .tsd-kind-icon:before { 277 | background-position: -187px -17px; 278 | } 279 | .tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-private 280 | > .tsd-kind-icon:before { 281 | background-position: -119px -17px; 282 | } 283 | .tsd-kind-get-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 284 | background-position: -204px -17px; 285 | } 286 | .tsd-kind-get-signature.tsd-parent-kind-interface.tsd-is-inherited 287 | > .tsd-kind-icon:before { 288 | background-position: -221px -17px; 289 | } 290 | 291 | .tsd-kind-set-signature > .tsd-kind-icon:before { 292 | background-position: -136px -34px; 293 | } 294 | .tsd-kind-set-signature.tsd-is-protected > .tsd-kind-icon:before { 295 | background-position: -153px -34px; 296 | } 297 | .tsd-kind-set-signature.tsd-is-private > .tsd-kind-icon:before { 298 | background-position: -119px -34px; 299 | } 300 | .tsd-kind-set-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 301 | background-position: -51px -34px; 302 | } 303 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-inherited 304 | > .tsd-kind-icon:before { 305 | background-position: -68px -34px; 306 | } 307 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected 308 | > .tsd-kind-icon:before { 309 | background-position: -85px -34px; 310 | } 311 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 312 | > .tsd-kind-icon:before { 313 | background-position: -102px -34px; 314 | } 315 | .tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-private 316 | > .tsd-kind-icon:before { 317 | background-position: -119px -34px; 318 | } 319 | .tsd-kind-set-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 320 | background-position: -170px -34px; 321 | } 322 | .tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-protected 323 | > .tsd-kind-icon:before { 324 | background-position: -187px -34px; 325 | } 326 | .tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-private 327 | > .tsd-kind-icon:before { 328 | background-position: -119px -34px; 329 | } 330 | .tsd-kind-set-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 331 | background-position: -204px -34px; 332 | } 333 | .tsd-kind-set-signature.tsd-parent-kind-interface.tsd-is-inherited 334 | > .tsd-kind-icon:before { 335 | background-position: -221px -34px; 336 | } 337 | 338 | .tsd-kind-accessor > .tsd-kind-icon:before { 339 | background-position: -136px -51px; 340 | } 341 | .tsd-kind-accessor.tsd-is-protected > .tsd-kind-icon:before { 342 | background-position: -153px -51px; 343 | } 344 | .tsd-kind-accessor.tsd-is-private > .tsd-kind-icon:before { 345 | background-position: -119px -51px; 346 | } 347 | .tsd-kind-accessor.tsd-parent-kind-class > .tsd-kind-icon:before { 348 | background-position: -51px -51px; 349 | } 350 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-inherited 351 | > .tsd-kind-icon:before { 352 | background-position: -68px -51px; 353 | } 354 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected 355 | > .tsd-kind-icon:before { 356 | background-position: -85px -51px; 357 | } 358 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 359 | > .tsd-kind-icon:before { 360 | background-position: -102px -51px; 361 | } 362 | .tsd-kind-accessor.tsd-parent-kind-class.tsd-is-private 363 | > .tsd-kind-icon:before { 364 | background-position: -119px -51px; 365 | } 366 | .tsd-kind-accessor.tsd-parent-kind-enum > .tsd-kind-icon:before { 367 | background-position: -170px -51px; 368 | } 369 | .tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-protected 370 | > .tsd-kind-icon:before { 371 | background-position: -187px -51px; 372 | } 373 | .tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 374 | background-position: -119px -51px; 375 | } 376 | .tsd-kind-accessor.tsd-parent-kind-interface > .tsd-kind-icon:before { 377 | background-position: -204px -51px; 378 | } 379 | .tsd-kind-accessor.tsd-parent-kind-interface.tsd-is-inherited 380 | > .tsd-kind-icon:before { 381 | background-position: -221px -51px; 382 | } 383 | 384 | .tsd-kind-function > .tsd-kind-icon:before { 385 | background-position: -136px -68px; 386 | } 387 | .tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { 388 | background-position: -153px -68px; 389 | } 390 | .tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { 391 | background-position: -119px -68px; 392 | } 393 | .tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { 394 | background-position: -51px -68px; 395 | } 396 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited 397 | > .tsd-kind-icon:before { 398 | background-position: -68px -68px; 399 | } 400 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-protected 401 | > .tsd-kind-icon:before { 402 | background-position: -85px -68px; 403 | } 404 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 405 | > .tsd-kind-icon:before { 406 | background-position: -102px -68px; 407 | } 408 | .tsd-kind-function.tsd-parent-kind-class.tsd-is-private 409 | > .tsd-kind-icon:before { 410 | background-position: -119px -68px; 411 | } 412 | .tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { 413 | background-position: -170px -68px; 414 | } 415 | .tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected 416 | > .tsd-kind-icon:before { 417 | background-position: -187px -68px; 418 | } 419 | .tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 420 | background-position: -119px -68px; 421 | } 422 | .tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { 423 | background-position: -204px -68px; 424 | } 425 | .tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited 426 | > .tsd-kind-icon:before { 427 | background-position: -221px -68px; 428 | } 429 | 430 | .tsd-kind-method > .tsd-kind-icon:before { 431 | background-position: -136px -68px; 432 | } 433 | .tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { 434 | background-position: -153px -68px; 435 | } 436 | .tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { 437 | background-position: -119px -68px; 438 | } 439 | .tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { 440 | background-position: -51px -68px; 441 | } 442 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited 443 | > .tsd-kind-icon:before { 444 | background-position: -68px -68px; 445 | } 446 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-protected 447 | > .tsd-kind-icon:before { 448 | background-position: -85px -68px; 449 | } 450 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 451 | > .tsd-kind-icon:before { 452 | background-position: -102px -68px; 453 | } 454 | .tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 455 | background-position: -119px -68px; 456 | } 457 | .tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { 458 | background-position: -170px -68px; 459 | } 460 | .tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 461 | background-position: -187px -68px; 462 | } 463 | .tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 464 | background-position: -119px -68px; 465 | } 466 | .tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { 467 | background-position: -204px -68px; 468 | } 469 | .tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited 470 | > .tsd-kind-icon:before { 471 | background-position: -221px -68px; 472 | } 473 | 474 | .tsd-kind-call-signature > .tsd-kind-icon:before { 475 | background-position: -136px -68px; 476 | } 477 | .tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { 478 | background-position: -153px -68px; 479 | } 480 | .tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { 481 | background-position: -119px -68px; 482 | } 483 | .tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 484 | background-position: -51px -68px; 485 | } 486 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited 487 | > .tsd-kind-icon:before { 488 | background-position: -68px -68px; 489 | } 490 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected 491 | > .tsd-kind-icon:before { 492 | background-position: -85px -68px; 493 | } 494 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 495 | > .tsd-kind-icon:before { 496 | background-position: -102px -68px; 497 | } 498 | .tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private 499 | > .tsd-kind-icon:before { 500 | background-position: -119px -68px; 501 | } 502 | .tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 503 | background-position: -170px -68px; 504 | } 505 | .tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected 506 | > .tsd-kind-icon:before { 507 | background-position: -187px -68px; 508 | } 509 | .tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private 510 | > .tsd-kind-icon:before { 511 | background-position: -119px -68px; 512 | } 513 | .tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 514 | background-position: -204px -68px; 515 | } 516 | .tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited 517 | > .tsd-kind-icon:before { 518 | background-position: -221px -68px; 519 | } 520 | 521 | .tsd-kind-function.tsd-has-type-parameter > .tsd-kind-icon:before { 522 | background-position: -136px -85px; 523 | } 524 | .tsd-kind-function.tsd-has-type-parameter.tsd-is-protected 525 | > .tsd-kind-icon:before { 526 | background-position: -153px -85px; 527 | } 528 | .tsd-kind-function.tsd-has-type-parameter.tsd-is-private 529 | > .tsd-kind-icon:before { 530 | background-position: -119px -85px; 531 | } 532 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class 533 | > .tsd-kind-icon:before { 534 | background-position: -51px -85px; 535 | } 536 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited 537 | > .tsd-kind-icon:before { 538 | background-position: -68px -85px; 539 | } 540 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected 541 | > .tsd-kind-icon:before { 542 | background-position: -85px -85px; 543 | } 544 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 545 | > .tsd-kind-icon:before { 546 | background-position: -102px -85px; 547 | } 548 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private 549 | > .tsd-kind-icon:before { 550 | background-position: -119px -85px; 551 | } 552 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum 553 | > .tsd-kind-icon:before { 554 | background-position: -170px -85px; 555 | } 556 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected 557 | > .tsd-kind-icon:before { 558 | background-position: -187px -85px; 559 | } 560 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private 561 | > .tsd-kind-icon:before { 562 | background-position: -119px -85px; 563 | } 564 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface 565 | > .tsd-kind-icon:before { 566 | background-position: -204px -85px; 567 | } 568 | .tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited 569 | > .tsd-kind-icon:before { 570 | background-position: -221px -85px; 571 | } 572 | 573 | .tsd-kind-method.tsd-has-type-parameter > .tsd-kind-icon:before { 574 | background-position: -136px -85px; 575 | } 576 | .tsd-kind-method.tsd-has-type-parameter.tsd-is-protected 577 | > .tsd-kind-icon:before { 578 | background-position: -153px -85px; 579 | } 580 | .tsd-kind-method.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { 581 | background-position: -119px -85px; 582 | } 583 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class 584 | > .tsd-kind-icon:before { 585 | background-position: -51px -85px; 586 | } 587 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited 588 | > .tsd-kind-icon:before { 589 | background-position: -68px -85px; 590 | } 591 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected 592 | > .tsd-kind-icon:before { 593 | background-position: -85px -85px; 594 | } 595 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 596 | > .tsd-kind-icon:before { 597 | background-position: -102px -85px; 598 | } 599 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private 600 | > .tsd-kind-icon:before { 601 | background-position: -119px -85px; 602 | } 603 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum 604 | > .tsd-kind-icon:before { 605 | background-position: -170px -85px; 606 | } 607 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected 608 | > .tsd-kind-icon:before { 609 | background-position: -187px -85px; 610 | } 611 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private 612 | > .tsd-kind-icon:before { 613 | background-position: -119px -85px; 614 | } 615 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface 616 | > .tsd-kind-icon:before { 617 | background-position: -204px -85px; 618 | } 619 | .tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited 620 | > .tsd-kind-icon:before { 621 | background-position: -221px -85px; 622 | } 623 | 624 | .tsd-kind-constructor > .tsd-kind-icon:before { 625 | background-position: -136px -102px; 626 | } 627 | .tsd-kind-constructor.tsd-is-protected > .tsd-kind-icon:before { 628 | background-position: -153px -102px; 629 | } 630 | .tsd-kind-constructor.tsd-is-private > .tsd-kind-icon:before { 631 | background-position: -119px -102px; 632 | } 633 | .tsd-kind-constructor.tsd-parent-kind-class > .tsd-kind-icon:before { 634 | background-position: -51px -102px; 635 | } 636 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-inherited 637 | > .tsd-kind-icon:before { 638 | background-position: -68px -102px; 639 | } 640 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected 641 | > .tsd-kind-icon:before { 642 | background-position: -85px -102px; 643 | } 644 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 645 | > .tsd-kind-icon:before { 646 | background-position: -102px -102px; 647 | } 648 | .tsd-kind-constructor.tsd-parent-kind-class.tsd-is-private 649 | > .tsd-kind-icon:before { 650 | background-position: -119px -102px; 651 | } 652 | .tsd-kind-constructor.tsd-parent-kind-enum > .tsd-kind-icon:before { 653 | background-position: -170px -102px; 654 | } 655 | .tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-protected 656 | > .tsd-kind-icon:before { 657 | background-position: -187px -102px; 658 | } 659 | .tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-private 660 | > .tsd-kind-icon:before { 661 | background-position: -119px -102px; 662 | } 663 | .tsd-kind-constructor.tsd-parent-kind-interface > .tsd-kind-icon:before { 664 | background-position: -204px -102px; 665 | } 666 | .tsd-kind-constructor.tsd-parent-kind-interface.tsd-is-inherited 667 | > .tsd-kind-icon:before { 668 | background-position: -221px -102px; 669 | } 670 | 671 | .tsd-kind-constructor-signature > .tsd-kind-icon:before { 672 | background-position: -136px -102px; 673 | } 674 | .tsd-kind-constructor-signature.tsd-is-protected > .tsd-kind-icon:before { 675 | background-position: -153px -102px; 676 | } 677 | .tsd-kind-constructor-signature.tsd-is-private > .tsd-kind-icon:before { 678 | background-position: -119px -102px; 679 | } 680 | .tsd-kind-constructor-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 681 | background-position: -51px -102px; 682 | } 683 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-inherited 684 | > .tsd-kind-icon:before { 685 | background-position: -68px -102px; 686 | } 687 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected 688 | > .tsd-kind-icon:before { 689 | background-position: -85px -102px; 690 | } 691 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 692 | > .tsd-kind-icon:before { 693 | background-position: -102px -102px; 694 | } 695 | .tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-private 696 | > .tsd-kind-icon:before { 697 | background-position: -119px -102px; 698 | } 699 | .tsd-kind-constructor-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 700 | background-position: -170px -102px; 701 | } 702 | .tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-protected 703 | > .tsd-kind-icon:before { 704 | background-position: -187px -102px; 705 | } 706 | .tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-private 707 | > .tsd-kind-icon:before { 708 | background-position: -119px -102px; 709 | } 710 | .tsd-kind-constructor-signature.tsd-parent-kind-interface 711 | > .tsd-kind-icon:before { 712 | background-position: -204px -102px; 713 | } 714 | .tsd-kind-constructor-signature.tsd-parent-kind-interface.tsd-is-inherited 715 | > .tsd-kind-icon:before { 716 | background-position: -221px -102px; 717 | } 718 | 719 | .tsd-kind-index-signature > .tsd-kind-icon:before { 720 | background-position: -136px -119px; 721 | } 722 | .tsd-kind-index-signature.tsd-is-protected > .tsd-kind-icon:before { 723 | background-position: -153px -119px; 724 | } 725 | .tsd-kind-index-signature.tsd-is-private > .tsd-kind-icon:before { 726 | background-position: -119px -119px; 727 | } 728 | .tsd-kind-index-signature.tsd-parent-kind-class > .tsd-kind-icon:before { 729 | background-position: -51px -119px; 730 | } 731 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-inherited 732 | > .tsd-kind-icon:before { 733 | background-position: -68px -119px; 734 | } 735 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected 736 | > .tsd-kind-icon:before { 737 | background-position: -85px -119px; 738 | } 739 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 740 | > .tsd-kind-icon:before { 741 | background-position: -102px -119px; 742 | } 743 | .tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-private 744 | > .tsd-kind-icon:before { 745 | background-position: -119px -119px; 746 | } 747 | .tsd-kind-index-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { 748 | background-position: -170px -119px; 749 | } 750 | .tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-protected 751 | > .tsd-kind-icon:before { 752 | background-position: -187px -119px; 753 | } 754 | .tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-private 755 | > .tsd-kind-icon:before { 756 | background-position: -119px -119px; 757 | } 758 | .tsd-kind-index-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { 759 | background-position: -204px -119px; 760 | } 761 | .tsd-kind-index-signature.tsd-parent-kind-interface.tsd-is-inherited 762 | > .tsd-kind-icon:before { 763 | background-position: -221px -119px; 764 | } 765 | 766 | .tsd-kind-event > .tsd-kind-icon:before { 767 | background-position: -136px -136px; 768 | } 769 | .tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { 770 | background-position: -153px -136px; 771 | } 772 | .tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { 773 | background-position: -119px -136px; 774 | } 775 | .tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { 776 | background-position: -51px -136px; 777 | } 778 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { 779 | background-position: -68px -136px; 780 | } 781 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { 782 | background-position: -85px -136px; 783 | } 784 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 785 | > .tsd-kind-icon:before { 786 | background-position: -102px -136px; 787 | } 788 | .tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 789 | background-position: -119px -136px; 790 | } 791 | .tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { 792 | background-position: -170px -136px; 793 | } 794 | .tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 795 | background-position: -187px -136px; 796 | } 797 | .tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 798 | background-position: -119px -136px; 799 | } 800 | .tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { 801 | background-position: -204px -136px; 802 | } 803 | .tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited 804 | > .tsd-kind-icon:before { 805 | background-position: -221px -136px; 806 | } 807 | 808 | .tsd-is-static > .tsd-kind-icon:before { 809 | background-position: -136px -153px; 810 | } 811 | .tsd-is-static.tsd-is-protected > .tsd-kind-icon:before { 812 | background-position: -153px -153px; 813 | } 814 | .tsd-is-static.tsd-is-private > .tsd-kind-icon:before { 815 | background-position: -119px -153px; 816 | } 817 | .tsd-is-static.tsd-parent-kind-class > .tsd-kind-icon:before { 818 | background-position: -51px -153px; 819 | } 820 | .tsd-is-static.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { 821 | background-position: -68px -153px; 822 | } 823 | .tsd-is-static.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { 824 | background-position: -85px -153px; 825 | } 826 | .tsd-is-static.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 827 | > .tsd-kind-icon:before { 828 | background-position: -102px -153px; 829 | } 830 | .tsd-is-static.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { 831 | background-position: -119px -153px; 832 | } 833 | .tsd-is-static.tsd-parent-kind-enum > .tsd-kind-icon:before { 834 | background-position: -170px -153px; 835 | } 836 | .tsd-is-static.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { 837 | background-position: -187px -153px; 838 | } 839 | .tsd-is-static.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { 840 | background-position: -119px -153px; 841 | } 842 | .tsd-is-static.tsd-parent-kind-interface > .tsd-kind-icon:before { 843 | background-position: -204px -153px; 844 | } 845 | .tsd-is-static.tsd-parent-kind-interface.tsd-is-inherited 846 | > .tsd-kind-icon:before { 847 | background-position: -221px -153px; 848 | } 849 | 850 | .tsd-is-static.tsd-kind-function > .tsd-kind-icon:before { 851 | background-position: -136px -170px; 852 | } 853 | .tsd-is-static.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { 854 | background-position: -153px -170px; 855 | } 856 | .tsd-is-static.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { 857 | background-position: -119px -170px; 858 | } 859 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { 860 | background-position: -51px -170px; 861 | } 862 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited 863 | > .tsd-kind-icon:before { 864 | background-position: -68px -170px; 865 | } 866 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected 867 | > .tsd-kind-icon:before { 868 | background-position: -85px -170px; 869 | } 870 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 871 | > .tsd-kind-icon:before { 872 | background-position: -102px -170px; 873 | } 874 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-private 875 | > .tsd-kind-icon:before { 876 | background-position: -119px -170px; 877 | } 878 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { 879 | background-position: -170px -170px; 880 | } 881 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected 882 | > .tsd-kind-icon:before { 883 | background-position: -187px -170px; 884 | } 885 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private 886 | > .tsd-kind-icon:before { 887 | background-position: -119px -170px; 888 | } 889 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-interface 890 | > .tsd-kind-icon:before { 891 | background-position: -204px -170px; 892 | } 893 | .tsd-is-static.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited 894 | > .tsd-kind-icon:before { 895 | background-position: -221px -170px; 896 | } 897 | 898 | .tsd-is-static.tsd-kind-method > .tsd-kind-icon:before { 899 | background-position: -136px -170px; 900 | } 901 | .tsd-is-static.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { 902 | background-position: -153px -170px; 903 | } 904 | .tsd-is-static.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { 905 | background-position: -119px -170px; 906 | } 907 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { 908 | background-position: -51px -170px; 909 | } 910 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited 911 | > .tsd-kind-icon:before { 912 | background-position: -68px -170px; 913 | } 914 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected 915 | > .tsd-kind-icon:before { 916 | background-position: -85px -170px; 917 | } 918 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 919 | > .tsd-kind-icon:before { 920 | background-position: -102px -170px; 921 | } 922 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-private 923 | > .tsd-kind-icon:before { 924 | background-position: -119px -170px; 925 | } 926 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { 927 | background-position: -170px -170px; 928 | } 929 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected 930 | > .tsd-kind-icon:before { 931 | background-position: -187px -170px; 932 | } 933 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private 934 | > .tsd-kind-icon:before { 935 | background-position: -119px -170px; 936 | } 937 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-interface 938 | > .tsd-kind-icon:before { 939 | background-position: -204px -170px; 940 | } 941 | .tsd-is-static.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited 942 | > .tsd-kind-icon:before { 943 | background-position: -221px -170px; 944 | } 945 | 946 | .tsd-is-static.tsd-kind-call-signature > .tsd-kind-icon:before { 947 | background-position: -136px -170px; 948 | } 949 | .tsd-is-static.tsd-kind-call-signature.tsd-is-protected 950 | > .tsd-kind-icon:before { 951 | background-position: -153px -170px; 952 | } 953 | .tsd-is-static.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { 954 | background-position: -119px -170px; 955 | } 956 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class 957 | > .tsd-kind-icon:before { 958 | background-position: -51px -170px; 959 | } 960 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited 961 | > .tsd-kind-icon:before { 962 | background-position: -68px -170px; 963 | } 964 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected 965 | > .tsd-kind-icon:before { 966 | background-position: -85px -170px; 967 | } 968 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 969 | > .tsd-kind-icon:before { 970 | background-position: -102px -170px; 971 | } 972 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private 973 | > .tsd-kind-icon:before { 974 | background-position: -119px -170px; 975 | } 976 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum 977 | > .tsd-kind-icon:before { 978 | background-position: -170px -170px; 979 | } 980 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected 981 | > .tsd-kind-icon:before { 982 | background-position: -187px -170px; 983 | } 984 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private 985 | > .tsd-kind-icon:before { 986 | background-position: -119px -170px; 987 | } 988 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface 989 | > .tsd-kind-icon:before { 990 | background-position: -204px -170px; 991 | } 992 | .tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited 993 | > .tsd-kind-icon:before { 994 | background-position: -221px -170px; 995 | } 996 | 997 | .tsd-is-static.tsd-kind-event > .tsd-kind-icon:before { 998 | background-position: -136px -187px; 999 | } 1000 | .tsd-is-static.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { 1001 | background-position: -153px -187px; 1002 | } 1003 | .tsd-is-static.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { 1004 | background-position: -119px -187px; 1005 | } 1006 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { 1007 | background-position: -51px -187px; 1008 | } 1009 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited 1010 | > .tsd-kind-icon:before { 1011 | background-position: -68px -187px; 1012 | } 1013 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected 1014 | > .tsd-kind-icon:before { 1015 | background-position: -85px -187px; 1016 | } 1017 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited 1018 | > .tsd-kind-icon:before { 1019 | background-position: -102px -187px; 1020 | } 1021 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-private 1022 | > .tsd-kind-icon:before { 1023 | background-position: -119px -187px; 1024 | } 1025 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { 1026 | background-position: -170px -187px; 1027 | } 1028 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected 1029 | > .tsd-kind-icon:before { 1030 | background-position: -187px -187px; 1031 | } 1032 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private 1033 | > .tsd-kind-icon:before { 1034 | background-position: -119px -187px; 1035 | } 1036 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-interface 1037 | > .tsd-kind-icon:before { 1038 | background-position: -204px -187px; 1039 | } 1040 | .tsd-is-static.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited 1041 | > .tsd-kind-icon:before { 1042 | background-position: -221px -187px; 1043 | } 1044 | -------------------------------------------------------------------------------- /docs/assets/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgoraIO-Community/Agora-RTC-React/d5ab870a0b1b9aafa6f3002b945665e9eaa0a8de/docs/assets/icons.png -------------------------------------------------------------------------------- /docs/assets/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgoraIO-Community/Agora-RTC-React/d5ab870a0b1b9aafa6f3002b945665e9eaa0a8de/docs/assets/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/search.js: -------------------------------------------------------------------------------- 1 | window.searchData = JSON.parse("{\"kinds\":{\"64\":\"Function\"},\"rows\":[{\"id\":0,\"kind\":64,\"name\":\"createMicrophoneAndCameraTracks\",\"url\":\"modules.html#createMicrophoneAndCameraTracks\",\"classes\":\"tsd-kind-function\"},{\"id\":1,\"kind\":64,\"name\":\"createBufferSourceAudioTrack\",\"url\":\"modules.html#createBufferSourceAudioTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":2,\"kind\":64,\"name\":\"createCameraVideoTrack\",\"url\":\"modules.html#createCameraVideoTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":3,\"kind\":64,\"name\":\"createCustomAudioTrack\",\"url\":\"modules.html#createCustomAudioTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":4,\"kind\":64,\"name\":\"createCustomVideoTrack\",\"url\":\"modules.html#createCustomVideoTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":5,\"kind\":64,\"name\":\"createMicrophoneAudioTrack\",\"url\":\"modules.html#createMicrophoneAudioTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":6,\"kind\":64,\"name\":\"createScreenVideoTrack\",\"url\":\"modules.html#createScreenVideoTrack\",\"classes\":\"tsd-kind-function\"},{\"id\":7,\"kind\":64,\"name\":\"createClient\",\"url\":\"modules.html#createClient\",\"classes\":\"tsd-kind-function\"},{\"id\":8,\"kind\":64,\"name\":\"AgoraVideoPlayer\",\"url\":\"modules.html#AgoraVideoPlayer\",\"classes\":\"tsd-kind-function\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"parent\"],\"fieldVectors\":[[\"name/0\",[0,18.971]],[\"parent/0\",[]],[\"name/1\",[1,18.971]],[\"parent/1\",[]],[\"name/2\",[2,18.971]],[\"parent/2\",[]],[\"name/3\",[3,18.971]],[\"parent/3\",[]],[\"name/4\",[4,18.971]],[\"parent/4\",[]],[\"name/5\",[5,18.971]],[\"parent/5\",[]],[\"name/6\",[6,18.971]],[\"parent/6\",[]],[\"name/7\",[7,18.971]],[\"parent/7\",[]],[\"name/8\",[8,18.971]],[\"parent/8\",[]]],\"invertedIndex\":[[\"agoravideoplayer\",{\"_index\":8,\"name\":{\"8\":{}},\"parent\":{}}],[\"createbuffersourceaudiotrack\",{\"_index\":1,\"name\":{\"1\":{}},\"parent\":{}}],[\"createcameravideotrack\",{\"_index\":2,\"name\":{\"2\":{}},\"parent\":{}}],[\"createclient\",{\"_index\":7,\"name\":{\"7\":{}},\"parent\":{}}],[\"createcustomaudiotrack\",{\"_index\":3,\"name\":{\"3\":{}},\"parent\":{}}],[\"createcustomvideotrack\",{\"_index\":4,\"name\":{\"4\":{}},\"parent\":{}}],[\"createmicrophoneandcameratracks\",{\"_index\":0,\"name\":{\"0\":{}},\"parent\":{}}],[\"createmicrophoneaudiotrack\",{\"_index\":5,\"name\":{\"5\":{}},\"parent\":{}}],[\"createscreenvideotrack\",{\"_index\":6,\"name\":{\"6\":{}},\"parent\":{}}]],\"pipeline\":[]}}"); -------------------------------------------------------------------------------- /docs/assets/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgoraIO-Community/Agora-RTC-React/d5ab870a0b1b9aafa6f3002b945665e9eaa0a8de/docs/assets/widgets.png -------------------------------------------------------------------------------- /docs/assets/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgoraIO-Community/Agora-RTC-React/d5ab870a0b1b9aafa6f3002b945665e9eaa0a8de/docs/assets/widgets@2x.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | agora-rtc-react
Options
All
  • Public
  • Public/Protected
  • All
Menu

agora-rtc-react

2 | 3 |

Agora RTC SDK React Wrapper

4 |
5 |

A react (react.js) wrapper for Agora RTC NG SDK.

6 |

This wrapper supports React >= v16.8

7 | 8 | 9 |

Install

10 |
11 |
npm install agora-rtc-react
12 | 
13 | 14 | 15 |

Usage

16 |
17 |
import React from "react";
import { AgoraVideoPlayer, createClient, createMicrophoneAndCameraTracks } from "agora-rtc-react";

const config = {mode: "rtc", codec: "vp8"}

const useClient = createClient(config);
const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks();

const App = () => {
const client = useClient();
const { ready, tracks } = useMicrophoneAndCameraTracks();

return (
ready && <AgoraVideoPlayer videoTrack={tracks[1]} style={{height: '100%', width: '100%'}} />
)
}
18 |
19 | 20 | 21 |

Example

22 |
23 |

A full videocall example using the wrapper can be found here.

24 | 25 | 26 |

Reference

27 |
28 |

You can view the methods in the wrapper here.

29 |

Settings

Theme

Generated using TypeDoc

-------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Agora RTC SDK React Wrapper Example Videocall 2 | 3 | This is an example for [Agora RTC SDK React Wrapper](https://github.com/AgoraIO-Community/agora-rtc-react). 4 | 5 | You can find out how this works [here](https://github.com/AgoraIO-Community/agora-rtc-react/wiki/Example). -------------------------------------------------------------------------------- /example/nextjs/README.md: -------------------------------------------------------------------------------- 1 | # Agora RTC SDK React Wrapper NextJS Example 2 | 3 | This is an example for [Agora RTC SDK React Wrapper](https://github.com/AgoraIO-Community/agora-rtc-react). 4 | 5 | ## How to use 6 | - Update your Agora App ID (& token) inside `./pages/Videocall.tsx` 7 | - Make sure you're running the bundler for the library in the parent directory 8 | - Execute `npm i && npm run dev` 9 | - Open `localhost:3000` in a modern browser 10 | 11 | This project is created using `create-next-app`. The Videocall component is the same as the React only example, `index.tsx` contains the logic to handle SRR with the Agora SDK. 12 | 13 | You can use the same dynamic import technique to use the Agora Web SDK in your nextjs project instead of this react wrapper. -------------------------------------------------------------------------------- /example/nextjs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/basic-features/typescript for more information. 7 | -------------------------------------------------------------------------------- /example/nextjs/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | module.exports = { 3 | reactStrictMode: true, 4 | } 5 | -------------------------------------------------------------------------------- /example/nextjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agora-nextjs-demo", 3 | "private": true, 4 | "scripts": { 5 | "dev": "next dev", 6 | "build": "next build", 7 | "start": "next start", 8 | "lint": "next lint" 9 | }, 10 | "dependencies": { 11 | "agora-rtc-react": "file:../..", 12 | "next": "12.0.3", 13 | "react": "file:../../node_modules/react", 14 | "react-dom": "file:../../node_modules/react-dom" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "16.11.7", 18 | "@types/react": "17.0.34", 19 | "eslint": "7.32.0", 20 | "eslint-config-next": "12.0.3", 21 | "typescript": "4.4.4" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/nextjs/pages/Videocall.tsx: -------------------------------------------------------------------------------- 1 | // same file as the videocall example 2 | import React, { useEffect, useState } from "react"; 3 | import { 4 | AgoraVideoPlayer, 5 | createClient, 6 | createMicrophoneAndCameraTracks, 7 | ClientConfig, 8 | IAgoraRTCRemoteUser, 9 | ICameraVideoTrack, 10 | IMicrophoneAudioTrack, 11 | } from "agora-rtc-react"; 12 | 13 | const config: ClientConfig = { 14 | mode: "rtc", codec: "vp8", 15 | }; 16 | 17 | const appId: string = ""; //ENTER APP ID HERE 18 | const token: string | null = null; 19 | 20 | const App = () => { 21 | const [inCall, setInCall] = useState(false); 22 | const [channelName, setChannelName] = useState(""); 23 | return ( 24 |
25 |

Agora RTC NG SDK React Wrapper

26 | {inCall ? ( 27 | 28 | ) : ( 29 | 30 | )} 31 |
32 | ); 33 | }; 34 | 35 | // the create methods in the wrapper return a hook 36 | // the create method should be called outside the parent component 37 | // this hook can be used the get the client/stream in any component 38 | const useClient = createClient(config); 39 | const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks(); 40 | 41 | const VideoCall = (props: { 42 | setInCall: React.Dispatch>; 43 | channelName: string; 44 | }) => { 45 | const { setInCall, channelName } = props; 46 | const [users, setUsers] = useState([]); 47 | const [start, setStart] = useState(false); 48 | // using the hook to get access to the client object 49 | const client = useClient(); 50 | // ready is a state variable, which returns true when the local tracks are initialized, untill then tracks variable is null 51 | const { ready, tracks } = useMicrophoneAndCameraTracks(); 52 | 53 | useEffect(() => { 54 | // function to initialise the SDK 55 | let init = async (name: string) => { 56 | client.on("user-published", async (user, mediaType) => { 57 | await client.subscribe(user, mediaType); 58 | console.log("subscribe success"); 59 | if (mediaType === "video") { 60 | setUsers((prevUsers) => { 61 | return [...prevUsers, user]; 62 | }); 63 | } 64 | if (mediaType === "audio") { 65 | user.audioTrack?.play(); 66 | } 67 | }); 68 | 69 | client.on("user-unpublished", (user, type) => { 70 | console.log("unpublished", user, type); 71 | if (type === "audio") { 72 | user.audioTrack?.stop(); 73 | } 74 | if (type === "video") { 75 | setUsers((prevUsers) => { 76 | return prevUsers.filter((User) => User.uid !== user.uid); 77 | }); 78 | } 79 | }); 80 | 81 | client.on("user-left", (user) => { 82 | console.log("leaving", user); 83 | setUsers((prevUsers) => { 84 | return prevUsers.filter((User) => User.uid !== user.uid); 85 | }); 86 | }); 87 | 88 | await client.join(appId, name, token, null); 89 | if (tracks) await client.publish([tracks[0], tracks[1]]); 90 | setStart(true); 91 | 92 | }; 93 | 94 | if (ready && tracks) { 95 | console.log("init ready"); 96 | init(channelName); 97 | } 98 | 99 | }, [channelName, client, ready, tracks]); 100 | 101 | 102 | return ( 103 |
104 | {ready && tracks && ( 105 | 106 | )} 107 | {start && tracks && } 108 |
109 | ); 110 | }; 111 | 112 | const Videos = (props: { 113 | users: IAgoraRTCRemoteUser[]; 114 | tracks: [IMicrophoneAudioTrack, ICameraVideoTrack]; 115 | }) => { 116 | const { users, tracks } = props; 117 | 118 | return ( 119 |
120 |
121 | {/* AgoraVideoPlayer component takes in the video track to render the stream, 122 | you can pass in other props that get passed to the rendered div */} 123 | 124 | {users.length > 0 && 125 | users.map((user) => { 126 | if (user.videoTrack) { 127 | return ( 128 | 129 | ); 130 | } else return null; 131 | })} 132 |
133 |
134 | ); 135 | }; 136 | 137 | export const Controls = (props: { 138 | tracks: [IMicrophoneAudioTrack, ICameraVideoTrack]; 139 | setStart: React.Dispatch>; 140 | setInCall: React.Dispatch>; 141 | }) => { 142 | const client = useClient(); 143 | const { tracks, setStart, setInCall } = props; 144 | const [trackState, setTrackState] = useState({ video: true, audio: true }); 145 | 146 | const mute = async (type: "audio" | "video") => { 147 | if (type === "audio") { 148 | await tracks[0].setEnabled(!trackState.audio); 149 | setTrackState((ps) => { 150 | return { ...ps, audio: !ps.audio }; 151 | }); 152 | } else if (type === "video") { 153 | await tracks[1].setEnabled(!trackState.video); 154 | setTrackState((ps) => { 155 | return { ...ps, video: !ps.video }; 156 | }); 157 | } 158 | }; 159 | 160 | const leaveChannel = async () => { 161 | await client.leave(); 162 | client.removeAllListeners(); 163 | // we close the tracks to perform cleanup 164 | tracks[0].close(); 165 | tracks[1].close(); 166 | setStart(false); 167 | setInCall(false); 168 | }; 169 | 170 | return ( 171 |
172 |

mute("audio")}> 174 | {trackState.audio ? "MuteAudio" : "UnmuteAudio"} 175 |

176 |

mute("video")}> 178 | {trackState.video ? "MuteVideo" : "UnmuteVideo"} 179 |

180 | {

leaveChannel()}>Leave

} 181 |
182 | ); 183 | }; 184 | 185 | const ChannelForm = (props: { 186 | setInCall: React.Dispatch>; 187 | setChannelName: React.Dispatch>; 188 | }) => { 189 | const { setInCall, setChannelName } = props; 190 | 191 | return ( 192 |
193 | {appId === '' &&

Please enter your Agora App ID in App.tsx and refresh the page

} 194 | setChannelName(e.target.value)} 197 | /> 198 | 204 |
205 | ); 206 | }; 207 | 208 | export default App; -------------------------------------------------------------------------------- /example/nextjs/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | import type { AppProps } from 'next/app' 3 | 4 | function MyApp({ Component, pageProps }: AppProps) { 5 | return 6 | } 7 | 8 | export default MyApp 9 | -------------------------------------------------------------------------------- /example/nextjs/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import type { NextPage } from 'next' 2 | import styles from '../styles/Home.module.css' 3 | import dynamic from 'next/dynamic' 4 | // Use next/dynamic to import the videocall component without ssr as the Agora SDK uses the window object 5 | // The Videocall component can use the Agora SDK like in any react app 6 | const App = dynamic(import('./Videocall'), { ssr: false }); 7 | 8 | const Home: NextPage = () => { 9 | return ( 10 |
11 | 12 |
13 | ) 14 | } 15 | 16 | export default Home 17 | -------------------------------------------------------------------------------- /example/nextjs/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | background-color: #F7F7F7; 8 | } 9 | 10 | a { 11 | color: inherit; 12 | text-decoration: none; 13 | } 14 | 15 | * { 16 | box-sizing: border-box; 17 | } 18 | 19 | 20 | 21 | .App{ 22 | position: relative; 23 | display: grid; 24 | grid-template-columns: 100%; 25 | justify-items: center; 26 | align-items: center; 27 | height: 90vh; 28 | } 29 | 30 | .heading { 31 | text-align: center; 32 | align-self: flex-start; 33 | margin-bottom: 0; 34 | } 35 | 36 | #videos{ 37 | position: relative; 38 | height: 85vh; 39 | width: 100vw; 40 | margin: auto; 41 | align-self: flex-start; 42 | display: grid; 43 | grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); 44 | justify-items: center; 45 | align-items: center; 46 | } 47 | 48 | .vid{ 49 | position: relative; 50 | background-color:black; 51 | border-width: 1px; 52 | border-color: #38373A; 53 | border-style: solid; 54 | } 55 | 56 | .controls{ 57 | position: absolute; 58 | bottom: -10px; 59 | left: 50%; 60 | transform: translateX(-50%); 61 | margin: -20px auto; 62 | display: grid; 63 | grid-template-columns: repeat(3, 33%); 64 | align-items: center; 65 | justify-items: center; 66 | z-index: 1; 67 | width: 500px; 68 | max-width: 60vw; 69 | } 70 | 71 | .controls p{ 72 | padding: 10px; 73 | cursor: pointer; 74 | background: #38373A; 75 | color: #F7F7F7; 76 | border-width: 1px; 77 | border-color: #F7F7F7; 78 | border-style: solid; 79 | } 80 | 81 | .controls p.on{ 82 | background: #F7F7F7; 83 | color: #38373A; 84 | border-width: 1px; 85 | border-color: #38373A; 86 | border-style: solid; 87 | } 88 | 89 | .join{ 90 | position: absolute; 91 | z-index: 1; 92 | width: 30vw; 93 | height: fit-content; 94 | height: -moz-max-content; 95 | top: 50vh; 96 | left: 50vw; 97 | transform: translate(-50%, -50%); 98 | width: 500px; 99 | max-width: 75vw; 100 | } 101 | 102 | .join input{ 103 | padding: 15px; 104 | font-size: 1rem; 105 | border-width: 1px; 106 | border-color: #38373A; 107 | border-style: solid; 108 | width: 80%; 109 | display: block; 110 | margin: 50px auto; 111 | } 112 | 113 | .join button{ 114 | min-width: 200px; 115 | padding: 12px 0; 116 | text-align: center; 117 | background-color: #38373A; 118 | color: #F7F7F7; 119 | border-width: 1px; 120 | border-color: #F7F7F7; 121 | border-style: solid; 122 | font-size: 1rem; 123 | font-weight: 400; 124 | cursor: pointer; 125 | display: block; 126 | margin: 0 auto; 127 | } -------------------------------------------------------------------------------- /example/nextjs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agora-rtc-react-example", 3 | "homepage": ".", 4 | "version": "0.0.0", 5 | "private": true, 6 | "scripts": { 7 | "start": "node ../node_modules/react-scripts/bin/react-scripts.js start", 8 | "build": "node ../node_modules/react-scripts/bin/react-scripts.js build", 9 | "test": "node ../node_modules/react-scripts/bin/react-scripts.js test", 10 | "eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject" 11 | }, 12 | "dependencies": { 13 | "@testing-library/jest-dom": "file:../node_modules/@testing-library/jest-dom", 14 | "@testing-library/react": "file:../node_modules/@testing-library/react", 15 | "@testing-library/user-event": "file:../node_modules/@testing-library/user-event", 16 | "@types/jest": "file:../node_modules/@types/jest", 17 | "@types/node": "file:../node_modules/@types/node", 18 | "@types/react": "file:../node_modules/@types/react", 19 | "@types/react-dom": "file:../node_modules/@types/react-dom", 20 | "react": "file:../node_modules/react", 21 | "react-dom": "file:../node_modules/react-dom", 22 | "react-scripts": "file:../node_modules/react-scripts", 23 | "typescript": "file:../node_modules/typescript", 24 | "agora-rtc-react": "file:.." 25 | }, 26 | "devDependencies": { 27 | "@babel/plugin-syntax-object-rest-spread": "^7.8.3" 28 | }, 29 | "eslintConfig": { 30 | "extends": "react-app" 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgoraIO-Community/Agora-RTC-React/d5ab870a0b1b9aafa6f3002b945665e9eaa0a8de/example/public/favicon.ico -------------------------------------------------------------------------------- /example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 27 | agora-rtc-react 28 | 29 | 30 | 31 | 34 | 35 |
36 | 37 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "agora-rtc-react", 3 | "name": "agora-rtc-react", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { 3 | AgoraVideoPlayer, 4 | createClient, 5 | createMicrophoneAndCameraTracks, 6 | ClientConfig, 7 | IAgoraRTCRemoteUser, 8 | ICameraVideoTrack, 9 | IMicrophoneAudioTrack, 10 | } from "agora-rtc-react"; 11 | 12 | const config: ClientConfig = { 13 | mode: "rtc", codec: "vp8", 14 | }; 15 | 16 | const appId: string = ""; //ENTER APP ID HERE 17 | const token: string | null = null; 18 | 19 | const App = () => { 20 | const [inCall, setInCall] = useState(false); 21 | const [channelName, setChannelName] = useState(""); 22 | return ( 23 |
24 |

Agora RTC NG SDK React Wrapper

25 | {inCall ? ( 26 | 27 | ) : ( 28 | 29 | )} 30 |
31 | ); 32 | }; 33 | 34 | // the create methods in the wrapper return a hook 35 | // the create method should be called outside the parent component 36 | // this hook can be used the get the client/stream in any component 37 | const useClient = createClient(config); 38 | const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks(); 39 | 40 | const VideoCall = (props: { 41 | setInCall: React.Dispatch>; 42 | channelName: string; 43 | }) => { 44 | const { setInCall, channelName } = props; 45 | const [users, setUsers] = useState([]); 46 | const [start, setStart] = useState(false); 47 | // using the hook to get access to the client object 48 | const client = useClient(); 49 | // ready is a state variable, which returns true when the local tracks are initialized, untill then tracks variable is null 50 | const { ready, tracks } = useMicrophoneAndCameraTracks(); 51 | 52 | useEffect(() => { 53 | // function to initialise the SDK 54 | let init = async (name: string) => { 55 | client.on("user-published", async (user, mediaType) => { 56 | await client.subscribe(user, mediaType); 57 | console.log("subscribe success"); 58 | if (mediaType === "video") { 59 | setUsers((prevUsers) => { 60 | return [...prevUsers, user]; 61 | }); 62 | } 63 | if (mediaType === "audio") { 64 | user.audioTrack?.play(); 65 | } 66 | }); 67 | 68 | client.on("user-unpublished", (user, type) => { 69 | console.log("unpublished", user, type); 70 | if (type === "audio") { 71 | user.audioTrack?.stop(); 72 | } 73 | if (type === "video") { 74 | setUsers((prevUsers) => { 75 | return prevUsers.filter((User) => User.uid !== user.uid); 76 | }); 77 | } 78 | }); 79 | 80 | client.on("user-left", (user) => { 81 | console.log("leaving", user); 82 | setUsers((prevUsers) => { 83 | return prevUsers.filter((User) => User.uid !== user.uid); 84 | }); 85 | }); 86 | 87 | await client.join(appId, name, token, null); 88 | if (tracks) await client.publish([tracks[0], tracks[1]]); 89 | setStart(true); 90 | 91 | }; 92 | 93 | if (ready && tracks) { 94 | console.log("init ready"); 95 | init(channelName); 96 | } 97 | 98 | }, [channelName, client, ready, tracks]); 99 | 100 | 101 | return ( 102 |
103 | {ready && tracks && ( 104 | 105 | )} 106 | {start && tracks && } 107 |
108 | ); 109 | }; 110 | 111 | const Videos = (props: { 112 | users: IAgoraRTCRemoteUser[]; 113 | tracks: [IMicrophoneAudioTrack, ICameraVideoTrack]; 114 | }) => { 115 | const { users, tracks } = props; 116 | 117 | return ( 118 |
119 |
120 | {/* AgoraVideoPlayer component takes in the video track to render the stream, 121 | you can pass in other props that get passed to the rendered div */} 122 | 123 | {users.length > 0 && 124 | users.map((user) => { 125 | if (user.videoTrack) { 126 | return ( 127 | 128 | ); 129 | } else return null; 130 | })} 131 |
132 |
133 | ); 134 | }; 135 | 136 | export const Controls = (props: { 137 | tracks: [IMicrophoneAudioTrack, ICameraVideoTrack]; 138 | setStart: React.Dispatch>; 139 | setInCall: React.Dispatch>; 140 | }) => { 141 | const client = useClient(); 142 | const { tracks, setStart, setInCall } = props; 143 | const [trackState, setTrackState] = useState({ video: true, audio: true }); 144 | 145 | const mute = async (type: "audio" | "video") => { 146 | if (type === "audio") { 147 | await tracks[0].setEnabled(!trackState.audio); 148 | setTrackState((ps) => { 149 | return { ...ps, audio: !ps.audio }; 150 | }); 151 | } else if (type === "video") { 152 | await tracks[1].setEnabled(!trackState.video); 153 | setTrackState((ps) => { 154 | return { ...ps, video: !ps.video }; 155 | }); 156 | } 157 | }; 158 | 159 | const leaveChannel = async () => { 160 | await client.leave(); 161 | client.removeAllListeners(); 162 | // we close the tracks to perform cleanup 163 | tracks[0].close(); 164 | tracks[1].close(); 165 | setStart(false); 166 | setInCall(false); 167 | }; 168 | 169 | return ( 170 |
171 |

mute("audio")}> 173 | {trackState.audio ? "MuteAudio" : "UnmuteAudio"} 174 |

175 |

mute("video")}> 177 | {trackState.video ? "MuteVideo" : "UnmuteVideo"} 178 |

179 | {

leaveChannel()}>Leave

} 180 |
181 | ); 182 | }; 183 | 184 | const ChannelForm = (props: { 185 | setInCall: React.Dispatch>; 186 | setChannelName: React.Dispatch>; 187 | }) => { 188 | const { setInCall, setChannelName } = props; 189 | 190 | return ( 191 |
192 | {appId === '' &&

Please enter your Agora App ID in App.tsx and refresh the page

} 193 | setChannelName(e.target.value)} 196 | /> 197 | 203 |
204 | ); 205 | }; 206 | 207 | export default App; 208 | -------------------------------------------------------------------------------- /example/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 5 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | background-color: #F7F7F7; 10 | } 11 | 12 | .App{ 13 | position: relative; 14 | display: grid; 15 | grid-template-columns: 100%; 16 | justify-items: center; 17 | align-items: center; 18 | height: 90vh; 19 | } 20 | 21 | .heading { 22 | text-align: center; 23 | align-self: flex-start; 24 | margin-bottom: 0; 25 | } 26 | 27 | #videos{ 28 | position: relative; 29 | height: 85vh; 30 | width: 100vw; 31 | margin: auto; 32 | align-self: flex-start; 33 | display: grid; 34 | grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); 35 | justify-items: center; 36 | align-items: center; 37 | } 38 | 39 | .vid{ 40 | position: relative; 41 | background-color:black; 42 | border-width: 1px; 43 | border-color: #38373A; 44 | border-style: solid; 45 | } 46 | 47 | .controls{ 48 | position: absolute; 49 | bottom: -10px; 50 | left: 50%; 51 | transform: translateX(-50%); 52 | margin: -20px auto; 53 | display: grid; 54 | grid-template-columns: repeat(3, 33%); 55 | align-items: center; 56 | justify-items: center; 57 | z-index: 1; 58 | width: 500px; 59 | max-width: 60vw; 60 | } 61 | 62 | .controls p{ 63 | padding: 10px; 64 | cursor: pointer; 65 | background: #38373A; 66 | color: #F7F7F7; 67 | border-width: 1px; 68 | border-color: #F7F7F7; 69 | border-style: solid; 70 | } 71 | 72 | .controls p.on{ 73 | background: #F7F7F7; 74 | color: #38373A; 75 | border-width: 1px; 76 | border-color: #38373A; 77 | border-style: solid; 78 | } 79 | 80 | .join{ 81 | position: absolute; 82 | z-index: 1; 83 | width: 30vw; 84 | height: fit-content; 85 | height: -moz-max-content; 86 | top: 50vh; 87 | left: 50vw; 88 | transform: translate(-50%, -50%); 89 | width: 500px; 90 | max-width: 75vw; 91 | } 92 | 93 | .join input{ 94 | padding: 15px; 95 | font-size: 1rem; 96 | border-width: 1px; 97 | border-color: #38373A; 98 | border-style: solid; 99 | width: 80%; 100 | display: block; 101 | margin: 50px auto; 102 | } 103 | 104 | .join button{ 105 | min-width: 200px; 106 | padding: 12px 0; 107 | text-align: center; 108 | background-color: #38373A; 109 | color: #F7F7F7; 110 | border-width: 1px; 111 | border-color: #F7F7F7; 112 | border-style: solid; 113 | font-size: 1rem; 114 | font-weight: 400; 115 | cursor: pointer; 116 | display: block; 117 | margin: 0 auto; 118 | } 119 | -------------------------------------------------------------------------------- /example/src/index.tsx: -------------------------------------------------------------------------------- 1 | import './index.css' 2 | 3 | import React from 'react' 4 | import ReactDOM from 'react-dom' 5 | import App from './App' 6 | 7 | ReactDOM.render(, document.getElementById('root')) 8 | -------------------------------------------------------------------------------- /example/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /example/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist", 4 | "module": "esnext", 5 | "lib": [ 6 | "dom", 7 | "esnext" 8 | ], 9 | "moduleResolution": "node", 10 | "jsx": "react", 11 | "sourceMap": true, 12 | "declaration": true, 13 | "esModuleInterop": true, 14 | "noImplicitReturns": true, 15 | "noImplicitThis": true, 16 | "noImplicitAny": true, 17 | "strictNullChecks": true, 18 | "suppressImplicitAnyIndexErrors": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "allowSyntheticDefaultImports": true, 22 | "target": "es5", 23 | "allowJs": true, 24 | "skipLibCheck": true, 25 | "strict": true, 26 | "forceConsistentCasingInFileNames": true, 27 | "resolveJsonModule": true, 28 | "isolatedModules": true, 29 | "noEmit": true 30 | }, 31 | "include": [ 32 | "src" 33 | ], 34 | "exclude": [ 35 | "node_modules", 36 | "build" 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agora-rtc-react", 3 | "version": "1.1.3", 4 | "description": "A wrapper for Agora RTC NG SDK to use with react/reactjs", 5 | "author": "EkaanshArora", 6 | "repository": "AgoraIO-Community/agora-rtc-react", 7 | "main": "dist/index.js", 8 | "module": "dist/index.modern.js", 9 | "source": "src/index.tsx", 10 | "engines": { 11 | "node": ">=10" 12 | }, 13 | "scripts": { 14 | "build": "microbundle-crl --no-compress --format modern,cjs", 15 | "start": "microbundle-crl watch --no-compress --format modern,cjs", 16 | "prepare": "run-s build", 17 | "test": "run-s test:unit test:lint test:build", 18 | "test:build": "run-s build", 19 | "test:lint": "eslint .", 20 | "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", 21 | "test:watch": "react-scripts test --env=jsdom", 22 | "predeploy": "cd example && npm install && npm run build", 23 | "deploy": "gh-pages -d example/build", 24 | "docs": "typedoc src/index.tsx --excludeExternals --categoryOrder 'Wrapper' --categoryOrder 'Components' --categoryOrder '*' --out docs" 25 | }, 26 | "peerDependencies": { 27 | "react": "^16.8.0 || ^17.0.0 || ^18.0.0" 28 | }, 29 | "devDependencies": { 30 | "@testing-library/jest-dom": "^4.2.4", 31 | "@testing-library/react": "^9.5.0", 32 | "@testing-library/user-event": "^7.2.1", 33 | "@types/jest": "^25.1.4", 34 | "@types/node": "^12.12.38", 35 | "@types/react": "^16.9.27", 36 | "@types/react-dom": "^16.9.7", 37 | "@typescript-eslint/eslint-plugin": "^2.26.0", 38 | "@typescript-eslint/parser": "^2.26.0", 39 | "babel-eslint": "^10.0.3", 40 | "cross-env": "^7.0.2", 41 | "eslint": "^6.8.0", 42 | "eslint-config-prettier": "^6.7.0", 43 | "eslint-config-standard": "^14.1.0", 44 | "eslint-config-standard-react": "^9.2.0", 45 | "eslint-plugin-import": "^2.18.2", 46 | "eslint-plugin-node": "^11.0.0", 47 | "eslint-plugin-prettier": "^3.1.1", 48 | "eslint-plugin-promise": "^4.2.1", 49 | "eslint-plugin-react": "^7.17.0", 50 | "eslint-plugin-standard": "^4.0.1", 51 | "gh-pages": "^2.2.0", 52 | "microbundle-crl": "^0.13.10", 53 | "npm-run-all": "^4.1.5", 54 | "prettier": "^2.0.4", 55 | "react": "^16.13.1", 56 | "react-dom": "^16.13.1", 57 | "react-scripts": "^3.4.1", 58 | "typedoc": "^0.22.17", 59 | "typescript": "^4.7.4" 60 | }, 61 | "files": [ 62 | "dist" 63 | ], 64 | "dependencies": { 65 | "agora-rtc-sdk-ng": "^4.3.0" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @module Agora React Wrapper 3 | */ 4 | import React, { RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react' 5 | import AgoraRTC, { 6 | BufferSourceAudioTrackInitConfig, 7 | CameraVideoTrackInitConfig, 8 | ClientConfig, 9 | CustomAudioTrackInitConfig, 10 | CustomVideoTrackInitConfig, 11 | IAgoraRTCClient, 12 | IBufferSourceAudioTrack, 13 | ICameraVideoTrack, 14 | ILocalAudioTrack, 15 | ILocalVideoTrack, 16 | IMicrophoneAudioTrack, 17 | IRemoteVideoTrack, 18 | MicrophoneAudioTrackInitConfig, 19 | ScreenVideoTrackInitConfig, 20 | VideoPlayerConfig 21 | } from 'agora-rtc-sdk-ng' 22 | 23 | export default AgoraRTC; 24 | export * from 'agora-rtc-sdk-ng'; 25 | 26 | /** 27 | * @ignore 28 | */ 29 | export interface AgoraRTCError { 30 | code: AgoraRTCErrorCode; 31 | message: string; 32 | data?: any; 33 | name: string; 34 | } 35 | 36 | /** 37 | * @ignore 38 | */ 39 | export enum AgoraRTCErrorCode { 40 | UNEXPECTED_ERROR = "UNEXPECTED_ERROR", 41 | UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE", 42 | TIMEOUT = "TIMEOUT", 43 | INVALID_PARAMS = "INVALID_PARAMS", 44 | NOT_SUPPORTED = "NOT_SUPPORTED", 45 | INVALID_OPERATION = "INVALID_OPERATION", 46 | OPERATION_ABORTED = "OPERATION_ABORTED", 47 | WEB_SECURITY_RESTRICT = "WEB_SECURITY_RESTRICT", 48 | NETWORK_ERROR = "NETWORK_ERROR", 49 | NETWORK_TIMEOUT = "NETWORK_TIMEOUT", 50 | NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR", 51 | API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT", 52 | ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED", 53 | DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND", 54 | ELECTRON_IS_NULL = "ELECTRON_IS_NULL", 55 | ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR", 56 | CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE", 57 | CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL", 58 | MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID", 59 | PERMISSION_DENIED = "PERMISSION_DENIED", 60 | CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED", 61 | TRACK_IS_DISABLED = "TRACK_IS_DISABLED", 62 | SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED", 63 | LOW_STREAM_ENCODING_ERROR = "LOW_STREAM_ENCODING_ERROR", 64 | INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID", 65 | CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER", 66 | CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER", 67 | VOID_GATEWAY_ADDRESS = "VOID_GATEWAY_ADDRESS", 68 | UID_CONFLICT = "UID_CONFLICT", 69 | INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK", 70 | INVALID_TRACK = "INVALID_TRACK", 71 | SENDER_NOT_FOUND = "SENDER_NOT_FOUND", 72 | CREATE_OFFER_FAILED = "CREATE_OFFER_FAILED", 73 | SET_ANSWER_FAILED = "SET_ANSWER_FAILED", 74 | ICE_FAILED = "ICE_FAILED", 75 | PC_CLOSED = "PC_CLOSED", 76 | SENDER_REPLACE_FAILED = "SENDER_REPLACE_FAILED", 77 | GATEWAY_P2P_LOST = "GATEWAY_P2P_LOST", 78 | NO_ICE_CANDIDATE = "NO_ICE_CANDIDATE", 79 | CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS", 80 | EXIST_DISABLED_VIDEO_TRACK = "EXIST_DISABLED_VIDEO_TRACK", 81 | INVALID_REMOTE_USER = "INVALID_REMOTE_USER", 82 | REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED", 83 | CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED", 84 | CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH", 85 | FETCH_AUDIO_FILE_FAILED = "FETCH_AUDIO_FILE_FAILED", 86 | READ_LOCAL_AUDIO_FILE_ERROR = "READ_LOCAL_AUDIO_FILE_ERROR", 87 | DECODE_AUDIO_FILE_FAILED = "DECODE_AUDIO_FILE_FAILED", 88 | WS_ABORT = "WS_ABORT", 89 | WS_DISCONNECT = "WS_DISCONNECT", 90 | WS_ERR = "WS_ERR", 91 | LIVE_STREAMING_TASK_CONFLICT = "LIVE_STREAMING_TASK_CONFLICT", 92 | LIVE_STREAMING_INVALID_ARGUMENT = "LIVE_STREAMING_INVALID_ARGUMENT", 93 | LIVE_STREAMING_INTERNAL_SERVER_ERROR = "LIVE_STREAMING_INTERNAL_SERVER_ERROR", 94 | LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED", 95 | LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED", 96 | LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR", 97 | LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM", 98 | LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT", 99 | LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE", 100 | LIVE_STREAMING_WARN_FREQUENT_REQUEST = "LIVE_STREAMING_WARN_FREQUENT_REQUEST", 101 | WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR", 102 | BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR", 103 | CROSS_CHANNEL_WAIT_STATUS_ERROR = "CROSS_CHANNEL_WAIT_STATUS_ERROR", 104 | CROSS_CHANNEL_FAILED_JOIN_SRC = "CROSS_CHANNEL_FAILED_JOIN_SEC", 105 | CROSS_CHANNEL_FAILED_JOIN_DEST = "CROSS_CHANNEL_FAILED_JOIN_DEST", 106 | CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST", 107 | CROSS_CHANNEL_SERVER_ERROR_RESPONSE = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE", 108 | METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE" 109 | } 110 | 111 | /** 112 | * Initializes a Web SDK client and stores the instance for the lifecycle of the application 113 | * @param config Configuration for the Web SDK Client instance 114 | * @returns React hook that gives access to the Web SDK Client instance 115 | * @category Wrapper 116 | */ 117 | export const createClient = (config: ClientConfig) => { 118 | let client: IAgoraRTCClient 119 | function createClosure() { 120 | if (!client) { 121 | client = AgoraRTC.createClient(config) 122 | } 123 | return client 124 | } 125 | return () => createClosure() 126 | } 127 | 128 | /** 129 | * Creates and stores the camera and microphone tracks 130 | * @param audioConfig Config for the audio track 131 | * @param videoConfig Config for the video track 132 | * @returns React hook that can be used to access the camera and microphone tracks 133 | * @category Wrapper 134 | */ 135 | export function createMicrophoneAndCameraTracks( 136 | audioConfig?: MicrophoneAudioTrackInitConfig | undefined, 137 | videoConfig?: CameraVideoTrackInitConfig | undefined 138 | ) { 139 | let tracks: [IMicrophoneAudioTrack, ICameraVideoTrack] | null = null 140 | async function createClosure() { 141 | tracks = await AgoraRTC.createMicrophoneAndCameraTracks( 142 | audioConfig, 143 | videoConfig 144 | ) 145 | return tracks 146 | } 147 | return function useMicrophoneAndCameraTracks() { 148 | const [ready, setReady] = useState(false) 149 | const [agoraRTCError, setAgoraRTCError] = useState(null) 150 | const ref = useRef(tracks) 151 | 152 | useEffect(() => { 153 | if (ref.current === null) { 154 | createClosure().then((tracks) => { 155 | ref.current = tracks 156 | setReady(true) 157 | }, (e) => { 158 | setAgoraRTCError(e) 159 | }) 160 | } else { 161 | setReady(true) 162 | } 163 | return () => { 164 | tracks = null 165 | } 166 | }, []) 167 | return { ready, tracks: ref.current, error: agoraRTCError } 168 | } 169 | } 170 | 171 | /** 172 | * Creates and stores the buffer source audio track 173 | * @param config Config for the buffer source audio track 174 | * @returns React hook that can be used to access the buffer source audio track 175 | * @category Wrapper 176 | */ 177 | export function createBufferSourceAudioTrack( 178 | config: BufferSourceAudioTrackInitConfig 179 | ) { 180 | let track: IBufferSourceAudioTrack | null = null 181 | async function createClosure() { 182 | track = await AgoraRTC.createBufferSourceAudioTrack(config) 183 | return track 184 | } 185 | return function useBufferSourceAudioTrack() { 186 | const [ready, setReady] = useState(false) 187 | const [agoraRTCError, setAgoraRTCError] = useState(null) 188 | const ref = useRef(track) 189 | 190 | useEffect(() => { 191 | if (ref.current === null) { 192 | createClosure().then((track) => { 193 | ref.current = track 194 | setReady(true) 195 | }, (e) => { 196 | setAgoraRTCError(e) 197 | }) 198 | } else { 199 | setReady(true) 200 | } 201 | return () => { 202 | track = null 203 | } 204 | }, []) 205 | return { ready, track: ref.current, error: agoraRTCError } 206 | } 207 | } 208 | 209 | /** 210 | * Creates and stores the camera track 211 | * @param config Config for the camera track 212 | * @returns React hook that can be used to access the camera track 213 | * @category Wrapper 214 | */ 215 | export function createCameraVideoTrack(config?: CameraVideoTrackInitConfig) { 216 | let track: ICameraVideoTrack | null = null 217 | async function createClosure() { 218 | track = await AgoraRTC.createCameraVideoTrack(config) 219 | return track 220 | } 221 | return function useCameraVideoTrack() { 222 | const [ready, setReady] = useState(false) 223 | const [agoraRTCError, setAgoraRTCError] = useState(null) 224 | const ref = useRef(track) 225 | 226 | useEffect(() => { 227 | if (ref.current === null) { 228 | createClosure().then((track) => { 229 | ref.current = track 230 | setReady(true) 231 | }, (e) => { 232 | setAgoraRTCError(e) 233 | }) 234 | } else { 235 | setReady(true) 236 | } 237 | return () => { 238 | track = null 239 | } 240 | }, []) 241 | return { ready, track: ref.current, error: agoraRTCError } 242 | } 243 | } 244 | 245 | /** 246 | * Creates and stores the custom audio track 247 | * @param config Config for the custom audio track 248 | * @returns React hook that can be used to access the custom audio track 249 | * @category Wrapper 250 | */ 251 | export function createCustomAudioTrack(config: CustomAudioTrackInitConfig) { 252 | let track: ILocalAudioTrack | null = null 253 | async function createClosure() { 254 | track = await AgoraRTC.createCustomAudioTrack(config) 255 | return track 256 | } 257 | return function useCustomAudioTrack() { 258 | const [ready, setReady] = useState(false) 259 | const [agoraRTCError, setAgoraRTCError] = useState(null) 260 | const ref = useRef(track) 261 | 262 | useEffect(() => { 263 | if (ref.current === null) { 264 | createClosure().then((track) => { 265 | ref.current = track 266 | setReady(true) 267 | }, (e) => { 268 | setAgoraRTCError(e) 269 | }) 270 | } else { 271 | setReady(true) 272 | } 273 | return () => { 274 | track = null 275 | } 276 | }, []) 277 | return { ready, track: ref.current, error: agoraRTCError } 278 | } 279 | } 280 | 281 | /** 282 | * Creates and stores the custom video track 283 | * @param config Config for the custom video track 284 | * @returns React hook that can be used to access the custom video track 285 | * @category Wrapper 286 | */ 287 | export function createCustomVideoTrack(config: CustomVideoTrackInitConfig) { 288 | let track: ILocalVideoTrack | null = null 289 | async function createClosure() { 290 | track = await AgoraRTC.createCustomVideoTrack(config) 291 | return track 292 | } 293 | return function useCustomVideoTrack() { 294 | const [ready, setReady] = useState(false) 295 | const [agoraRTCError, setAgoraRTCError] = useState(null) 296 | const ref = useRef(track) 297 | 298 | useEffect(() => { 299 | if (ref.current === null) { 300 | createClosure().then((track) => { 301 | ref.current = track 302 | setReady(true) 303 | }, (e) => { 304 | setAgoraRTCError(e) 305 | }) 306 | } else { 307 | setReady(true) 308 | } 309 | return () => { 310 | track = null 311 | } 312 | }, []) 313 | return { ready, track: ref.current, error: agoraRTCError } 314 | } 315 | } 316 | 317 | /** 318 | * Creates and stores the microphone track 319 | * @param config Config for the microphone track 320 | * @returns React hook that can be used to access the microphone track 321 | * @category Wrapper 322 | */ 323 | export function createMicrophoneAudioTrack( 324 | config?: MicrophoneAudioTrackInitConfig 325 | ) { 326 | let track: IMicrophoneAudioTrack | null = null 327 | async function createClosure() { 328 | track = await AgoraRTC.createMicrophoneAudioTrack(config) 329 | return track 330 | } 331 | return function useMicrophoneAudioTrack() { 332 | const [ready, setReady] = useState(false) 333 | const [agoraRTCError, setAgoraRTCError] = useState(null) 334 | const ref = useRef(track) 335 | 336 | useEffect(() => { 337 | if (ref.current === null) { 338 | createClosure().then((track) => { 339 | ref.current = track 340 | setReady(true) 341 | }, (e) => { 342 | setAgoraRTCError(e) 343 | }) 344 | } else { 345 | setReady(true) 346 | } 347 | return () => { 348 | track = null 349 | } 350 | }, []) 351 | return { ready, track: ref.current, error: agoraRTCError } 352 | } 353 | } 354 | 355 | /** 356 | * Creates and stores the screenshare tracks 357 | * @param config Config for the screenshare tracks 358 | * @param withAudio Try and create audio track as well (needs browser support) 359 | * @returns React hook that can be used to access the screenshare tracks 360 | * @category Wrapper 361 | */ 362 | export function createScreenVideoTrack( 363 | config: ScreenVideoTrackInitConfig, 364 | withAudio?: 'enable' | 'disable' | 'auto' 365 | ) { 366 | let tracks: [ILocalVideoTrack, ILocalAudioTrack] | ILocalVideoTrack 367 | async function createClosure() { 368 | tracks = await AgoraRTC.createScreenVideoTrack(config, withAudio) 369 | return tracks 370 | } 371 | return function useScreenVideoTrack() { 372 | const [ready, setReady] = useState(false) 373 | const [agoraRTCError, setAgoraRTCError] = useState(null) 374 | const ref = useRef(tracks) 375 | 376 | useEffect(() => { 377 | if (ref.current === undefined) { 378 | createClosure().then((tracks) => { 379 | ref.current = tracks 380 | setReady(true) 381 | }, (e) => { 382 | setAgoraRTCError(e) 383 | }) 384 | } else { 385 | setReady(true) 386 | } 387 | }, []) 388 | return { ready, tracks: ref.current, error: agoraRTCError } 389 | } 390 | } 391 | 392 | /** 393 | * A React component to render the local or remote videoTrack 394 | * @param props videoTrack and video config 395 | * @returns An HTML div element containing the provided videoTrack 396 | */ 397 | export const AgoraVideoPlayer = (props: React.DetailedHTMLProps, HTMLDivElement> & { videoTrack: ILocalVideoTrack | IRemoteVideoTrack | ICameraVideoTrack } & {config?: VideoPlayerConfig}) => { 398 | const vidDiv: RefObject = useRef(null) 399 | const { videoTrack, config, ...other } = props; 400 | useLayoutEffect(() => { 401 | if (vidDiv.current !== null) videoTrack.play(vidDiv.current, config) 402 | return () => { 403 | videoTrack.stop() 404 | } 405 | }, [videoTrack]) 406 | 407 | return
408 | } 409 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist", 4 | "module": "esnext", 5 | "lib": ["dom", "esnext"], 6 | "moduleResolution": "node", 7 | "jsx": "react", 8 | "sourceMap": true, 9 | "declaration": true, 10 | "esModuleInterop": true, 11 | "noImplicitReturns": true, 12 | "noImplicitThis": true, 13 | "noImplicitAny": true, 14 | "strictNullChecks": true, 15 | "suppressImplicitAnyIndexErrors": true, 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "allowSyntheticDefaultImports": true 19 | }, 20 | "include": ["src"], 21 | "exclude": ["node_modules", "dist", "example"] 22 | } 23 | -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | } 6 | } --------------------------------------------------------------------------------