فهرست منبع

🐞 fix: 添加房间是否存在判断

wolyshaw 2 سال پیش
والد
کامیت
5d75d36b85
4فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 1 0
      package-lock.json
  2. 1 1
      package.json
  3. 1 1
      src/components/live-broadcast/index.tsx
  4. 2 2
      src/components/live-broadcast/runtime.ts

+ 1 - 0
package-lock.json

@@ -5,6 +5,7 @@
   "requires": true,
   "packages": {
     "": {
+      "name": "dy-admin-live",
       "version": "0.0.0",
       "dependencies": {
         "@rongcloud/imlib-next": "^5.3.3",

+ 1 - 1
package.json

@@ -3,7 +3,7 @@
   "private": true,
   "version": "0.0.0",
   "scripts": {
-    "dev": "vite",
+    "dev": "vite --port 3001",
     "build": "vue-tsc --noEmit --skipLibCheck && vite build",
     "preview": "vite preview",
     "previews": "npx http-server ./dist -P https://test.dayaedu.com"

+ 1 - 1
src/components/live-broadcast/index.tsx

@@ -231,7 +231,7 @@ export default defineComponent({
         }
         const remoteTracks: RTC.RCRemoteTrack[] | undefined =
           join?.room?.getRemoteTracks();
-        if (remoteTracks) {
+        if (remoteTracks && remoteTracks.length) {
           await join?.room?.subscribe(remoteTracks);
         }
         if (join.room && join.code === RTC.RCRTCCode.SUCCESS) {

+ 2 - 2
src/components/live-broadcast/runtime.ts

@@ -771,7 +771,7 @@ export const closeLive = async (
  */
 export const loopSyncLike = async () => {
   // (runtime.likeCount !== runtime.lastLikeCount || runtime.likeCount === 0) &&
-  if (state.user) {
+  if (state.user && runtime.joinedRoom) {
     try {
       await request.get("/api-web/imLiveBroadcastRoom/syncLike", {
         hideLoading: true,
@@ -826,7 +826,7 @@ export const sendMessage = async (msg: any, type: SendMessageType = "text") => {
   if (!msg) return;
   const conversation = {
     conversationType: RongIMLib.ConversationType.CHATROOM,
-    targetId: runtime.joinedRoom?._roomId as string,
+    targetId: runtime.joinedRoom?.getRoomId() as string,
   };
   if (type === "text") {
     message = new RongIMLib.TextMessage({