shuisheng hace 1 año
padre
commit
4d5d3574d6

+ 2 - 7
src/api/tencentcloudCss.ts

@@ -1,11 +1,6 @@
+import { IStreamKey } from '@/interface';
 import request from '@/utils/request';
 
 export function fetchTencentcloudCssPush(liveRoomId: number) {
-  return request.post<{
-    push_rtmp_url: string;
-    push_obs_server: string;
-    push_obs_stream_key: string;
-    push_webrtc_url: string;
-    push_srt_url: string;
-  }>(`/tencentcloud_css/push`, { liveRoomId });
+  return request.post<IStreamKey>(`/tencentcloud_css/push`, { liveRoomId });
 }

+ 1 - 1
src/hooks/webrtc/tencentcloudCss.ts

@@ -76,7 +76,7 @@ export const useWebRtcTencentcloudCss = () => {
             // https://cloud.tencent.com/document/product/267/92713#1a9164cf-9f99-47d5-9667-ea558886cb9f
             // 使用用户自定义的音视频流。
             await livePusher.startCustomCapture(canvasVideoStream.value);
-            livePusher.startPush(res.data.push_webrtc_url);
+            livePusher.startPush(res.data.webrtc_url);
           }
         } else {
           console.error('rtc不存在');

+ 30 - 0
src/layout/pc/head/index.vue

@@ -296,6 +296,36 @@
               >
                 <div class="txt">{{ t('layout.forwardHuya') }}</div>
               </a>
+              <a
+                class="item"
+                @click.prevent="handleStartLive(LiveRoomTypeEnum.forward_douyu)"
+              >
+                <div class="txt">{{ t('layout.forwardDouyu') }}</div>
+              </a>
+              <a
+                class="item"
+                @click.prevent="
+                  handleStartLive(LiveRoomTypeEnum.forward_douyin)
+                "
+              >
+                <div class="txt">{{ t('layout.forwardDouyin') }}</div>
+              </a>
+              <a
+                class="item"
+                @click.prevent="
+                  handleStartLive(LiveRoomTypeEnum.forward_kuaishou)
+                "
+              >
+                <div class="txt">{{ t('layout.forwardKuaishou') }}</div>
+              </a>
+              <a
+                class="item"
+                @click.prevent="
+                  handleStartLive(LiveRoomTypeEnum.forward_xiaohongshu)
+                "
+              >
+                <div class="txt">{{ t('layout.forwardXiaohongshu') }}</div>
+              </a>
               <a
                 class="item"
                 @click.prevent="handleStartLive(LiveRoomTypeEnum.forward_all)"

+ 4 - 0
src/locales/en/layout.ts

@@ -44,6 +44,10 @@ export default nameSpaceWrap('layout', {
   srsLive: 'SRS Live',
   forwardBilibili: 'forward Bilibili',
   forwardHuya: 'forward Huya',
+  forwardDouyu: 'forward Douyu',
+  forwardDouyin: 'forward Douyin',
+  forwardKuaishou: 'forward Kuaishou',
+  forwardXiaohongshu: 'forward xiaohongshu',
   forwardAll: 'forward All',
   webrtcLive: 'WebRTC Live',
   webrtcMeeting: 'WebRTC Meeting',

+ 7 - 3
src/locales/zh/layout.ts

@@ -43,9 +43,13 @@ export default nameSpaceWrap('layout', {
   author: '作者',
 
   srsLive: 'SRS直播(推荐)',
-  forwardBilibili: '转推b站(beta)',
-  forwardHuya: '转推虎牙(beta)',
-  forwardAll: '转推b站和虎牙(beta)',
+  forwardBilibili: '转推b站',
+  forwardHuya: '转推虎牙',
+  forwardDouyu: '转推斗鱼',
+  forwardDouyin: '转推抖音',
+  forwardKuaishou: '转推快手',
+  forwardXiaohongshu: '转推小红书',
+  forwardAll: '转推所有',
   webrtcLive: 'WebRTC直播(低延迟)',
   webrtcMeeting: 'WebRTC会议(低延迟)',
   msrLive: 'Msr直播(b站实现)',

+ 8 - 0
src/types/ILiveRoom.ts

@@ -27,6 +27,14 @@ export enum LiveRoomTypeEnum {
   forward_bilibili,
   /** 转推虎牙 */
   forward_huya,
+  /** 转推斗鱼 */
+  forward_douyu,
+  /** 转推抖音 */
+  forward_douyin,
+  /** 转推抖音 */
+  forward_kuaishou,
+  /** 转推小红书 */
+  forward_xiaohongshu,
   /** 转推所有 */
   forward_all,
 }

+ 16 - 9
src/views/my/index.vue

@@ -275,23 +275,23 @@
           </div>
 
           <div>
-            转推抖音
+            转推斗鱼
             <div
               class="cdn"
               v-if="
                 userStore.userInfo?.auths?.find(
                   (v) =>
                     v.auth_value ===
-                    DEFAULT_AUTH_INFO.LIVE_PUSH_FORWARD_DOUYIN.auth_value
+                    DEFAULT_AUTH_INFO.LIVE_PUSH_FORWARD_DOUYU.auth_value
                 )
               "
             >
               <n-input-group>
                 <n-input
                   style="width: 500px"
-                  v-model:value="liveRoomInfo!.forward_douyin_url"
+                  v-model:value="liveRoomInfo!.forward_douyu_url"
                   type="text"
-                  placeholder="请输入转推抖音url"
+                  placeholder="请输入转推斗鱼url"
                 />
 
                 <n-button
@@ -313,23 +313,23 @@
           </div>
 
           <div>
-            转推斗鱼
+            转推抖音
             <div
               class="cdn"
               v-if="
                 userStore.userInfo?.auths?.find(
                   (v) =>
                     v.auth_value ===
-                    DEFAULT_AUTH_INFO.LIVE_PUSH_FORWARD_DOUYU.auth_value
+                    DEFAULT_AUTH_INFO.LIVE_PUSH_FORWARD_DOUYIN.auth_value
                 )
               "
             >
               <n-input-group>
                 <n-input
                   style="width: 500px"
-                  v-model:value="liveRoomInfo!.forward_douyu_url"
+                  v-model:value="liveRoomInfo!.forward_douyin_url"
                   type="text"
-                  placeholder="请输入转推斗鱼url"
+                  placeholder="请输入转推抖音url"
                 />
 
                 <n-button
@@ -468,7 +468,14 @@ watch(
 );
 
 async function handleUpdateMyLiveRoom() {
-  const res = await fetchUpdateMyLiveRoom(liveRoomInfo.value!);
+  const res = await fetchUpdateMyLiveRoom({
+    forward_bilibili_url: liveRoomInfo.value?.forward_bilibili_url,
+    forward_douyin_url: liveRoomInfo.value?.forward_douyin_url,
+    forward_douyu_url: liveRoomInfo.value?.forward_douyu_url,
+    forward_huya_url: liveRoomInfo.value?.forward_huya_url,
+    forward_kuaishou_url: liveRoomInfo.value?.forward_kuaishou_url,
+    forward_xiaohongshu_url: liveRoomInfo.value?.forward_xiaohongshu_url,
+  });
   if (res.code === 200) {
     window.$message.success('修改成功!');
   }