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