gemercheung 2 years ago
parent
commit
91f0c77eb6

+ 1 - 1
.env.eur

@@ -20,5 +20,5 @@ VITE_APP_APIS_URL=https://testeur.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/
 VITE_USE_HTTPS=1
 VITE_PUBLIC_DIR='/livestream/'
-VITE_ROOM_MEMBER=4
+VITE_ROOM_MEMBER=10
 VITE_SHOW_CONSOLE=1

+ 3 - 3
src/App.vue

@@ -81,13 +81,13 @@
       mobile: true,
     });
     // SDK初始化
+    app.use('Tag');
+
     app.use('MinMap', { theme: { camera_fillStyle: '#ED5D18' } }).then(() => {
       refMiniMap.value = '[xui_min_map]';
+      console.log('小地图SDK');
     });
-    app.use('Tag');
-
     createTourPlayer();
-
     app
       .use('TagView', {
         render(data) {

+ 19 - 6
src/components/chatRoom/camera.vue

@@ -2,7 +2,7 @@
   <div
     :id="cameraBoxId"
     class="camera_box"
-    v-show="isLeader && isPublished && isPanoramaMode && !muteVideoLeader"
+    v-show="isLeader && isRTCJoined && isPanoramaMode && !muteVideoLeader && hosterhasVideo"
   >
     <span class="micBox">
       <i class="speak_mic" v-if="!roomLeader?.IsMuted"></i>
@@ -12,7 +12,9 @@
   <div
     :id="cameraRemoveBoxId"
     class="camera_box"
-    v-show="!isLeader && isPublished && roomLeader && isPanoramaMode && !muteVideoLeader"
+    v-show="
+      !isLeader && isRTCJoined && roomLeader && isPanoramaMode && !muteVideoLeader && hosterhasVideo
+    "
   >
     <span class="micBox">
       <i class="speak_mic" v-if="!roomLeader?.IsMuted"></i>
@@ -21,7 +23,7 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { computed, onMounted } from 'vue';
+  import { computed, onMounted, unref, watch } from 'vue';
   import { useAppStore } from '/@/store/modules/app';
   import { useRtcSdk } from '/@/hooks/useTRTC';
   import { useRtcStore } from '/@/store/modules/rtc';
@@ -29,8 +31,8 @@
   const rtcStore = useRtcStore();
   const appStore = useAppStore();
   // const destination = computed(() => (rtcStore.isLeader ? '.local' : '.remote'));
-  const isPublished = computed(() => rtcStore.isPublished);
-  // const isRTCJoined = computed(() => rtcStore.isRTCJoined);
+  // const isPublished = computed(() => rtcStore.isPublished);
+  const isRTCJoined = computed(() => rtcStore.isRTCJoined);
   const isLeader = computed(() => rtcStore.isLeader);
   // const remoteStreams = computed(() => rtcStore.remoteStreams);
   const roomLeader = computed(() => rtcStore.getRoomLeader());
@@ -38,7 +40,18 @@
   const cameraRemoveBoxId = computed(() => 'camera_remote_box_' + rtcStore.userId);
   const isPanoramaMode = computed(() => appStore.mode === 'panorama');
   const { muteVideoLeader } = useRtcSdk();
-  onMounted(() => {});
+  const hosterhasVideo = computed(() => rtcStore.videoDeviceId?.length > 0);
+  const remoteStreams = computed(() => rtcStore.remoteStreams);
+  console.log('hosterhasVideo', hosterhasVideo);
+  onMounted(() => {
+    watch(
+      () => remoteStreams,
+      (val) => {
+        console.log('remoteStreams', unref(val));
+      },
+      { deep: true },
+    );
+  });
 </script>
 <style lang="scss">
   .camera_box {

+ 4 - 1
src/components/chatRoom/chat.vue

@@ -90,7 +90,10 @@
       .chat-content {
         color: #fff;
         font-size: 0.28rem;
-        word-break: break-all;
+        // word-break: break-all;
+        white-space: pre-wrap;
+        word-wrap: break-word;
+        text-align: justify;
       }
     }
     &::-webkit-scrollbar {

+ 12 - 7
src/components/chatRoom/controls/actions.ts

@@ -286,13 +286,18 @@ const handleUserMuted = (UserId?: string, muted?: boolean) => {
     });
   if (UserId == rtcStore.userId) {
     rtcStore.setMute(!!muted);
-    const { localStream } = useRtcSdk();
-    console.log('audio::status', UserId, muted);
-    if (muted) {
-      localStream.muteAudio();
-    } else {
-      localStream.unmuteAudio();
-    }
+
+    // console.log('audio::status', UserId, muted);
+    setTimeout(() => {
+      console.log('被禁人状态-->', UserId, muted);
+      const { localStream } = useRtcSdk();
+      if (muted) {
+        console.log('被禁人状态-->', localStream);
+        localStream.muteAudio();
+      } else {
+        localStream.unmuteAudio();
+      }
+    }, 500);
   }
 };
 

+ 5 - 0
src/hooks/useTRTC.ts

@@ -157,6 +157,11 @@ async function handleJoin() {
   playLocal();
   // }, 1000);
 
+  if (!rtcStore.isLeader) {
+    localStream.muteAudio();
+    console.log('参加者默认-muteAudio');
+  }
+
   localStream.on('error', (error) => {
     if (error.getCode() === 0x4043) {
       // 自动播放受限导致播放失败,此时引导用户点击页面。

+ 1 - 1
src/locales/lang/en/base.ts

@@ -37,5 +37,5 @@ export default {
   baseError1: 'The scene is calculating, please try again later',
   baseError2: 'Abnormal studio, please contact the host.',
   roomTimeOut:
-    'The valid duration of the studio is sixty minutes; after sixty minutes, the Livestream will automatically end. Please create a new studio for Livestream if necessary. Please also note the remaining time displayed above. Thank you.',
+    'The valid duration of the studio is up to sixty minutes, please also note that the remaining time displayed above. Thank you.',
 };