{"id":19347104,"url":"https://github.com/farsunset-com/android-webrtc-livekit","last_synced_at":"2026-04-13T01:32:18.272Z","repository":{"id":230192173,"uuid":"778722699","full_name":"farsunset-com/android-webrtc-livekit","owner":"farsunset-com","description":"给原生Android提供开箱即用的单人、多人音视频通话、共享桌面插件。完全自主，不依赖第三方云服务","archived":false,"fork":false,"pushed_at":"2024-03-29T09:03:38.000Z","size":59015,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-06T14:29:16.968Z","etag":null,"topics":["android","livekit","webrtc"],"latest_commit_sha":null,"homepage":"http://farsunset.com","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/farsunset-com.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-28T09:19:29.000Z","updated_at":"2024-09-09T07:37:05.000Z","dependencies_parsed_at":"2025-01-06T14:28:06.706Z","dependency_job_id":"bbab09c8-baea-4656-939c-cafa31e8df35","html_url":"https://github.com/farsunset-com/android-webrtc-livekit","commit_stats":null,"previous_names":["farsunset-com/android-webrtc-livekit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farsunset-com%2Fandroid-webrtc-livekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farsunset-com%2Fandroid-webrtc-livekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farsunset-com%2Fandroid-webrtc-livekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farsunset-com%2Fandroid-webrtc-livekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farsunset-com","download_url":"https://codeload.github.com/farsunset-com/android-webrtc-livekit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240457941,"owners_count":19804489,"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":["android","livekit","webrtc"],"created_at":"2024-11-10T04:13:55.146Z","updated_at":"2025-10-12T11:38:18.124Z","avatar_url":"https://github.com/farsunset-com.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 项目介绍\n该项目为原生Android提供开箱即用的单人、多人音视频通话和共享桌面插件。\n目前仅仅提供了安装包，需要源码请访问 https://farsunset.com/about\n\nUniapp版本插件请访问\nhttps://ext.dcloud.net.cn/plugin?id=15159\n\n| 目录                            | 说明                      |\n|-------------------------------|-------------------------|\n| meeting-plugin-2024.03.29.aar | 为原生Android应用提供的可开箱使用插件包 |\n| webrtc-boot-server-1.0.0.jar  | 服务端安装包，文件较大请联系获取        |\n| meeting-plugin-demo           | 插件使用demo                |\n\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"http://staticres.oss-cn-hangzhou.aliyuncs.com/hoxin/group_video_calling.jpg\" width=\"48%\"  /\u003e\n   \u003cimg src=\"http://staticres.oss-cn-hangzhou.aliyuncs.com/hoxin/call_video_incoming.jpg\" width=\"48%\"  /\u003e\n\u003c/div\u003e\n\n### 服务端安装\n\n可以先使用体验环境  http://39.99.150.41:8080\n\nwebrtc-boot-server依赖组件\n\nJDK 1.8+\n\nRedis 6.0+\n\nLivekit 1.5.3+\n\n在webrtc-boot-server-1.0.0.jar 同目录创建 ./config/application.properties 文件\n\n```\n├─webrtc-boot-server-1.0.0.jar\n├─config\n│  └─application.properties\n```\n可覆盖jar里面的默认参数配置\n\n\n#### 配置Redis\n修改 ./config/application.properties\n\n```\nspring.redis.host=127.0.0.1\nspring.redis.port=6379\n#spring.redis.password=\n```\n\n#### Livekit服务器地址\n安装文档 https://www.yuque.com/yuanfangxiyang/hzema9/mpr8zlo99idggx28\n多人会议(SFU)使用了livekit开源的框架，请自己安装搭建\n完成后配置livekit服务地址和appid、secret\n\n修改 ./config/application.properties\n\n```\nlivekit.uri=https://livekit.yourdomain.com\nlivekit.app-id=XXXXXXXXXX\nlivekit.secret=XXXXXXXXXXX\n```\n\n#### 使用CIM为消息推送通道\n\n默认端口需要开启34567 和 45678(websocket)的socket端口,\n客户端需要接入cim的客户端sdk\nhttps://gitee.com/farsunset/cim\n\n\n#### 使用自有的消息推送通道\n关闭cim的socket服务\n在webrtc-boot-server-1.0.0.jar 同目录创建 ./config/application.properties 文件\n\n```\n# 关闭socket服务\ncim.app.enable=false\ncim.websocket.enable=false\n\n```\n\n```\n#配置自己系统的消息推送webhook\nwebrtc.message.webhook=http://192.168.1.100:8081/message/push\n\n```\n当产生业务消息，将会调用该webhook进行消息推送，\n请求方式：POST\n请求类型: application/json\n请求体:\n\n```\n{\n    \"id\": 362433383034392576,\n    \"sender\": 0,\n    \"receiver\":\"10000,10001,10002\",\n    \"action\": \"2\",\n    \"content\": \"系统通知\",\n    \"extra\": null,\n    \"format\": 0,\n    \"timestamp\": 1601024512030\n  } \n\n```\nreceiver 就是需要接受消息的用户ID ，可能多个英文逗号分割\n\n客户端收到消息后按照插件接口传入即可\n\n\n#### 启动服务\n运行 run.sh\n```\n#! /bin/bash  \njava -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./webrtc-boot-server-1.0.0.jar \u0026\n```\n\n运行 run.bat（ windows）\n```\njava -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./webrtc-boot-server-1.0.0.jar\n```\n\n\n### Android插件接口文档\n\n\n#### 1.初始化\n在应用的Application.create()里调用\n```\nWebrtcMeetingSdk.install(this);        \n```\n添加依赖组件\n```\n    //可选\n    implementation \"com.farsunset:cim-android-sdk:4.2.13\"\n\n    implementation 'androidx.palette:palette:1.0.0'\n\n    implementation 'androidx.appcompat:appcompat:1.6.1'\n    implementation 'androidx.recyclerview:recyclerview:1.3.2'\n\n    implementation 'com.google.android.material:material:1.11.0'\n\n    implementation 'com.github.bumptech.glide:glide:4.16.0'\n    implementation \"com.github.bumptech.glide:okhttp3-integration:4.16.0\"\n    annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'\n    implementation 'jp.wasabeef:glide-transformations:4.3.0'\n\n    implementation 'com.squareup.retrofit2:retrofit:2.9.0'\n    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'\n\n    implementation 'com.belerweb:pinyin4j:2.5.1'\n    implementation 'io.livekit:livekit-android:2.2.0'\n    implementation 'com.google.protobuf:protobuf-javalite:3.23.0'       \n```\n\n\n#### 2.设置配置信息\n\n| 字段名        | 必须的    | 含义                                  |\n|------------|--------|-------------------------------------|\n| uid        | 是  | 当前用户ID,可使用多个手机，设置不同UID 测试           |\n| name       | 是  | 当前用户名称                              |\n| logoUri    | 是  | 用户LOGO头像规则地址，根据占位符{uid}可动态获取头像地址 |\n| host       | 是  | 服务端地址  webrtc-boot-server部署访问地址     |\n| token      | 否  | 当前用户token，当前demo 可不传，服务端实现登录接口后可再传  |\n| iceservers | 是  | turn或者sutn服务配置                      |\n\n```\nSetupAppConfig config = new SetupAppConfig();\n\nconfig.setHost(\"http://39.99.150.41:8080\");\n\n/* 设置当前用户信息 */\nconfig.setUid(10000);\nconfig.setName(\"张三\");\nconfig.setLogoUri(\"http://api-hoxin.farsunset.com/file/user-icon/{uid}\");\n\n/* 设置ice服务 */\nconfig.addIceServer(new IceServerConfig(\"stun:stun.l.google.com:19302\"))\n\n/* livekit 服务地址 */\nconfig.setLivekitUri(\"wss://livekit.farsunset.com\");\n\nWebrtcMeetingSdk.setupAppConfig(config);\n\n```\n\n\n#### 3.更新通讯录列表\n同步通讯录。用于选择联系人，不包含当前用户\n```\n\nList\u003cFriend\u003e friends = new ArrayList\u003cFriend\u003e();\n\nFriend friend = new Friend();\nfriend.id = 10001;\nfriend.name = \"李四\";\n\nfriends.add(friend);\nWebrtcMeetingSdk.setupContactList(friends);\n```\n\n#### 4.拨打单人语音通话\nid:被叫UID\n\n```\nWebrtcMeetingSdk.callSingleVoice(10000);\n```\n#### 5.拨打单人视频通话\nid:被叫UID\n\n```\nWebrtcMeetingSdk.callSingleVideo(10000);\n```\n\n#### 6.发起音视频会议\ntrue:从群成员中选择联系人 先调用setupGroupMemberList()\nfalse:从好友列表选择\n```\nWebrtcMeetingSdk.onCreateMeeting(false);\n```\n\n#### 7.加入会议\n根据房间号码通过接口获取到房间信息，然后进入会议\nrequest信息从接口中获取，假如你的服务器是39.99.150.41\nhttp://39.99.150.41:8080/swagger-ui/index.html#/Livekit%E4%BC%9A%E8%AE%AE%E6%8E%A5%E5%8F%A3/getRoomUsingGET\n```\nJoinMeetingRequest request = new JoinMeetingRequest();\nrequest.setName(\"张三\");\nrequest.setUid(10003);\nrequest.setTitle(\"会议主题\");\nrequest.setDescription(\"会议描述\");\nrequest.setTag(\"房间号码\");\n/* 是否开启本地摄像头 */\nrequest.setLocalCameraOn(false);\n/* 是否开启本地麦克风 */\nrequest.setLocalMicrophoneOn(false);\n/* 房间否被全员禁言 */\nrequest.setMuted(false);\nWebrtcMeetingSdk.onJoinMeeting(request);\n```\n\n\n#### 8.收到推送信令消息\n收到服务端推送的通话相关消息，如收到单人来电、会议邀请、ice同步等，都传递给插件去执行即可。\n消息来源参照服务端，使用CIM为消息推送通道或者使用自有的消息推送通道\n```\nWebrtcMeetingSdk.onMessageReceived(message);\n```\n\n\n#### 9.  新增联系人\n通讯录增增联系人\n```\nFriend friend = new Friend();\nfriend.id = 10002;\nfriend.name = \"王五\";\n\nWebrtcMeetingSdk.addContact(friend);\n```\n\n#### 10.  删除联系人\n通讯录删除联系人\nid:用户UID\n```\nWebrtcMeetingSdk.removeContact(10002);\n```\n\n\n#### 本地广播事件通知\n当通话事件产生。通过发送本地广播的方式来通知上层应用，自行监听本地广播获取事件信息，可记录通话，会议记录\n示例代码如下\n```\npublic class WebrtcCallEventReceiver extends BroadcastReceiver {\n\n        @Override\n        public void onReceive(Context context, Intent intent) {\n          \n        }\n\n        IntentFilter getIntentFilter() {\n            IntentFilter filter = new IntentFilter();\n            filter.addAction(\" com.farsunset.meeting.plugin.MEETING_PLUGIN_EVENT\");\n            return filter;\n        }\n}\n\nBroadcastReceiver  eventReceiver = new WebrtcCallEventReceiver();\nLocalBroadcastManager.getInstance(this).registerLocalReceiver(eventReceiver, eventReceiver.getIntentFilter());\n```\n\n\n##### 1.单人通话完结通知\n\n 所有单人通话事件均放在这个事件当中，根据状态来进行消息记录显示处理\n\n| 字段名           | 含义                                            |\n|---------------|-----------------------------------------------|\n| key           | ACTION_CALL_FINISHED                          |\n| data.uid      | 对方UID                                         |\n| data.state    | 通话状态 0:已经接通 1:已经取消 2:已拒绝 3:设备正忙 4:响应超时 5:忽略来电 |\n| data.duration | 通话时长(毫秒)                                      |\n| data.role     | 通话角色 0:主叫 1:被叫                                |\n| data.type     | 通话类型 0:语音 1:视频                                |\n```\npublic class WebrtcCallEventReceiver extends BroadcastReceiver {\n\n        @Override\n        public void onReceive(Context context, Intent intent) {\n             String key = intent.getStringExtra(\"type\");\n             ChatCall call = (ChatCall)intent.getSerializableExtra(\"data\");\n        }\n       \n}\n```\n\n##### 2.发起单人通话\n\n发起单人通话时立即通知\n\n| 字段名  | 含义                   |\n|------|----------------------|\n| key  | ACTION_START_CALLING |\n| data | 对方UID                |\n```\npublic class WebrtcCallEventReceiver extends BroadcastReceiver {\n\n        @Override\n        public void onReceive(Context context, Intent intent) {\n             String key = intent.getStringExtra(\"type\");\n             String uid = intent.getStringExtra(\"data\");\n        }\n       \n}\n```\n\n##### 3.收到会议邀请\n\n收到立即入会邀请，显示提示接听页面时 会发起改广播\n\n| 字段名              | 含义                   |\n|------------------|----------------------|\n| key              | ACTION_MEETING_RING  |\n| data.tag         | 房间号                  |\n| data.title       | 会议主题                 |\n| data.description | 会议描述                 |\n| data.createAt    | 会议创建时间戳(13位)         |\n| data.uid         | 通话发起人UID             |\n| data.name        | 发起人名称                |\n| data.dueTime     | 会议预约时间               |\n```\npublic class WebrtcCallEventReceiver extends BroadcastReceiver {\n\n        @Override\n        public void onReceive(Context context, Intent intent) {\n             String key = intent.getStringExtra(\"type\");\n             String data = intent.getStringExtra(\"data\");\n        }\n       \n}\n```\n\n\n##### 4.会议结束结通知\n\n多人会议完成时，包含解散，退出，发出会议详情信息，用于上层记录通话历史\n\n| 字段名            | 含义                      |\n|----------------|-------------------------|\n| key            | ACTION_MEETING_FINISHED |\n| data.tag       | 房间号                     |\n| data.duration  | 通话时长(毫秒)                |\n| data.timestamp | 会议时间 房间创建时间戳(13位)       |\n| data.joinedAt  | 进入房间时间戳(13位)            |\n| data.uid       | 通话发起人UID                |\n| data.name      | 发起人名称                   |\n| data.members   | 参会人员信息map               |\n```\npublic class WebrtcCallEventReceiver extends BroadcastReceiver {\n\n        @Override\n        public void onReceive(Context context, Intent intent) {\n             String key = intent.getStringExtra(\"type\");\n             String data = intent.getStringExtra(\"data\");\n        }\n       \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarsunset-com%2Fandroid-webrtc-livekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarsunset-com%2Fandroid-webrtc-livekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarsunset-com%2Fandroid-webrtc-livekit/lists"}