{"id":21518152,"url":"https://github.com/ucloud/urtc-react-native-plugin","last_synced_at":"2025-03-17T16:42:01.336Z","repository":{"id":54852647,"uuid":"331833428","full_name":"ucloud/urtc-react-native-plugin","owner":"ucloud","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-16T12:53:46.000Z","size":77946,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-02-25T14:55:52.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ucloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-22T04:11:33.000Z","updated_at":"2021-02-16T12:53:49.000Z","dependencies_parsed_at":"2022-08-14T04:50:19.644Z","dependency_job_id":null,"html_url":"https://github.com/ucloud/urtc-react-native-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Furtc-react-native-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Furtc-react-native-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Furtc-react-native-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Furtc-react-native-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ucloud","download_url":"https://codeload.github.com/ucloud/urtc-react-native-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244071095,"owners_count":20393335,"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":[],"created_at":"2024-11-24T00:50:18.612Z","updated_at":"2025-03-17T16:42:01.312Z","avatar_url":"https://github.com/ucloud.png","language":"Java","readme":"# react-native-urtc\n\n## 安装使用\n\ninstall with yarn:\n\n```\nyarn add react-native-urtc\n```\n\nEither way, then link with:\n\n```\nreact-native link react-native-urtc\n```\n\nrun in android \n\n```\nreact-native run-android\n```\n\nupgrade\n\n```\nyarn upgrade\n```\n\n\n\n ## React-Native 调用\n\n ```\n import UCloudRtc from 'react-native-urtc';\n import UCloudView from './component/videoView/UCloudView';\n ```\n## API\n#### 初始化 initWithAppid\n```\nappid: appid,\nappKey: appKey,\nsdkMode: 0正式模式  1测试模式    \nautoPub: true 开启自动发布 false 关闭\nautoSub：true 开启自动订阅 false 关闭\nUCloudRtc.initWithAppid(appid, appKey, sdkMode, autoPub,autoSub).then(res =\u003e {\n    console.log('收到回调', res);\n  }).catch(err =\u003e {\n    console.log('捕获异常', err);\n  });\n```\n#### 加入房间 joinRoomWithRoomid\n```\nUCloudRtc.joinRoomWithRoomid(roomId, userId, token).then(res =\u003e {\n    console.log('收到回调', res);\n  }).catch(err =\u003e {\n    console.log('捕获异常', err);\n  });\n```\n#### 离开房间\n```\nUCloudRtc.leaveRoom();\n```\n#### 订阅远程流\n ```\n UCloudRtc.subscribeRemoteStream()\n ```\n#### 取消订阅远程流\n ```\n UCloudRtc.unSubscribeRemoteStream()\n ```\n#### 发布本地流\n ```\n flag: 是否开启摄像头 true-推送音视频流 false-仅推送音频\n UCloudRtc.publishLocalStreamWithCameraEnable(flag)\n ```\n#### 取消发布本地流\n ```\n UCloudRtc.unPublishLocalStream()\n ```\n#### 录制音视频\n ```\n UCloudRtc.startRecordLocalStreamWithType()\n ```\n#### 停止录制\n ```\n UCloudRtc.stopRecordLocalStream()\n ```\n\n### 事件监听\n```\n//事件列表 0.1.7\nEVENT_JOIN_ROOM = \"event_joinRoom\";\nEVENT_LEAVE_ROOM = \"event_leaveRoom\";\nEVENT_PUBLISH = \"event_publish\";\nEVENT_UN_PUBLISH = \"event_unPublish\";\nEVENT_SUB = \"event_subscribe\";\nEVENT_UN_SUB = \"event_unSubscribe\";\nEVENT_REMOTE_PUBLISH = \"event_remotePublish\";\nEVENT_REMOTE_UN_PUBLISH = \"event_remoteUnPublish\";\n\nconst UCloudRtcEventEmitter = new NativeEventEmitter(UCloudRtc);\nUCloudRtcEventEmitter.addListener('event_joinRoom', args =\u003e {\n    console.log('事件event_joinRoom', args);\n});\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucloud%2Furtc-react-native-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fucloud%2Furtc-react-native-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucloud%2Furtc-react-native-plugin/lists"}