媒体子系统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<boolean>): void;
isMute(volumeType: AudioVolumeType): Promise<boolean>;
新增
ohos.multimedia.audio AudioGroupManager mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void;
mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>;
新增
ohos.multimedia.audio AudioGroupManager getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void;
getMaxVolume(volumeType: AudioVolumeType): Promise<number>;
新增
ohos.multimedia.audio AudioGroupManager getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void;
getMinVolume(volumeType: AudioVolumeType): Promise<number>;
新增
ohos.multimedia.audio AudioGroupManager getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void;
getVolume(volumeType: AudioVolumeType): Promise<number>;
新增
ohos.multimedia.audio AudioGroupManager setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void;
setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>;
新增
ohos.multimedia.audio AudioRoutingManager selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void;
selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise<void>;
新增
ohos.multimedia.audio AudioRoutingManager selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void;
selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise<void>;
新增
ohos.multimedia.audio AudioRoutingManager off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void; 新增
ohos.multimedia.audio AudioRoutingManager on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback<DeviceChangeAction>): void; 新增
ohos.multimedia.audio AudioRoutingManager getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void;
getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>;
新增
ohos.multimedia.audio AudioManager getRoutingManager(callback: AsyncCallback<AudioRoutingManager>): void;
getRoutingManager(): Promise<AudioRoutingManager>;
新增
ohos.multimedia.audio AudioManager getGroupManager(groupId: number, callback: AsyncCallback<AudioGroupManager>): void;
getGroupManager(groupId: number): Promise<AudioGroupManager>;
新增
ohos.multimedia.audio AudioManager getVolumeGroups(networkId: string, callback: AsyncCallback<VolumeGroupInfos>): void;
getVolumeGroups(networkId: string): Promise<VolumeGroupInfos>;
新增
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<number>) => void): void; 新增
ohos.multimedia.media VideoPlayer on(type: 'availableBitratesCollected', callback: (bitrates: Array<number>) => 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>): void;
release(): Promise<void>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary getAllPeers(callback: AsyncCallback<Array<PeerInfo>>): void;
getAllPeers(): Promise<Array<PeerInfo>>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary getActivePeers(callback: AsyncCallback<Array<PeerInfo>>): void;
getActivePeers(): Promise<Array<PeerInfo>>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary getAlbums(options: MediaFetchOptions, callback: AsyncCallback<Array<Album>>): void;
getAlbums(options: MediaFetchOptions): Promise<Array<Album>>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary deleteAsset(uri: string, callback: AsyncCallback<void>): void;
deleteAsset(uri: string): Promise<void>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback<FileAsset>): void;
createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise<FileAsset>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback<void>): void; 废弃
ohos.multimedia.mediaLibrary MediaLibrary getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void;
getFileAssets(options: MediaFetchOptions): Promise<FetchFileResult>;
废弃
ohos.multimedia.mediaLibrary MediaLibrary getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>): void;
getPublicDirectory(type: DirectoryType): Promise<string>;
废弃
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<FetchFileResult>): void;
getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileResult>): void;
getFileAssets(options?: MediaFetchOptions): Promise<FetchFileResult>;
废弃
ohos.multimedia.mediaLibrary Album commitModify(callback: AsyncCallback<void>): void;
commitModify(): Promise<void>;
废弃
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<Array<FileAsset>>): void;
getAllObject(): Promise<Array<FileAsset>>;
废弃
ohos.multimedia.mediaLibrary FetchFileResult getPositionObject(index: number, callback: AsyncCallback<FileAsset>): void;
getPositionObject(index: number): Promise<FileAsset>;
废弃
ohos.multimedia.mediaLibrary FetchFileResult getLastObject(callback: AsyncCallback<FileAsset>): void;
getLastObject(): Promise<FileAsset>;
废弃
ohos.multimedia.mediaLibrary FetchFileResult getNextObject(callback: AsyncCallback<FileAsset>): void;
getNextObject(): Promise<FileAsset>;
废弃
ohos.multimedia.mediaLibrary FetchFileResult getFirstObject(callback: AsyncCallback<FileAsset>): void;
getFirstObject(): Promise<FileAsset>;
废弃
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<string>; 废弃
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<boolean>): void;
isTrash():Promise<boolean>;
废弃
ohos.multimedia.mediaLibrary FileAsset trash(isTrash: boolean, callback: AsyncCallback<void>): void;
trash(isTrash: boolean): Promise<void>;
废弃
ohos.multimedia.mediaLibrary FileAsset isFavorite(callback: AsyncCallback<boolean>): void;
isFavorite():Promise<boolean>;
废弃
ohos.multimedia.mediaLibrary FileAsset favorite(isFavorite: boolean, callback: AsyncCallback<void>): void;
favorite(isFavorite: boolean): Promise<void>;
废弃
ohos.multimedia.mediaLibrary FileAsset getThumbnail(callback: AsyncCallback<image.PixelMap>): void;
getThumbnail(size: Size, callback: AsyncCallback<image.PixelMap>): void;
getThumbnail(size?: Size): Promise<image.PixelMap>;
废弃
ohos.multimedia.mediaLibrary FileAsset close(fd: number, callback: AsyncCallback<void>): void;
close(fd: number): Promise<void>;
废弃
ohos.multimedia.mediaLibrary FileAsset open(mode: string, callback: AsyncCallback<number>): void;
open(mode: string): Promise<number>;
废弃
ohos.multimedia.mediaLibrary FileAsset commitModify(callback: AsyncCallback<void>): void;
commitModify(): Promise<void>;
废弃
ohos.multimedia.mediaLibrary FileAsset isDirectory(callback: AsyncCallback<boolean>): void;
isDirectory():Promise<boolean>;
废弃
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;
废弃