Browse Source

use v2 sample

gemercheung 3 years ago
parent
commit
639048f187
2 changed files with 19 additions and 13 deletions
  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));
     heartPack.setUint32(0, 2009889916);
     this._webrtcInterval = setInterval(() => {
-      if (channel.isOpen()) {
+      if (channel && channel.isOpen()) {
         channel.sendMessageBinary(Buffer.from(heartPack.buffer));
       }
     }, 200);
@@ -280,8 +280,13 @@ export class MetaGateway
       fe_version: '',
       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[]) {

File diff suppressed because it is too large
+ 11 - 10
src/scene/scene.service.ts