{"id":21768272,"url":"https://github.com/hoaphantn7604/react-native-webrtc-simple","last_synced_at":"2025-04-13T15:41:27.450Z","repository":{"id":50333601,"uuid":"352895643","full_name":"hoaphantn7604/react-native-webrtc-simple","owner":"hoaphantn7604","description":"A simple and easy to use module that help in making video call for React Native.","archived":false,"fork":false,"pushed_at":"2022-11-08T03:25:32.000Z","size":799,"stargazers_count":20,"open_issues_count":7,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T06:34:44.902Z","etag":null,"topics":["components","elements","react-native","video-call","webrtc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoaphantn7604.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-30T06:35:07.000Z","updated_at":"2022-10-17T02:06:27.000Z","dependencies_parsed_at":"2023-01-22T22:00:23.476Z","dependency_job_id":null,"html_url":"https://github.com/hoaphantn7604/react-native-webrtc-simple","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-webrtc-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-webrtc-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-webrtc-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-webrtc-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoaphantn7604","download_url":"https://codeload.github.com/hoaphantn7604/react-native-webrtc-simple/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248739911,"owners_count":21154247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["components","elements","react-native","video-call","webrtc"],"created_at":"2024-11-26T13:35:12.178Z","updated_at":"2025-04-13T15:41:27.429Z","avatar_url":"https://github.com/hoaphantn7604.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-webrtc-simple\nA simple and easy to use module that help in making video call for React Native.\nImplemented using [react-native-webrtc](https://github.com/react-native-webrtc/react-native-webrtc).\n\n\n## Getting started\n```js\nnpm install react-native-webrtc-simple --save\n```\nor\n```js\nyarn add react-native-webrtc-simple\n```\n\nNow we need to install [react-native-webrtc](https://github.com/react-native-webrtc/react-native-webrtc)\n\n### Document\n\n#### WebrtcSimple\n\n| Method                       | Description                   |\n| ---------------------------- | ----------------------------- |\n| start                        | Create connections            |\n| stop                         | Stop connections              |\n| getSessionId                 | Get your session id           |\n| getLocalStream               | Get your video stream         |\n| getRemoteStream              | Get remote video stream       |\n| listenings                   | Listenings call events        |\n| events                       | Method call events            |\n\n#### WebrtcSimple.start\n| Value    | Type           | Description                                                             |\n| -------- | -------------- | ----------------------------------------------------------------------- |\n| optional | Object or null | Option peer configuration (https://peerjs.com/)                         |\n| key      | String         | Your session id                                                         |\n\n## Peer-to-Peer\n\n#### WebrtcSimple.listenings.callEvents\n| Value            | Type    | Description                                                             |\n| ---------------- | ------- | ----------------------------------------------------------------------- |\n| START_CALL       | String  | Your start call status                                                  |\n| RECEIVED_CALL    | String  | Call received status                                                    |\n| ACCEPT_CALL      | String  | Call aceept status                                                      |\n| END_CALL         | String  | Call end status                                                         |\n| MESSAGE          | String  | Listenings a message                                                    |\n\n#### WebrtcSimple.events\n| Method        | Params                         | Description                                                             |\n| --------------| ------------------------------ | ----------------------------------------------------------------------- |\n| call          | sessionId:String, data:any     | Initiate a call                                                         |\n| acceptCall    | No                             | Accept a call                                                           |\n| endCall       | No                             | Reject a call                                                           |\n| switchCamera  | No                             | Switch camera                                                           |\n| videoEnable   | No                             | On/Off video                                                            |\n| audioEnable   | No                             | On/Off audio                                                            |\n| message       | data:any                       | Events send message                                                     |\n\n\n## Multiple Peer\n\n#### WebrtcSimple.listenings.callEvents\n| Value                | Type    | Description                                                             |\n| -------------------- | ------- | ----------------------------------------------------------------------- |\n| START_GROUP_CALL     | String  | Your start call status                                                  |\n| RECEIVED_GROUP_CALL  | String  | Call received status                                                    |\n| JOIN_GROUP_CALL      | String  | Call received status                                                    |\n| LEAVE_GROUP_CALL     | String  | Call reject status                                                      |\n\n\n#### WebrtcSimple.events\n| Method        | Params                                          | Description                                                             |\n| --------------| ----------------------------------------------- | ----------------------------------------------------------------------- |\n| groupCall     | groupSessionId: string[], userData: object = {} | Start group call                                                        |\n| joinGroup     | arrSessionId: string[]                          | Join group call                                                         |\n| leaveGroup    | No                                              | Leave group call                                                        |\n| addStream     | sessionId: string                               | Create a stream                                                         |\n| switchCamera  | No                                              | Switch camera                                                           |\n| videoEnable   | No                                              | On/Off video                                                            |\n| audioEnable   | No                                              | On/Off audio                                                            |\n| message       | data:any                                        | Events send message                                                     |\n\n\n### Usage\n```js\nimport WebrtcSimple from 'react-native-webrtc-simple';\n\nuseEffect(() =\u003e {\n    const configuration = {\n      optional: null,\n      key: Math.random().toString(36).substr(2, 4), //optional\n    };\n\n    WebrtcSimple.start(configuration)\n        .then((status) =\u003e {\n        if (status) {\n            const stream = WebrtcSimple.getLocalStream();\n            console.log('My stream: ', stream);\n\n            WebrtcSimple.getSessionId((id: string) =\u003e {\n                console.log('UserId: ', id);\n            });\n        }\n        })\n        .catch();\n\n    WebrtcSimple.listenings.callEvents((type, userData) =\u003e {\n      console.log('Type: ', type);\n      // START_CALL\n      // RECEIVED_CALL\n      // ACCEPT_CALL\n      // END_CALL\n      // MESSAGE\n      // START_GROUP_CALL\n      // RECEIVED_GROUP_CALL\n      // JOIN_GROUP_CALL\n      // LEAVE_GROUP_CALL\n    });\n\n    WebrtcSimple.listenings.getRemoteStream((remoteStream) =\u003e {\n      console.log('Remote stream', remoteStream);\n    });\n\n}, []);\n\nconst callToUser = (userId) =\u003e {\n  const data = {};\n  WebrtcSimple.events.call(userId, data);\n};\n\nconst acceptCall = () =\u003e {\n  WebrtcSimple.events.acceptCall();\n};\n\nconst endCall = () =\u003e {\n  WebrtcSimple.events.endCall();\n};\n\nconst switchCamera = () =\u003e {\n  WebrtcSimple.events.switchCamera();\n};\n\nconst video = (enable: boolean) =\u003e {\n  WebrtcSimple.events.videoEnable(enable);\n};\n\nconst audio = (enable: boolean) =\u003e {\n  WebrtcSimple.events.audioEnable(enable);\n};\n\nconst sendMessage = (message: any) =\u003e {\n    WebrtcSimple.events.message(message);\n};\n\nconst groupCall = (sessionId: string[]) =\u003e {\n    const data = {};\n    WebrtcSimple.events.groupCall(sessionId, data);\n};\n\nconst joinGroup = (groupSessionId: string[]) =\u003e {\n  WebrtcSimple.events.joinGroup(groupSessionId);\n};\n\nconst leaveGroup = () =\u003e {\n  WebrtcSimple.events.leaveGroup();\n};\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaphantn7604%2Freact-native-webrtc-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoaphantn7604%2Freact-native-webrtc-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaphantn7604%2Freact-native-webrtc-simple/lists"}