{"id":18438229,"url":"https://github.com/easemob/livestream-demo-app-server","last_synced_at":"2025-04-14T13:16:01.377Z","repository":{"id":137874723,"uuid":"444406961","full_name":"easemob/livestream-demo-app-server","owner":"easemob","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-28T10:02:31.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-24T23:24:49.510Z","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/easemob.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":"2022-01-04T12:15:09.000Z","updated_at":"2024-01-24T08:16:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"877cb1aa-9ade-4ce3-9244-47c0a0704442","html_url":"https://github.com/easemob/livestream-demo-app-server","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/easemob%2Flivestream-demo-app-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Flivestream-demo-app-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Flivestream-demo-app-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Flivestream-demo-app-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easemob","download_url":"https://codeload.github.com/easemob/livestream-demo-app-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239120196,"owners_count":19584980,"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-06T06:19:06.703Z","updated_at":"2025-02-16T10:43:37.024Z","avatar_url":"https://github.com/easemob.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Livestream Demo App Server\n![logo](./docs/img/214x70.png)\n\n\n## 简介\n\n该服务为 环信直播间Demo 提供后端服务，可作为 App 使用环信SDK实现直播间的服务器端实现示例。\n\n```\n1、每一个直播间，都唯一对应一个聊天室， 直播间复用了对应聊天室的所有资源，包括聊天室详情及成员列表等；\n2、新建一个直播间会同时新建一个聊天室；新建一个直播间时，该直播间的直播状态为“未直播”，当前直播场次ID为0（直播场次ID默认为0，没开始一场直播，直播场次ID加1）；\n3、删除直播间后，聊天室成员会被移出聊天室，直播间所有信息会被删除，用户不可再加入该直播间；\n4、（1.0.3.Final版本新增功能）直播间增加persistent属性，默认为true，当设置为false时，直播间停播一个小时后，会被自动删除；\n5、（1.0.3.Final版本新增功能）直播间支持点播类型。详情请查看直播间API文档。\n```\n\n- 该服务目前提供的功能有\n\n```\n1、创建直播间；\n2、修改直播间详情；\n3、获取直播间详情；\n4、获取直播间列表；\n5、获取正在直播的直播间列表；\n6、开启直播；\n7、结束直播；\n8、转让直播间；\n9、删除直播间；\n10、获取推拉流地址。\n```\n\n## 技术选择\n\n* [Spring Boot](https://spring.io/projects/spring-boot)\n* [Spring Data JPA](https://spring.io/projects/spring-data-jpa)\n* [lombok](https://projectlombok.org/)\n\n\n## 主要组件\n\n* MySQL\n\n\n## 数据库使用说明\n\n* 使用MySQL存储直播间信息\n* 建表SQL见 [建表SQL](./docs/create_tables.sql)\n\n\n## 直播间API文档\n\n[直播间Demo服务端API文档](./docs/直播间API文档.md)\n\n\n## 环信直播间文档\n\n[环信直播间集成文档](http://docs-im.easemob.com/im/other/integrationcases/live-chatroom)\n\n\n## 使用\n\n- 若初次使用环信，需前往 [环信IM开发者注册页](https://console.easemob.com/user/register) 注册成为环信IM开发者；\n\n- 注册成为环信IM开发者后，登录[环信IM管理后台](https://console.easemob.com/user/login) 创建一个应用(App)，之后在App详情页可获得AppKey以及AppKey的clientId和clientSecret；\n\n    - 管理后台的使用可参考文档：[环信管理后台使用指南](http://docs-im.easemob.com/im/quickstart/essential/console)\n\n- 成为环信IM开发者并成功注册App后，可在自己的服务器部署服务\n\n    - 服务配置文件参考：[application.properties](./easemob-im-live-server/src/main/resources/application.properties)\n    \n    - AppKey组成规则：${orgName}#${appName}，拿到AppKey后可得到对应的orgName和appName；\n    \n    - 使用自己的orgName和appName以及AppKey的clientId和clientSecret修改配置文件，如下：\n    ```\n        easemob.live.rest.appkey.orgName=easemob-demo\n        easemob.live.rest.appkey.appName=chatdemoui\n        easemob.live.rest.appkey.clientId=xxxx\n        easemob.live.rest.appkey.clientSecret=xxxx\n    ```\n    \n    - 安装MySQL，并根据[建表SQL](./docs/create_tables.sql)创建数据库及表，设置服务配置文件：\n    ```\n        spring.datasource.url=jdbc:mysql://127.0.0.1:3306/app_server?useSSL=false\u0026useUnicode=true\u0026characterEncoding=utf8\n        spring.datasource.username=root\n        spring.datasource.password=123456\n    ```\n    \n    - 如果需要生成声网CDN推拉流地址，需要设置服务配置文件如下：\n    ```\n        // agora CDN直播相关参数\n        easemob.agora.cdn.appid=xxx\n        easemob.agora.cdn.appcert=xxx\n        easemob.agora.cdn.pushDomain=xxx\n        easemob.agora.cdn.rtmpDomain=xxx\n        easemob.agora.cdn.flvDomain=xxx\n        easemob.agora.cdn.hlsDomain=xxx\n        easemob.agora.cdn.pushPoint=xxx\n        easemob.agora.cdn.expire=xxx\n        // 用于生成防盗链推拉流地址的密钥，如果不需要防盗链可以不用此参数\n        easemob.agora.cdn.pushSecretKey=\n        easemob.agora.cdn.pullSecretKey=\n    ```\n    \n    - 启动服务即可\n\n\n## Docker Deploy\n\n* 如您需要使用 Docker 部署服务，可以参考此流程。\n* [Dockerfile](./easemob-im-live-server/Dockerfile)\n* [Properties for Docker service](./easemob-im-live-server/docker/application-docker.properties)\n\n```\n# 打包\nmvn clean install -DskipTests\n\n# 进入Dockerfile目录\ncd easemob-im-live-server/\n\n# build docker image\nmvn com.spotify:dockerfile-maven-plugin:build\n\n# 至此服务的docker image已经build完成，启动服务需要先启动本地或docker的MySQL服务，并正确配置application-docker.properties中的mysql数据源地址。\n# run docker service\ndocker run -p 8080:8080 easemob/easemob-im-live-server\n```\n\n\n## 模块说明\n\n#### [liveroom模块](./easemob-im-live-server/src/main/java/com/easemob/live/server/liveroom)\n\n- 提供直播间Rest Api服务，包含controller、model、service、exception等。\n\n#### [rest模块](./easemob-im-live-server/src/main/java/com/easemob/live/server/rest)\n\n- 直播间服务需调用环信REST接口，该模块提供调用环信REST服务，包含token、user、chatroom API的调用，封装了调用所需的RequestBody、ResponseBody。\n\n#### [agora-token-server](https://github.com/easemob/livestream-demo-app-server/tree/master/agora-token-service)\n\n- 获取声网trc token。\n\n## 环信文档\n\n[服务端REST文档](http://docs-im.easemob.com/im/server/ready/intro)\n\n\n## Release Note\n\n### 1.0.4.Final\n- 增加声网server模块，获取声网token\n### 1.0.3.Final\n- 直播间支持过期自动清理\n- 直播间支持点播功能\n- 直播间支持Docker部署\n- 直播间详情返回的成员列表过滤了owner\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasemob%2Flivestream-demo-app-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasemob%2Flivestream-demo-app-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasemob%2Flivestream-demo-app-server/lists"}