gemercheung 3 years ago
parent
commit
5fa4d541c7
1 changed files with 17 additions and 17 deletions
  1. 17 17
      src/meta.gateway.ts

+ 17 - 17
src/meta.gateway.ts

@@ -135,23 +135,23 @@ export class MetaGateway
         console.log('gameChanel', this.gameChanel.isOpen());
         this.sendWertcHeartPack(this.gameChanel);
       }
-      // this.timer = setInterval(() => {
-      //   if (i < 9) {
-      //     const steam = createReadStream(paths + `/${i}.h264`);
-      //     // const steam = createReadStream(paths + `/test2`);
-      //     steam.on('data', (data: Buffer) => {
-      //       // console.log(data.buffer);
-      //       const frame = new DataView(data.buffer);
-      //       // frame.setUint32(0, 1437227610);
-      //       // frame.setUint16(6, 36);
-      //       // frame.setUint16(24, 0);
-      //       // frame.setUint16(26, 0);
-      //       // frame.setUint32(28, 0);
-      //       this.gameChanel.sendMessageBinary(Buffer.from(frame.buffer));
-      //     });
-      //   }
-      //   i++;
-      // }, 10);
+      this.timer = setInterval(() => {
+        if (i < 30) {
+          const steam = createReadStream(paths + `/${i}.h264`);
+          // const steam = createReadStream(paths + `/test2`);
+          steam.on('data', (data: Buffer) => {
+            // console.log(data.buffer);
+            const frame = new DataView(data.buffer);
+            frame.setUint32(0, 1437227610);
+            frame.setUint16(6, 36);
+            frame.setUint16(24, 0);
+            frame.setUint16(26, 0);
+            frame.setUint32(28, 0);
+            this.gameChanel.sendMessageBinary(Buffer.from(frame.buffer));
+          });
+        }
+        i++;
+      }, 10);
     });
     this.gameChanel.onClosed(() => {
       console.log('gameChanel close');