VideoItem.ets 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2023 Huawei Device Co., Ltd.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. import { image } from '@kit.ImageKit';
  16. import { FileUtil, StrUtil } from '@pura/harmony-utils';
  17. import { CommonConstants } from '../common/constants/CommonConstants';
  18. @Observed
  19. export class VideoItem {
  20. id: string;
  21. name: string;//视频和音频文件名称,音频如果是音乐取歌曲名称值
  22. filePath: string
  23. type:number
  24. videoSize:number;
  25. cTime:string;//创建时间
  26. parentPath:string;
  27. isFav:number;
  28. pixelMap?: image.PixelMap;
  29. size?:string;
  30. pixelMapPath?: string;
  31. artist?: string;
  32. album?: string;
  33. fileName?: string;//音乐文件的真实文件名称
  34. lastPlayed?:Date;
  35. constructor(name: string, id: string, filePath: string, type:number,videoSize:number,cTime: string,pixelMap?: image.PixelMap,
  36. size?: string,pixelMapPath?: string,artist?: string,album?: string,fileName?: string, lastPlayed?:Date) {
  37. this.name = name;
  38. this.id = id;
  39. this.filePath = filePath;
  40. this.type = type;
  41. this.videoSize = videoSize;
  42. this.cTime = cTime;
  43. if(StrUtil.isNotEmpty(this.filePath)&&this.type===CommonConstants.TYPE_LOCAL){
  44. this.parentPath = FileUtil.getParentPath(this.filePath);
  45. }else{
  46. this.parentPath = ''
  47. }
  48. this.isFav = 0;
  49. this.pixelMap = pixelMap;
  50. this.size = size;
  51. this.pixelMapPath = pixelMapPath;
  52. this.artist = artist;
  53. this.album = album;
  54. this.fileName = fileName;
  55. this.lastPlayed = lastPlayed;
  56. }
  57. }