gemercheung hace 3 años
padre
commit
7b6bf8a06c
Se han modificado 5 ficheros con 27 adiciones y 16 borrados
  1. 4 0
      config.dev.yaml
  2. 4 0
      config.production.yaml
  3. 5 2
      config.yaml
  4. 3 3
      src/rotate/rotate.service.ts
  5. 11 11
      src/scene/scene.service.ts

+ 4 - 0
config.dev.yaml

@@ -1,3 +1,7 @@
+
+app:
+  prefix: /mnt/metaverse/scene
+
 http:
   host: '0.0.0.0'
   port: 6688

+ 4 - 0
config.production.yaml

@@ -1,3 +1,7 @@
+
+app:
+  prefix: /mnt/metaverse/scene
+
 http:
   host: '0.0.0.0'
   port: 6688

+ 5 - 2
config.yaml

@@ -1,3 +1,6 @@
+app:
+  prefix: /mnt/metaverse/scene
+
 http:
   host: '0.0.0.0'
   port: 6688
@@ -17,8 +20,8 @@ grpc:
 
 redis:
   port: 6379
-  host: '192.168.0.47' #远程调试需要设置bindip 为0.0.0.0 并且设置密码
-  password: '' # 非远程不需要密码
+  host: '120.24.252.95' #远程调试需要设置bindip 为0.0.0.0 并且设置密码
+  password: 'sxz123321SxZ@' # 非远程不需要密码
   decode_responses: true
   db: 9
 

+ 3 - 3
src/rotate/rotate.service.ts

@@ -80,7 +80,7 @@ export class RotateService {
             extra: '',
             prioritySync: false,
             player: {
-              position: { x: -700, y: 0, z: 0 },
+              position: { x: 100.0, y: 100.0, z: 0.0 },
               angle: {
                 pitch: 0,
                 yaw: 0,
@@ -88,14 +88,14 @@ export class RotateService {
               },
             },
             camera: {
-              position: { x: -1145, y: 0, z: 160 },
+              position: { x: -338.0, y: 100, z: 120.0 },
               angle: {
                 pitch: 0,
                 yaw: 0,
                 roll: 0,
               },
             },
-            cameraCenter: { x: -700, y: 0, z: 0 },
+            cameraCenter: { x: 100.0, y: 100.0, z: 0.0 },
           },
           renderInfo: {
             renderType: 0,

+ 11 - 11
src/scene/scene.service.ts

@@ -14,12 +14,12 @@ import { RotateService } from 'src/rotate/rotate.service';
 import { DelayQueue, RxQueue, ThrottleQueue, DebounceQueue } from 'rx-queue';
 import { MoveService } from 'src/move/move.service';
 import { GetRouterService } from 'src/get-router/get-router.service';
-import { join } from 'path';
-import e from 'express';
+import { ConfigService } from '@nestjs/config';
 
 @Injectable()
 export class SceneService implements OnModuleInit, OnModuleDestroy {
   constructor(
+    private configService: ConfigService,
     private cacheService: CacheService,
     private streamService: StreamService,
     private rotateService: RotateService,
@@ -194,10 +194,6 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
 
   init(request: InitRequest) {
     try {
-      // const initReply = this.sceneGrpcService.init(request);
-      // initReply.subscribe((reply) => {
-      //   console.log('initReply', reply);
-      // });
       this.rotateService.init(request.app_id, request.user_id);
       // this.moveService.init(request.app_id, request.user_id);
 
@@ -264,7 +260,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
               // this.frameCnt += 1;
               this.holdSteam();
               this.lastRenderMedia = src;
-              const clipPath = join(__dirname, `../ws/${src}`);
+              // const clipPath = join(__dirname, `../ws/${src}`);
+              const clipPath = this.configService.get('app.prefix') + src;
               // console.log('src-clipPath', src, clipPath);
               delete redisMeta.mediaSrc;
 
@@ -412,8 +409,9 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
       const mediaSrc = frame.mediaSrc;
       const src = mediaSrc.split('?')[0];
       // 临时本地替换路经
-      // src = src.replace('//', '');
-      const clipPath = join(__dirname, `../ws/${src}`);
+      // const clipPath = join(__dirname, `../ws/${src}`);
+      // const clipPath = src;
+      const clipPath = this.configService.get('app.prefix') + src;
       const type = frame.type?.length ? frame.type.slice() : 'move';
 
       console.log('type', frame.type);
@@ -579,6 +577,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   }
 
   async handleIframeRequest() {
+    //TODO Iframe 最终传什么?
     this.logger.warn('lostIframe');
     this.requestIFrameQueue.next(this.streamService.lastStreamFrame);
     this.requestIFrameQueueSub = this.requestIFrameQueue.subscribe(
@@ -594,7 +593,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
     if (!this.requestIFrameQueueSub) {
       this.requestIFrameQueueSub.subscribe();
     }
-    //TODO Iframe 最终传什么?
+
     // const lastStreamFrame = this.streamService.lastStreamFrame.getValue();
     // lastStreamFrame.DIR = 1;
     // console.log('lastStreamFrame', lastStreamFrame);
@@ -675,7 +674,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
               const src = mediaSrc.split('?')[0];
               // 临时本地替换路经
               // src = src.replace('/10086/', '');
-              const clipPath = join(__dirname, `../ws/${src}`);
+              // const clipPath = join(__dirname, `../ws/${src}`);
+              const clipPath = this.configService.get('app.prefix') + src;
               delete redisData.mediaSrc;
               this.logger.log(
                 `user:${this.user_id}:first render stream` +