VideoItem.ets 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. duration?:string//时长
  36. mimeType?:string//类型
  37. sampleRate?:string//音频的采样率单位为Hz
  38. trackCount?:string//轨道数量
  39. lastPlayedStr?:string;//最后播放时间
  40. playCount?:number//播放次数
  41. lyricContent?:string//歌词内容
  42. md5Str?:string//直接用来保存音质的判断
  43. extra_json?:string
  44. pyStr?:string//中文歌曲名称拼音的首字母
  45. bit_rate?:string//比特率
  46. probe_score?:number//评分
  47. year?:string//年份
  48. nb_streams?:number//流数量
  49. nb_programs?:number//节目数量
  50. constructor(name: string, id: string, filePath: string, type:number,videoSize:number,cTime: string,pixelMap?: image.PixelMap,
  51. size?: string,pixelMapPath?: string,artist?: string,album?: string,fileName?: string, lastPlayed?:Date) {
  52. this.name = name;
  53. this.id = id;
  54. this.filePath = filePath;
  55. this.type = type;
  56. this.videoSize = videoSize;
  57. this.cTime = cTime;
  58. if(StrUtil.isNotEmpty(this.filePath)&&this.type===CommonConstants.TYPE_LOCAL){
  59. try {
  60. this.parentPath = FileUtil.getParentPath(this.filePath);
  61. }catch (e) {
  62. this.parentPath=''
  63. }
  64. }else{
  65. this.parentPath = ''
  66. }
  67. this.isFav = 0;
  68. this.pixelMap = pixelMap;
  69. this.size = size;
  70. this.pixelMapPath = pixelMapPath;
  71. this.artist = artist;
  72. this.album = album;
  73. this.fileName = fileName;
  74. this.lastPlayed = lastPlayed;
  75. this.playCount = 0
  76. this.md5Str = ''
  77. this.extra_json = ''
  78. this.pyStr = ''
  79. }
  80. }