parseData.ts 873 B

123456789101112131415161718192021222324252627
  1. import { CameraGroupListTypeBackEnd, Camera } from '../type';
  2. import { getVideoRenderUrlKey } from '../utils';
  3. export function parseCameraGroupChildren(groupListBackEnd: CameraGroupListTypeBackEnd) {
  4. const groupList = groupListBackEnd as any;
  5. for (const group of groupList) {
  6. const newChildren: Camera[] = [];
  7. group.children.map((x) => {
  8. const cameraInfo = {} as Camera;
  9. cameraInfo['id'] = x['id'];
  10. cameraInfo['code'] = x['code'];
  11. cameraInfo['name'] = x['name'];
  12. cameraInfo.imageUrl = x.pushStreamDTO['imageUrl'];
  13. // cameraInfo.tenantId = x.tenantId;
  14. try {
  15. cameraInfo['url'] = x.pushStreamDTO['videoUrls'][getVideoRenderUrlKey()];
  16. } catch (error) {
  17. cameraInfo['url'] = '';
  18. }
  19. newChildren.push(cameraInfo as Camera);
  20. });
  21. group.children = newChildren;
  22. }
  23. return groupList;
  24. }