|
@@ -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;
|
|
@@ -330,8 +330,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (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 {
|
|
@@ -354,25 +354,29 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const joystickRes = await this.moveService.joystick(
|
|
|
joystickRequest,
|
|
|
);
|
|
|
- console.log('joystickRes-front', joystickRes);
|
|
|
+
|
|
|
// 有数据 [0]是rotate数据,[1-infinity]是walking数据
|
|
|
if (Array.isArray(joystickRes)) {
|
|
|
// shift出前第一个镜头数据
|
|
|
+
|
|
|
const rotateCamData = joystickRes.shift();
|
|
|
- console.log('rotateCamData', rotateCamData);
|
|
|
+ console.log('rotateCamData', rotateCamData.length);
|
|
|
if (rotateCamData?.length) {
|
|
|
rotateCamData.forEach((item: StreamReplyType) => {
|
|
|
item.type = 'rotate';
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
const seqs = Array.from(
|
|
|
joystickRes,
|
|
|
).flat() as any as StreamReplyType[];
|
|
|
+
|
|
|
if (seqs?.length || rotateCamData?.length) {
|
|
|
+ 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 {
|
|
@@ -524,9 +528,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (typeof message === 'string') {
|
|
|
// wasm:特例, requestIframe
|
|
|
if (message.includes('wasm:')) {
|
|
|
- const msg: RTCMessageRequest = JSON.parse(
|
|
|
- message.replace('wasm:', ''),
|
|
|
- );
|
|
|
+ const parseData = message
|
|
|
+ ? message.replace('wasm:', '')
|
|
|
+ : `{"MstType":1}`;
|
|
|
+ const msg: RTCMessageRequest = JSON.parse(parseData);
|
|
|
this.logger.warn('lostIframe-message', message);
|
|
|
if (msg.MstType === 0) {
|
|
|
this.logger.warn('lostIframe');
|
|
@@ -664,7 +669,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,
|