|
@@ -76,7 +76,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
constructor(
|
|
|
private cacheService: CacheService,
|
|
|
private streamService: StreamService,
|
|
|
- ) { }
|
|
|
+ ) {}
|
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
|
private sceneGrpcService: SceneGrpcService;
|
|
|
|
|
@@ -151,7 +151,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
return this.sceneGrpcService.move(request);
|
|
|
}
|
|
|
|
|
|
- async rotate(request: RotateRequest) {
|
|
|
+ async rotate1(request: RotateRequest) {
|
|
|
try {
|
|
|
// const reply = this.sceneGrpcService.rotate(request);
|
|
|
if (!this.onSteaming) {
|
|
@@ -203,21 +203,23 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async rotatebk(request: RotateRequest) {
|
|
|
+ async rotate(request: RotateRequest) {
|
|
|
try {
|
|
|
- const reply = this.sceneGrpcService.rotate(request);
|
|
|
- const res = await this.cacheService.publish(
|
|
|
- 'test',
|
|
|
- JSON.stringify(request),
|
|
|
- );
|
|
|
+ // const reply = this.sceneGrpcService.rotate(request);
|
|
|
+ // const res = await this.cacheService.publish(
|
|
|
+ // 'test',
|
|
|
+ // JSON.stringify(request),
|
|
|
+ // );
|
|
|
|
|
|
- console.log('res', res);
|
|
|
+ // console.log('res', res);
|
|
|
|
|
|
if (!this.onSteaming) {
|
|
|
this.frameCnt += 1;
|
|
|
this.RotateframeCnt = this.frameCnt;
|
|
|
// this.cacheService
|
|
|
this.testFrame += 1;
|
|
|
+ this.mockserverTime += 10;
|
|
|
+ this.onSteaming = true;
|
|
|
if (this.testFrame > 358) this.testFrame = 0;
|
|
|
const stream: StreamFrameType = {
|
|
|
frame: this.frameCnt,
|
|
@@ -226,53 +228,19 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
`../ws/video/100/100.${this.testFrame.padLeft(4, '0')}.h264`,
|
|
|
),
|
|
|
metaData: JSON.stringify(frameMetaReply),
|
|
|
- serverTime: 754871824,
|
|
|
- DIR: 1,
|
|
|
+ serverTime: this.mockserverTime,
|
|
|
+ DIR: 3,
|
|
|
};
|
|
|
console.log('stream', this.frameCnt, stream.clipPath);
|
|
|
this.streamService.pushFrameToSteam(stream);
|
|
|
- const redisMeta = await this.cacheService.rpop(
|
|
|
- `updateFrameMetadata:${this.user_id}`,
|
|
|
- );
|
|
|
- // this.frameCnt += 1;
|
|
|
- if (redisMeta && redisMeta.length > 0) {
|
|
|
- console.log('this.user_id', this.user_id);
|
|
|
- const meta = JSON.parse(redisMeta);
|
|
|
- if ('mediaSrc' in meta) {
|
|
|
- console.log('meta', meta);
|
|
|
- console.log('mediaSrc', meta.mediaSrc);
|
|
|
-
|
|
|
- if (meta.mediaSrc.length > 0) {
|
|
|
- // const testclipPath = meta.mediaSrc.replace(
|
|
|
- // '/mnt/oss/metaverse/scene/0000000001/100/',
|
|
|
- // '',
|
|
|
- // );
|
|
|
- // console.log('testclipPath', testclipPath);
|
|
|
- // // const demoPath =
|
|
|
- // // this.frameCnt > 10
|
|
|
- // // ? path.join(__dirname, '../ws/video/53.h264')
|
|
|
- // // : path.join(__dirname, '../ws/video/2.h264');
|
|
|
- // const demoPath = path.join(
|
|
|
- // __dirname,
|
|
|
- // `../ws/video/${testclipPath}`,
|
|
|
- // );
|
|
|
- // delete meta.mediaSrc;
|
|
|
- // const stream: StreamFrameType = {
|
|
|
- // frame: this.frameCnt,
|
|
|
- // clipPath: demoPath,
|
|
|
- // metaData: JSON.stringify(meta),
|
|
|
- // serverTime: 754873824,
|
|
|
- // DIR: 3,
|
|
|
- // };
|
|
|
- // this.streamService.pushFrameToSteam(stream);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // const redisMeta = await this.cacheService.rpop(
|
|
|
+ // `updateFrameMetadata:${this.user_id}`,
|
|
|
+ // );
|
|
|
}
|
|
|
- reply.subscribe((res: NormalReply) => {
|
|
|
- if (res.code === 200) {
|
|
|
- }
|
|
|
- });
|
|
|
+ // reply.subscribe((res: NormalReply) => {
|
|
|
+ // if (res.code === 200) {
|
|
|
+ // }
|
|
|
+ // });
|
|
|
} catch (error) {
|
|
|
this.logger.error('rotate', error);
|
|
|
}
|
|
@@ -661,23 +629,6 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.streamService.pushFrameToSteam(stream);
|
|
|
}
|
|
|
|
|
|
- // console.log('padLeft', );
|
|
|
- // if (this.frameCnt > 2) {
|
|
|
- // setInterval(() => {
|
|
|
- // this.frameCnt += 1;
|
|
|
- // const stream: StreamFrameType = {
|
|
|
- // frame: this.frameCnt,
|
|
|
- // clipPath: path.join(
|
|
|
- // __dirname,
|
|
|
- // `../ws/video/100/100.${this.frameCnt.padLeft(4, '0')}.h264`,
|
|
|
- // ),
|
|
|
- // metaData: JSON.stringify(frameMetaReply),
|
|
|
- // serverTime: 754871824,
|
|
|
- // };
|
|
|
- // this.streamService.pushFrameToSteam(stream);
|
|
|
- // }, 1000 / 30);
|
|
|
- // };
|
|
|
-
|
|
|
if (this.frameCnt > 1 && !this.onSteaming) {
|
|
|
const streamMeta: StreamMetaType = {
|
|
|
frame: this.frameCnt,
|
|
@@ -685,8 +636,6 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
};
|
|
|
this.streamService.pushMetaDataToSteam(streamMeta);
|
|
|
}
|
|
|
-
|
|
|
- // }
|
|
|
} catch (error) {
|
|
|
console.log('error', error);
|
|
|
}
|