瀏覽代碼

use v2 sample

gemercheung 3 年之前
父節點
當前提交
639048f187
共有 2 個文件被更改,包括 19 次插入13 次删除
  1. 8 3
      src/meta.gateway.ts
  2. 11 10
      src/scene/scene.service.ts

+ 8 - 3
src/meta.gateway.ts

@@ -231,7 +231,7 @@ export class MetaGateway
     const heartPack = new DataView(new ArrayBuffer(4));
     const heartPack = new DataView(new ArrayBuffer(4));
     heartPack.setUint32(0, 2009889916);
     heartPack.setUint32(0, 2009889916);
     this._webrtcInterval = setInterval(() => {
     this._webrtcInterval = setInterval(() => {
-      if (channel.isOpen()) {
+      if (channel && channel.isOpen()) {
         channel.sendMessageBinary(Buffer.from(heartPack.buffer));
         channel.sendMessageBinary(Buffer.from(heartPack.buffer));
       }
       }
     }, 200);
     }, 200);
@@ -280,8 +280,13 @@ export class MetaGateway
       fe_version: '',
       fe_version: '',
       is_browser: false,
       is_browser: false,
     };
     };
-
-    client.send(JSON.stringify(demoVal));
+    this.sceneService.onSteaming.subscribe((val) => {
+      if (val) {
+        console.log('onSteaming-start', val);
+        client.send(JSON.stringify(demoVal));
+      }
+      // debugger
+    });
   }
   }
 
 
   handleConnection(client: WebSocket, ...args: any[]) {
   handleConnection(client: WebSocket, ...args: any[]) {

文件差異過大導致無法顯示
+ 11 - 10
src/scene/scene.service.ts