|
@@ -278,7 +278,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
DIR: random_boolean ? 1 : 3,
|
|
|
};
|
|
|
this.rotateQueue.add(stream, {
|
|
|
- delay: 10,
|
|
|
+ delay: 5,
|
|
|
jobId: `rotate:${this.user_id}:${this.frameCnt.getValue()}`,
|
|
|
removeOnComplete: true,
|
|
|
});
|
|
@@ -294,8 +294,11 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- joystick(request: JoystickRequest) {
|
|
|
- return this.sceneGrpcService.joystick(request);
|
|
|
+ async joystick(request: JoystickRequest) {
|
|
|
+ console.log('JoystickRequest', request);
|
|
|
+ const res = await this.moveService.joystick(request);
|
|
|
+ console.log('res', res);
|
|
|
+ // return this.sceneGrpcService.joystick(request);
|
|
|
}
|
|
|
|
|
|
handleDataChanelOpen(channel: DataChannel): void {
|
|
@@ -337,6 +340,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const walk = msg;
|
|
|
this.walking(walk);
|
|
|
break;
|
|
|
+ case ActionType.joystick:
|
|
|
+ const JoystickRequest = msg as any as JoystickRequest;
|
|
|
+ this.joystick(JoystickRequest);
|
|
|
+ break;
|
|
|
case ActionType.breathPoint:
|
|
|
this.handleBreath(msg);
|
|
|
break;
|
|
@@ -559,32 +566,32 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- // handleRotateStream() {
|
|
|
- // this.roQueueSubscription = this.roQueue.subscribe(
|
|
|
- // async (stream: StreamFrameType) => {
|
|
|
- // this.rotateTimeStamp = Date.now();
|
|
|
-
|
|
|
- // stream.frame = this.rotateframeCnt;
|
|
|
- // console.log('[media]', stream.clipPath);
|
|
|
- // this.logger.log(
|
|
|
- // `roQueueSubscription:frame:${this.rotateframeCnt} ` +
|
|
|
- // JSON.stringify(stream.metaData),
|
|
|
- // );
|
|
|
- // // await this.streamService.pushFrameToSteam(stream);
|
|
|
- // setTimeout(() => {
|
|
|
- // const now = Date.now();
|
|
|
- // if (now - this.rotateTimeStamp > this.rotatePeriod) {
|
|
|
- // console.log('rotate end');
|
|
|
- // // const next = this.rotateframeCnt + 1;
|
|
|
- // // this.resumeStream(next);
|
|
|
- // // this.rotateframeCnt = -1;
|
|
|
- // // this.onMoving = false;
|
|
|
- // // this.onRotating = false;
|
|
|
- // }
|
|
|
- // }, 300);
|
|
|
- // },
|
|
|
- // );
|
|
|
- // }
|
|
|
+ handleRotateStream() {
|
|
|
+ this.roQueueSubscription = this.roQueue.subscribe(
|
|
|
+ async (stream: StreamFrameType) => {
|
|
|
+ this.rotateTimeStamp = Date.now();
|
|
|
+
|
|
|
+ stream.frame = this.rotateframeCnt;
|
|
|
+ console.log('[media]', stream.clipPath);
|
|
|
+ this.logger.log(
|
|
|
+ `roQueueSubscription:frame:${this.rotateframeCnt} ` +
|
|
|
+ JSON.stringify(stream.metaData),
|
|
|
+ );
|
|
|
+ // await this.streamService.pushFrameToSteam(stream);
|
|
|
+ setTimeout(() => {
|
|
|
+ const now = Date.now();
|
|
|
+ if (now - this.rotateTimeStamp > this.rotatePeriod) {
|
|
|
+ console.log('rotate end');
|
|
|
+ // const next = this.rotateframeCnt + 1;
|
|
|
+ // this.resumeStream(next);
|
|
|
+ // this.rotateframeCnt = -1;
|
|
|
+ // this.onMoving = false;
|
|
|
+ // this.onRotating = false;
|
|
|
+ }
|
|
|
+ }, 300);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
cleanMoveSteam() {
|
|
|
if (this.moveQueueSubscription) {
|