shuisheng před 1 rokem
rodič
revize
28aa9d384e
3 změnil soubory, kde provedl 36 přidání a 13 odebrání
  1. 16 7
      README.md
  2. 16 4
      src/hooks/webrtc/rtmpToRtc.ts
  3. 4 2
      src/utils/network/webRTC.ts

+ 16 - 7
README.md

@@ -27,7 +27,6 @@ billd 直播间,目前实现了类似 [bilibili 的 Web 在线直播](https://
 | 直播间前台   | [billd-live](https://github.com/galaxy-s10/billd-live)                           | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live)                                                     | [https://live.hsslive.cn](https://live.hsslive.cn)                   |
 | 直播间后端   | [billd-live-server](https://github.com/galaxy-s10/billd-live-server)             | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live-server?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live-server) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live-server?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live-server)                         | [https://live-api.hsslive.cn](https://live-api.hsslive.cn)           |
 | 直播间后台   | [billd-live-admin](https://github.com/galaxy-s10/billd-live-admin)               | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live-admin?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live-admin) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live-admin?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live-admin)                             | [https://live-admin.hsslive.cn](https://live-admin.hsslive.cn)       |
-| 远程桌面     | [billd-desk](https://github.com/galaxy-s10/billd-desk)                           | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-desk?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-desk) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-desk?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-desk)                                                     | [https://desk.hsslive.cn](https://desk.hsslive.cn)                   |
 | 直播间移动端 | [billd-live-flutter](https://github.com/galaxy-s10/billd-live-flutter)           | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live-flutter?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live-flutter) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live-flutter?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live-flutter)                     | [https://live.hsslive.cn/download](https://live.hsslive.cn/download) |
 | 直播间移动端 | [billd-live-react-native](https://github.com/galaxy-s10/billd-live-react-native) | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live-react-native?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live-react-native) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live-react-native?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live-react-native) | [https://live.hsslive.cn/download](https://live.hsslive.cn/download) |
 | 直播间客户端 | [billd-live-electron](https://github.com/galaxy-s10/billd-live-electron)         | [![github](https://img.shields.io/github/stars/galaxy-s10/billd-live-electron?label=star&logo=GitHub)](https://github.com/galaxy-s10/billd-live-flutter) [![github](https://img.shields.io/github/forks/galaxy-s10/billd-live-electron?label=fork&logo=GitHub)](https://github.com/galaxy-s10/billd-live-electron)                  | [https://live.hsslive.cn/download](https://live.hsslive.cn/download) |
@@ -36,8 +35,8 @@ billd 直播间,目前实现了类似 [bilibili 的 Web 在线直播](https://
 ## 功能
 
 - [x] 原生 webrtc 推拉流
-- [x] srs webrtc 推流,`http-flv` 或 `hls`拉流
-- [x] msr 推流,ffmpeg 转码,`http-flv` 或 `hls`拉流
+- [x] srs webrtc 推流,支持 `http-flv`、`hls`、`webrtc`、`rtmp`拉流
+- [x] msr 推流,ffmpeg 转码,支持 `http-flv`、`hls`、`webrtc`、`rtmp`拉流
 - [x] 一对一打 PK
 - [x] 一对多打 PK
 - [x] 多对多打 PK
@@ -50,10 +49,16 @@ billd 直播间,目前实现了类似 [bilibili 的 Web 在线直播](https://
 - [x] 支付模块(支付宝当面付)
 - [x] 订单模块
 - [x] 商品模块
-- [x] 适配移动端
-- [x] 在线后台
-- [x] 接入腾讯云-云直播
-- [ ] 接入腾讯云-实时音视频 TRTC
+- [x] 礼物模块
+- [x] 直播后台
+- [x] 响应式页面
+- [x] 适配多语言(i18n)
+- [x] 移动端App(Flutter)
+- [ ] 客户端App(Electron)
+- [x] 接入bilibili直播
+- [x] 接入腾讯云(云直播)
+- [ ] 接入腾讯云(实时音视频 TRTC)
+- [x] 私有化部署
 
 ## 技术栈
 
@@ -240,6 +245,10 @@ pnpm run dev
 
 [https://live.hsslive.cn/doc/faq](https://live.hsslive.cn/doc/faq)
 
+## 技术支持
+
+[https://live.hsslive.cn/support](https://live.hsslive.cn/support)
+
 ## 环境配置
 
 ### 本地开发环境

+ 16 - 4
src/hooks/webrtc/rtmpToRtc.ts

@@ -3,11 +3,9 @@ import { ref } from 'vue';
 import { fetchRtcV1Whep } from '@/api/srs';
 import { useRTCParams } from '@/hooks/use-rtcParams';
 import { useNetworkStore } from '@/store/network';
-import { useUserStore } from '@/store/user';
 import { WebRTCClass } from '@/utils/network/webRTC';
 
 export const useWebRtcRtmpToRtc = () => {
-  const userStore = useUserStore();
   const networkStore = useNetworkStore();
 
   const { maxBitrate, maxFramerate, resolutionRatio } = useRTCParams();
@@ -38,7 +36,7 @@ export const useWebRtcRtmpToRtc = () => {
         maxBitrate: currentMaxBitrate.value,
         maxFramerate: currentMaxFramerate.value,
         resolutionRatio: currentResolutionRatio.value,
-        isSRS: true,
+        isSRS: false,
         roomId: roomId.value,
         videoEl: data.videoEl,
         sender: data.sender,
@@ -88,10 +86,24 @@ export const useWebRtcRtmpToRtc = () => {
             window.$message.error('/rtc/v1/play/拿不到sdp');
             return;
           }
+          const arr = answerRes.data.answer.split('\r\n') as string[];
+          for (let i = 0; i < arr.length; i += 1) {
+            if (arr[i].match('candidate')) {
+              const mkcdd = arr[i].split(' ');
+              mkcdd[4] = '8.218.5.78';
+              arr[i] = mkcdd.join(' ');
+            }
+          }
+          const newSdp = arr.join('\r\n');
+          const sdpres =
+            process.env.NODE_ENV === 'development'
+              ? answerRes.data.answer
+              : newSdp;
+          console.log('sdpres', sdpres);
           await rtc.setRemoteDescription(
             new RTCSessionDescription({
               type: 'answer',
-              sdp: answerRes.data.answer,
+              sdp: sdpres,
             })
           );
           // const answerRes = await fetchRtcV1Play({

+ 4 - 2
src/utils/network/webRTC.ts

@@ -337,11 +337,12 @@ export class WebRTCClass {
       'iceconnectionstatechange',
       (event: any) => {
         this.prettierLog({
-          msg: 'pc收到iceconnectionstatechange:connected',
+          msg: 'pc收到iceconnectionstatechange',
           type: 'warn',
         });
         // https://developer.mozilla.org/zh-CN/docs/Web/API/RTCPeerConnection/connectionState
         const iceConnectionState = event.currentTarget.iceConnectionState;
+        console.log('iceconnectionstatechange', iceConnectionState);
         if (iceConnectionState === 'connected') {
           // ICE 代理至少对每个候选发现了一个可用的连接,此时仍然会继续测试远程候选以便发现更优的连接。同时可能在继续收集候选。
           this.prettierLog({
@@ -392,9 +393,10 @@ export class WebRTCClass {
       (event: any) => {
         const connectionState = event.currentTarget.connectionState;
         this.prettierLog({
-          msg: 'pc收到connectionstatechange:connected',
+          msg: 'pc收到connectionstatechange',
           type: 'warn',
         });
+        console.log('connectionstatechange', connectionState);
         if (connectionState === 'connected') {
           // 表示每一个 ICE 连接要么正在使用(connected 或 completed 状态),要么已被关闭(closed 状态);并且,至少有一个连接处于 connected 或 completed 状态。
           this.prettierLog({