|
@@ -25,7 +25,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
private rotateService: RotateService,
|
|
|
private moveService: MoveService,
|
|
|
private getRouterService: GetRouterService, // @InjectQueue('rotate') private rotateQueue: Queue, // @InjectQueue('walking') private walkingQueue: Queue,
|
|
|
- ) { }
|
|
|
+ ) {}
|
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
|
|
|
|
public _frameInteval: NodeJS.Timeout;
|
|
@@ -301,59 +301,61 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
async walking(req) {
|
|
|
try {
|
|
|
+ // if(this.clickQueueSub){
|
|
|
+ // this.clickQueueSub.unsubscribe();
|
|
|
+ // }
|
|
|
this.clickQueue.next(req);
|
|
|
console.log('walking', this.clickQueueSub, JSON.stringify(req));
|
|
|
- if (!this.clickQueueSub) {
|
|
|
- this.clickQueueSub = this.clickQueue.subscribe(async (request) => {
|
|
|
- const user = this.moveService.users[this.user_id];
|
|
|
- const path = await this.getRouterService.searchRoad(
|
|
|
- user.appId,
|
|
|
- user.breakPointId,
|
|
|
- req.clicking_action.clicking_point,
|
|
|
- );
|
|
|
- const walkingRes = await this.moveService.move(path, request);
|
|
|
+ // if (!this.clickQueueSub) {
|
|
|
+ this.clickQueueSub = this.clickQueue.subscribe(async (request) => {
|
|
|
+ const user = this.moveService.users[this.user_id];
|
|
|
+ const path = await this.getRouterService.searchRoad(
|
|
|
+ user.appId,
|
|
|
+ user.breakPointId,
|
|
|
+ req.clicking_action.clicking_point,
|
|
|
+ );
|
|
|
+ const walkingRes = await this.moveService.move(path, request);
|
|
|
|
|
|
- console.log(
|
|
|
- 'walkingRes-length',
|
|
|
- Array.from(walkingRes).flat().length,
|
|
|
- );
|
|
|
+ console.log('walkingRes-length', Array.from(walkingRes).flat().length);
|
|
|
|
|
|
- if (walkingRes && !this.onMoving.value) {
|
|
|
- // console.log('walkingRes-front', walkingRes);
|
|
|
- // shift出前第一个镜头数据
|
|
|
- const rotateCamData = walkingRes.shift();
|
|
|
+ if (walkingRes && !this.onMoving.value) {
|
|
|
+ // console.log('walkingRes-front', walkingRes);
|
|
|
+ // shift出前第一个镜头数据
|
|
|
+ const rotateCamData = walkingRes.shift();
|
|
|
|
|
|
- console.log('rotateCamData', rotateCamData.length);
|
|
|
+ console.log('rotateCamData', rotateCamData.length);
|
|
|
|
|
|
- if (rotateCamData?.length) {
|
|
|
- rotateCamData.forEach((item: StreamReplyType) => {
|
|
|
- item.type = 'rotate';
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('rotateCamData无数据');
|
|
|
- }
|
|
|
- // walkingRes marker to everybody
|
|
|
- const seqs = Array.from(
|
|
|
- walkingRes,
|
|
|
- ).flat() as any as StreamReplyType[];
|
|
|
-
|
|
|
- if (seqs?.length) {
|
|
|
- const lastSeq = rotateCamData?.length
|
|
|
- ? (Array.from(rotateCamData).concat(
|
|
|
+ if (rotateCamData?.length) {
|
|
|
+ rotateCamData.forEach((item: StreamReplyType) => {
|
|
|
+ item.type = 'rotate';
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('rotateCamData无数据');
|
|
|
+ }
|
|
|
+ // walkingRes marker to everybody
|
|
|
+ const seqs = Array.from(
|
|
|
+ walkingRes,
|
|
|
+ ).flat() as any as StreamReplyType[];
|
|
|
+
|
|
|
+ if (seqs?.length) {
|
|
|
+ const lastSeq = rotateCamData?.length
|
|
|
+ ? (Array.from(rotateCamData).concat(
|
|
|
seqs,
|
|
|
) as any as StreamReplyType[])
|
|
|
- : seqs;
|
|
|
- console.log('walking --总序列--seqs', seqs.length);
|
|
|
- this.handleSeqMoving(lastSeq);
|
|
|
- } else {
|
|
|
- console.error('walking-move无数据');
|
|
|
- }
|
|
|
- // this.lastMoveCnt = this.frameCnt.value + seqs.length;
|
|
|
+ : seqs;
|
|
|
+ console.log('walking --总序列--seqs', seqs.length);
|
|
|
+ this.handleSeqMoving(lastSeq);
|
|
|
+ } else {
|
|
|
+ console.error('walking-move无数据');
|
|
|
+ this.cleanMoveSteam();
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ // this.lastMoveCnt = this.frameCnt.value + seqs.length;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // }
|
|
|
} catch (error) {
|
|
|
this.logger.error('walking', error);
|
|
|
+ this.cleanMoveSteam();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -387,8 +389,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
console.log('joystickRes-seqs', seqs.length);
|
|
|
const lastSeq = rotateCamData?.length
|
|
|
? (Array.from(rotateCamData).concat(
|
|
|
- seqs,
|
|
|
- ) as any as StreamReplyType[])
|
|
|
+ seqs,
|
|
|
+ ) as any as StreamReplyType[])
|
|
|
: seqs;
|
|
|
this.handleSeqMoving(lastSeq);
|
|
|
} else {
|
|
@@ -694,7 +696,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
delete redisData.mediaSrc;
|
|
|
this.logger.log(
|
|
|
`user:${this.user_id}:first render stream` +
|
|
|
- JSON.stringify({ path: clipPath, meta: redisData }),
|
|
|
+ JSON.stringify({ path: clipPath, meta: redisData }),
|
|
|
);
|
|
|
const status = await this.pushFirstRender(
|
|
|
clipPath,
|