# 媒体子系统JS API变更 OpenHarmony 3.2 Beta3版本相较于OpenHarmony 3.2 Beta2版本,媒体子系统的API变更如下: ## 接口变更 | 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | |---|---|---|---| | ohos.multimedia.audio | VolumeEvent | networkId: string; | 新增 | | ohos.multimedia.audio | VolumeEvent | volumeGroupId: number; | 新增 | | ohos.multimedia.audio | AudioDeviceDescriptor | readonly volumeGroupId: number; | 新增 | | ohos.multimedia.audio | AudioDeviceDescriptor | readonly interruptGroupId: number; | 新增 | | ohos.multimedia.audio | AudioDeviceDescriptor | readonly networkId: string; | 新增 | | ohos.multimedia.audio | VolumeGroupInfo | readonly type: ConnectType; | 新增 | | ohos.multimedia.audio | VolumeGroupInfo | readonly groupName: string; | 新增 | | ohos.multimedia.audio | VolumeGroupInfo | readonly mappingId: number; | 新增 | | ohos.multimedia.audio | VolumeGroupInfo | readonly groupId: number; | 新增 | | ohos.multimedia.audio | VolumeGroupInfo | readonly networkId: string; | 新增 | | ohos.multimedia.audio | ConnectType | CONNECT_TYPE_DISTRIBUTED = 2 | 新增 | | ohos.multimedia.audio | ConnectType | CONNECT_TYPE_LOCAL = 1 | 新增 | | ohos.multimedia.audio | AudioGroupManager | isMute(volumeType: AudioVolumeType, callback: AsyncCallback\): void;
isMute(volumeType: AudioVolumeType): Promise\; | 新增 | | ohos.multimedia.audio | AudioGroupManager | mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void;
mute(volumeType: AudioVolumeType, mute: boolean): Promise\; | 新增 | | ohos.multimedia.audio | AudioGroupManager | getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\): void;
getMaxVolume(volumeType: AudioVolumeType): Promise\; | 新增 | | ohos.multimedia.audio | AudioGroupManager | getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\): void;
getMinVolume(volumeType: AudioVolumeType): Promise\; | 新增 | | ohos.multimedia.audio | AudioGroupManager | getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\): void;
getVolume(volumeType: AudioVolumeType): Promise\; | 新增 | | ohos.multimedia.audio | AudioGroupManager | setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\): void;
setVolume(volumeType: AudioVolumeType, volume: number): Promise\; | 新增 | | ohos.multimedia.audio | AudioRoutingManager | selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\): void;
selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise\; | 新增 | | ohos.multimedia.audio | AudioRoutingManager | selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\): void;
selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise\; | 新增 | | ohos.multimedia.audio | AudioRoutingManager | off(type: 'deviceChange', callback?: Callback\): void; | 新增 | | ohos.multimedia.audio | AudioRoutingManager | on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback\): void; | 新增 | | ohos.multimedia.audio | AudioRoutingManager | getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\): void;
getDevices(deviceFlag: DeviceFlag): Promise\; | 新增 | | ohos.multimedia.audio | AudioManager | getRoutingManager(callback: AsyncCallback\): void;
getRoutingManager(): Promise\; | 新增 | | ohos.multimedia.audio | AudioManager | getGroupManager(groupId: number, callback: AsyncCallback\): void;
getGroupManager(groupId: number): Promise\; | 新增 | | ohos.multimedia.audio | AudioManager | getVolumeGroups(networkId: string, callback: AsyncCallback\): void;
getVolumeGroups(networkId: string): Promise\; | 新增 | | ohos.multimedia.audio | AudioRendererFilter | rendererId?: number; | 新增 | | ohos.multimedia.audio | AudioRendererFilter | rendererInfo?: AudioRendererInfo; | 新增 | | ohos.multimedia.audio | AudioRendererFilter | uid: number; | 新增 | | ohos.multimedia.audio | DeviceType | DEFAULT = 1000 | 新增 | | ohos.multimedia.audio | DeviceFlag | ALL_DISTRIBUTED_DEVICES_FLAG = 12 | 新增 | | ohos.multimedia.audio | DeviceFlag | DISTRIBUTED_INPUT_DEVICES_FLAG = 8 | 新增 | | ohos.multimedia.audio | DeviceFlag | DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4 | 新增 | | ohos.multimedia.audio | DeviceFlag | NONE_DEVICES_FLAG = 0 | 新增 | | ohos.multimedia.audio | audio | const LOCAL_NETWORK_ID: string; | 新增 | | ohos.multimedia.image | PixelMapFormat | BGRA_8888 = 4 | 新增 | | ohos.multimedia.media | VideoPlayer | on(type: 'availableBitratesCollect', callback: (bitrates: Array\) => void): void; | 新增 | | ohos.multimedia.media | VideoPlayer | on(type: 'availableBitratesCollected', callback: (bitrates: Array\) => void): void | 删除 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_TV | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_CAR | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_WATCH | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_TABLET | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_PHONE | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_LAPTOP | 废弃 | | ohos.multimedia.mediaLibrary | DeviceType | TYPE_UNKNOWN = 0 | 废弃 | | ohos.multimedia.mediaLibrary | PeerInfo | readonly isOnline: boolean; | 废弃 | | ohos.multimedia.mediaLibrary | PeerInfo | readonly deviceType: DeviceType; | 废弃 | | ohos.multimedia.mediaLibrary | PeerInfo | readonly networkId: string; | 废弃 | | ohos.multimedia.mediaLibrary | PeerInfo | readonly deviceName: string; | 废弃 | | ohos.multimedia.mediaLibrary | Size | height: number; | 废弃 | | ohos.multimedia.mediaLibrary | Size | width: number; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | release(callback: AsyncCallback\): void;
release(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | getAllPeers(callback: AsyncCallback\>): void;
getAllPeers(): Promise\>; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | getActivePeers(callback: AsyncCallback\>): void;
getActivePeers(): Promise\>; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | getAlbums(options: MediaFetchOptions, callback: AsyncCallback\>): void;
getAlbums(options: MediaFetchOptions): Promise\>; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | deleteAsset(uri: string, callback: AsyncCallback\): void;
deleteAsset(uri: string): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\): void;
createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void;
getFileAssets(options: MediaFetchOptions): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | MediaLibrary | getPublicDirectory(type: DirectoryType, callback: AsyncCallback\): void;
getPublicDirectory(type: DirectoryType): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_DOWNLOAD | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_DOCUMENTS | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_AUDIO | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_IMAGE | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_VIDEO | 废弃 | | ohos.multimedia.mediaLibrary | DirectoryType | DIR_CAMERA = 0 | 废弃 | | ohos.multimedia.mediaLibrary | Album | getFileAssets(callback: AsyncCallback\): void;
getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void;
getFileAssets(options?: MediaFetchOptions): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | Album | commitModify(callback: AsyncCallback\): void;
commitModify(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly coverUri: string; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly relativePath: string; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly count: number; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly dateModified: number; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly albumUri: string; | 废弃 | | ohos.multimedia.mediaLibrary | Album | albumName: string; | 废弃 | | ohos.multimedia.mediaLibrary | Album | readonly albumId: number; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getAllObject(callback: AsyncCallback\>): void;
getAllObject(): Promise\>; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getPositionObject(index: number, callback: AsyncCallback\): void;
getPositionObject(index: number): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getLastObject(callback: AsyncCallback\): void;
getLastObject(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getNextObject(callback: AsyncCallback\): void;
getNextObject(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getFirstObject(callback: AsyncCallback\): void;
getFirstObject(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | close(): void; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | isAfterLast(): boolean; | 废弃 | | ohos.multimedia.mediaLibrary | FetchFileResult | getCount(): number; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | extendArgs?: string; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | networkId?: string; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | uri?: string; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | order?: string; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | selectionArgs: Array\; | 废弃 | | ohos.multimedia.mediaLibrary | MediaFetchOptions | selections: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | ALBUM_NAME = "bucket_display_name" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | ALBUM_ID = "bucket_id" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | ORIENTATION = "orientation" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | HEIGHT = "height" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | WIDTH = "width" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | DURATION = "duration" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | AUDIOALBUM = "audio_album" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | ARTIST = "artist" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | TITLE = "title" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | DATE_TAKEN = "date_taken" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | DATE_MODIFIED = "date_modified" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | DATE_ADDED = "date_added" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | SIZE = "size" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | MEDIA_TYPE = "media_type" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | MIME_TYPE = "mime_type" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | PARENT = "parent" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | DISPLAY_NAME = "display_name" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | RELATIVE_PATH = "relative_path" | 废弃 | | ohos.multimedia.mediaLibrary | FileKey | ID = "file_id" | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | isTrash(callback: AsyncCallback\): void;
isTrash():Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | trash(isTrash: boolean, callback: AsyncCallback\): void;
trash(isTrash: boolean): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | isFavorite(callback: AsyncCallback\): void;
isFavorite():Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | favorite(isFavorite: boolean, callback: AsyncCallback\): void;
favorite(isFavorite: boolean): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | getThumbnail(callback: AsyncCallback\): void;
getThumbnail(size: Size, callback: AsyncCallback\): void;
getThumbnail(size?: Size): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | close(fd: number, callback: AsyncCallback\): void;
close(fd: number): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | open(mode: string, callback: AsyncCallback\): void;
open(mode: string): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | commitModify(callback: AsyncCallback\): void;
commitModify(): Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | isDirectory(callback: AsyncCallback\): void;
isDirectory():Promise\; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly albumName: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly albumUri: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly albumId: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly duration: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | orientation: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly height: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly width: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly audioAlbum: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly artist: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly dateTaken: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly dateModified: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly dateAdded: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly size: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly parent: number; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | relativePath: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | title: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | displayName: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly mediaType: MediaType; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly mimeType: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly uri: string; | 废弃 | | ohos.multimedia.mediaLibrary | FileAsset | readonly id: number; | 废弃 | | ohos.multimedia.mediaLibrary | MediaType | AUDIO | 废弃 | | ohos.multimedia.mediaLibrary | MediaType | VIDEO | 废弃 | | ohos.multimedia.mediaLibrary | MediaType | IMAGE | 废弃 | | ohos.multimedia.mediaLibrary | MediaType | FILE = 0 | 废弃 | | ohos.multimedia.mediaLibrary | mediaLibrary | getMediaLibrary(): MediaLibrary;
getMediaLibrary(context: Context): MediaLibrary; | 废弃 |