1# 媒体子系统JS API变更 2 3OpenHarmony 3.2 Beta3版本相较于OpenHarmony 3.2 Beta2版本,媒体子系统的API变更如下: 4 5## 接口变更 6 7| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | 8|---|---|---|---| 9| ohos.multimedia.audio | VolumeEvent | networkId: string; | 新增 | 10| ohos.multimedia.audio | VolumeEvent | volumeGroupId: number; | 新增 | 11| ohos.multimedia.audio | AudioDeviceDescriptor | readonly volumeGroupId: number; | 新增 | 12| ohos.multimedia.audio | AudioDeviceDescriptor | readonly interruptGroupId: number; | 新增 | 13| ohos.multimedia.audio | AudioDeviceDescriptor | readonly networkId: string; | 新增 | 14| ohos.multimedia.audio | VolumeGroupInfo | readonly type: ConnectType; | 新增 | 15| ohos.multimedia.audio | VolumeGroupInfo | readonly groupName: string; | 新增 | 16| ohos.multimedia.audio | VolumeGroupInfo | readonly mappingId: number; | 新增 | 17| ohos.multimedia.audio | VolumeGroupInfo | readonly groupId: number; | 新增 | 18| ohos.multimedia.audio | VolumeGroupInfo | readonly networkId: string; | 新增 | 19| ohos.multimedia.audio | ConnectType | CONNECT_TYPE_DISTRIBUTED = 2 | 新增 | 20| ohos.multimedia.audio | ConnectType | CONNECT_TYPE_LOCAL = 1 | 新增 | 21| ohos.multimedia.audio | AudioGroupManager | isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;<br>isMute(volumeType: AudioVolumeType): Promise\<boolean>; | 新增 | 22| ohos.multimedia.audio | AudioGroupManager | mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>): void;<br>mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>; | 新增 | 23| ohos.multimedia.audio | AudioGroupManager | getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>getMaxVolume(volumeType: AudioVolumeType): Promise\<number>; | 新增 | 24| ohos.multimedia.audio | AudioGroupManager | getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>getMinVolume(volumeType: AudioVolumeType): Promise\<number>; | 新增 | 25| ohos.multimedia.audio | AudioGroupManager | getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>getVolume(volumeType: AudioVolumeType): Promise\<number>; | 新增 | 26| ohos.multimedia.audio | AudioGroupManager | setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\<void>): void;<br>setVolume(volumeType: AudioVolumeType, volume: number): Promise\<void>; | 新增 | 27| ohos.multimedia.audio | AudioRoutingManager | selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;<br>selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise\<void>; | 新增 | 28| ohos.multimedia.audio | AudioRoutingManager | selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;<br>selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise\<void>; | 新增 | 29| ohos.multimedia.audio | AudioRoutingManager | off(type: 'deviceChange', callback?: Callback\<DeviceChangeAction>): void; | 新增 | 30| ohos.multimedia.audio | AudioRoutingManager | on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback\<DeviceChangeAction>): void; | 新增 | 31| ohos.multimedia.audio | AudioRoutingManager | getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void;<br>getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>; | 新增 | 32| ohos.multimedia.audio | AudioManager | getRoutingManager(callback: AsyncCallback\<AudioRoutingManager>): void;<br>getRoutingManager(): Promise\<AudioRoutingManager>; | 新增 | 33| ohos.multimedia.audio | AudioManager | getGroupManager(groupId: number, callback: AsyncCallback\<AudioGroupManager>): void;<br>getGroupManager(groupId: number): Promise\<AudioGroupManager>; | 新增 | 34| ohos.multimedia.audio | AudioManager | getVolumeGroups(networkId: string, callback: AsyncCallback\<VolumeGroupInfos>): void;<br>getVolumeGroups(networkId: string): Promise\<VolumeGroupInfos>; | 新增 | 35| ohos.multimedia.audio | AudioRendererFilter | rendererId?: number; | 新增 | 36| ohos.multimedia.audio | AudioRendererFilter | rendererInfo?: AudioRendererInfo; | 新增 | 37| ohos.multimedia.audio | AudioRendererFilter | uid: number; | 新增 | 38| ohos.multimedia.audio | DeviceType | DEFAULT = 1000 | 新增 | 39| ohos.multimedia.audio | DeviceFlag | ALL_DISTRIBUTED_DEVICES_FLAG = 12 | 新增 | 40| ohos.multimedia.audio | DeviceFlag | DISTRIBUTED_INPUT_DEVICES_FLAG = 8 | 新增 | 41| ohos.multimedia.audio | DeviceFlag | DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4 | 新增 | 42| ohos.multimedia.audio | DeviceFlag | NONE_DEVICES_FLAG = 0 | 新增 | 43| ohos.multimedia.audio | audio | const LOCAL_NETWORK_ID: string; | 新增 | 44| ohos.multimedia.image | PixelMapFormat | BGRA_8888 = 4 | 新增 | 45| ohos.multimedia.media | VideoPlayer | on(type: 'availableBitratesCollect', callback: (bitrates: Array\<number>) => void): void; | 新增 | 46| ohos.multimedia.media | VideoPlayer | on(type: 'availableBitratesCollected', callback: (bitrates: Array\<number>) => void): void | 删除 | 47| ohos.multimedia.mediaLibrary | DeviceType | TYPE_TV | 废弃 | 48| ohos.multimedia.mediaLibrary | DeviceType | TYPE_CAR | 废弃 | 49| ohos.multimedia.mediaLibrary | DeviceType | TYPE_WATCH | 废弃 | 50| ohos.multimedia.mediaLibrary | DeviceType | TYPE_TABLET | 废弃 | 51| ohos.multimedia.mediaLibrary | DeviceType | TYPE_PHONE | 废弃 | 52| ohos.multimedia.mediaLibrary | DeviceType | TYPE_LAPTOP | 废弃 | 53| ohos.multimedia.mediaLibrary | DeviceType | TYPE_UNKNOWN = 0 | 废弃 | 54| ohos.multimedia.mediaLibrary | PeerInfo | readonly isOnline: boolean; | 废弃 | 55| ohos.multimedia.mediaLibrary | PeerInfo | readonly deviceType: DeviceType; | 废弃 | 56| ohos.multimedia.mediaLibrary | PeerInfo | readonly networkId: string; | 废弃 | 57| ohos.multimedia.mediaLibrary | PeerInfo | readonly deviceName: string; | 废弃 | 58| ohos.multimedia.mediaLibrary | Size | height: number; | 废弃 | 59| ohos.multimedia.mediaLibrary | Size | width: number; | 废弃 | 60| ohos.multimedia.mediaLibrary | MediaLibrary | release(callback: AsyncCallback\<void>): void;<br>release(): Promise\<void>; | 废弃 | 61| ohos.multimedia.mediaLibrary | MediaLibrary | getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>getAllPeers(): Promise\<Array\<PeerInfo>>; | 废弃 | 62| ohos.multimedia.mediaLibrary | MediaLibrary | getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>getActivePeers(): Promise\<Array\<PeerInfo>>; | 废弃 | 63| ohos.multimedia.mediaLibrary | MediaLibrary | getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>getAlbums(options: MediaFetchOptions): Promise\<Array\<Album>>; | 废弃 | 64| ohos.multimedia.mediaLibrary | MediaLibrary | deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>deleteAsset(uri: string): Promise\<void>; | 废弃 | 65| ohos.multimedia.mediaLibrary | MediaLibrary | createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>; | 废弃 | 66| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 67| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 68| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 69| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 70| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 71| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 72| ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | 废弃 | 73| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 74| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 75| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 76| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 77| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 78| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 79| ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | 废弃 | 80| ohos.multimedia.mediaLibrary | MediaLibrary | getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult>; | 废弃 | 81| ohos.multimedia.mediaLibrary | MediaLibrary | getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>getPublicDirectory(type: DirectoryType): Promise\<string>; | 废弃 | 82| ohos.multimedia.mediaLibrary | DirectoryType | DIR_DOWNLOAD | 废弃 | 83| ohos.multimedia.mediaLibrary | DirectoryType | DIR_DOCUMENTS | 废弃 | 84| ohos.multimedia.mediaLibrary | DirectoryType | DIR_AUDIO | 废弃 | 85| ohos.multimedia.mediaLibrary | DirectoryType | DIR_IMAGE | 废弃 | 86| ohos.multimedia.mediaLibrary | DirectoryType | DIR_VIDEO | 废弃 | 87| ohos.multimedia.mediaLibrary | DirectoryType | DIR_CAMERA = 0 | 废弃 | 88| ohos.multimedia.mediaLibrary | Album | getFileAssets(callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult>; | 废弃 | 89| ohos.multimedia.mediaLibrary | Album | commitModify(callback: AsyncCallback\<void>): void;<br>commitModify(): Promise\<void>; | 废弃 | 90| ohos.multimedia.mediaLibrary | Album | readonly coverUri: string; | 废弃 | 91| ohos.multimedia.mediaLibrary | Album | readonly relativePath: string; | 废弃 | 92| ohos.multimedia.mediaLibrary | Album | readonly count: number; | 废弃 | 93| ohos.multimedia.mediaLibrary | Album | readonly dateModified: number; | 废弃 | 94| ohos.multimedia.mediaLibrary | Album | readonly albumUri: string; | 废弃 | 95| ohos.multimedia.mediaLibrary | Album | albumName: string; | 废弃 | 96| ohos.multimedia.mediaLibrary | Album | readonly albumId: number; | 废弃 | 97| ohos.multimedia.mediaLibrary | FetchFileResult | getAllObject(callback: AsyncCallback\<Array\<FileAsset>>): void;<br>getAllObject(): Promise\<Array\<FileAsset>>; | 废弃 | 98| ohos.multimedia.mediaLibrary | FetchFileResult | getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>getPositionObject(index: number): Promise\<FileAsset>; | 废弃 | 99| ohos.multimedia.mediaLibrary | FetchFileResult | getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>getLastObject(): Promise\<FileAsset>; | 废弃 | 100| ohos.multimedia.mediaLibrary | FetchFileResult | getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>getNextObject(): Promise\<FileAsset>; | 废弃 | 101| ohos.multimedia.mediaLibrary | FetchFileResult | getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>getFirstObject(): Promise\<FileAsset>; | 废弃 | 102| ohos.multimedia.mediaLibrary | FetchFileResult | close(): void; | 废弃 | 103| ohos.multimedia.mediaLibrary | FetchFileResult | isAfterLast(): boolean; | 废弃 | 104| ohos.multimedia.mediaLibrary | FetchFileResult | getCount(): number; | 废弃 | 105| ohos.multimedia.mediaLibrary | MediaFetchOptions | extendArgs?: string; | 废弃 | 106| ohos.multimedia.mediaLibrary | MediaFetchOptions | networkId?: string; | 废弃 | 107| ohos.multimedia.mediaLibrary | MediaFetchOptions | uri?: string; | 废弃 | 108| ohos.multimedia.mediaLibrary | MediaFetchOptions | order?: string; | 废弃 | 109| ohos.multimedia.mediaLibrary | MediaFetchOptions | selectionArgs: Array\<string>; | 废弃 | 110| ohos.multimedia.mediaLibrary | MediaFetchOptions | selections: string; | 废弃 | 111| ohos.multimedia.mediaLibrary | FileKey | ALBUM_NAME = "bucket_display_name" | 废弃 | 112| ohos.multimedia.mediaLibrary | FileKey | ALBUM_ID = "bucket_id" | 废弃 | 113| ohos.multimedia.mediaLibrary | FileKey | ORIENTATION = "orientation" | 废弃 | 114| ohos.multimedia.mediaLibrary | FileKey | HEIGHT = "height" | 废弃 | 115| ohos.multimedia.mediaLibrary | FileKey | WIDTH = "width" | 废弃 | 116| ohos.multimedia.mediaLibrary | FileKey | DURATION = "duration" | 废弃 | 117| ohos.multimedia.mediaLibrary | FileKey | AUDIOALBUM = "audio_album" | 废弃 | 118| ohos.multimedia.mediaLibrary | FileKey | ARTIST = "artist" | 废弃 | 119| ohos.multimedia.mediaLibrary | FileKey | TITLE = "title" | 废弃 | 120| ohos.multimedia.mediaLibrary | FileKey | DATE_TAKEN = "date_taken" | 废弃 | 121| ohos.multimedia.mediaLibrary | FileKey | DATE_MODIFIED = "date_modified" | 废弃 | 122| ohos.multimedia.mediaLibrary | FileKey | DATE_ADDED = "date_added" | 废弃 | 123| ohos.multimedia.mediaLibrary | FileKey | SIZE = "size" | 废弃 | 124| ohos.multimedia.mediaLibrary | FileKey | MEDIA_TYPE = "media_type" | 废弃 | 125| ohos.multimedia.mediaLibrary | FileKey | MIME_TYPE = "mime_type" | 废弃 | 126| ohos.multimedia.mediaLibrary | FileKey | PARENT = "parent" | 废弃 | 127| ohos.multimedia.mediaLibrary | FileKey | DISPLAY_NAME = "display_name" | 废弃 | 128| ohos.multimedia.mediaLibrary | FileKey | RELATIVE_PATH = "relative_path" | 废弃 | 129| ohos.multimedia.mediaLibrary | FileKey | ID = "file_id" | 废弃 | 130| ohos.multimedia.mediaLibrary | FileAsset | isTrash(callback: AsyncCallback\<boolean>): void;<br>isTrash():Promise\<boolean>; | 废弃 | 131| ohos.multimedia.mediaLibrary | FileAsset | trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>trash(isTrash: boolean): Promise\<void>; | 废弃 | 132| ohos.multimedia.mediaLibrary | FileAsset | isFavorite(callback: AsyncCallback\<boolean>): void;<br>isFavorite():Promise\<boolean>; | 废弃 | 133| ohos.multimedia.mediaLibrary | FileAsset | favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>favorite(isFavorite: boolean): Promise\<void>; | 废弃 | 134| ohos.multimedia.mediaLibrary | FileAsset | getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>getThumbnail(size?: Size): Promise\<image.PixelMap>; | 废弃 | 135| ohos.multimedia.mediaLibrary | FileAsset | close(fd: number, callback: AsyncCallback\<void>): void;<br>close(fd: number): Promise\<void>; | 废弃 | 136| ohos.multimedia.mediaLibrary | FileAsset | open(mode: string, callback: AsyncCallback\<number>): void;<br>open(mode: string): Promise\<number>; | 废弃 | 137| ohos.multimedia.mediaLibrary | FileAsset | commitModify(callback: AsyncCallback\<void>): void;<br>commitModify(): Promise\<void>; | 废弃 | 138| ohos.multimedia.mediaLibrary | FileAsset | isDirectory(callback: AsyncCallback\<boolean>): void;<br>isDirectory():Promise\<boolean>; | 废弃 | 139| ohos.multimedia.mediaLibrary | FileAsset | readonly albumName: string; | 废弃 | 140| ohos.multimedia.mediaLibrary | FileAsset | readonly albumUri: string; | 废弃 | 141| ohos.multimedia.mediaLibrary | FileAsset | readonly albumId: number; | 废弃 | 142| ohos.multimedia.mediaLibrary | FileAsset | readonly duration: number; | 废弃 | 143| ohos.multimedia.mediaLibrary | FileAsset | orientation: number; | 废弃 | 144| ohos.multimedia.mediaLibrary | FileAsset | readonly height: number; | 废弃 | 145| ohos.multimedia.mediaLibrary | FileAsset | readonly width: number; | 废弃 | 146| ohos.multimedia.mediaLibrary | FileAsset | readonly audioAlbum: string; | 废弃 | 147| ohos.multimedia.mediaLibrary | FileAsset | readonly artist: string; | 废弃 | 148| ohos.multimedia.mediaLibrary | FileAsset | readonly dateTaken: number; | 废弃 | 149| ohos.multimedia.mediaLibrary | FileAsset | readonly dateModified: number; | 废弃 | 150| ohos.multimedia.mediaLibrary | FileAsset | readonly dateAdded: number; | 废弃 | 151| ohos.multimedia.mediaLibrary | FileAsset | readonly size: number; | 废弃 | 152| ohos.multimedia.mediaLibrary | FileAsset | readonly parent: number; | 废弃 | 153| ohos.multimedia.mediaLibrary | FileAsset | relativePath: string; | 废弃 | 154| ohos.multimedia.mediaLibrary | FileAsset | title: string; | 废弃 | 155| ohos.multimedia.mediaLibrary | FileAsset | displayName: string; | 废弃 | 156| ohos.multimedia.mediaLibrary | FileAsset | readonly mediaType: MediaType; | 废弃 | 157| ohos.multimedia.mediaLibrary | FileAsset | readonly mimeType: string; | 废弃 | 158| ohos.multimedia.mediaLibrary | FileAsset | readonly uri: string; | 废弃 | 159| ohos.multimedia.mediaLibrary | FileAsset | readonly id: number; | 废弃 | 160| ohos.multimedia.mediaLibrary | MediaType | AUDIO | 废弃 | 161| ohos.multimedia.mediaLibrary | MediaType | VIDEO | 废弃 | 162| ohos.multimedia.mediaLibrary | MediaType | IMAGE | 废弃 | 163| ohos.multimedia.mediaLibrary | MediaType | FILE = 0 | 废弃 | 164| ohos.multimedia.mediaLibrary | mediaLibrary | getMediaLibrary(): MediaLibrary;<br>getMediaLibrary(context: Context): MediaLibrary; | 废弃 | 165 166