diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index a9af1931dfb8cc5c09c483b7ab650daf7c712945..07f30cc664c83c424b3bff0318fc6ba9bc883869 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -269,6 +269,48 @@ declare namespace media { */ getTrackDescription() : Promise>; + /** + * Select a media track to be played. Only the most recent one will be effective if this + * function called multiple times on same type of track. There is a audio track selected + * by defaut, even though this function is not called. + * @since NA + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @param index the index of the track to be selected. The total number of the tracks is + * the length of the {@link #getTrackDescription}'s return result array. + * @param callback async callback return the selection result, refer to {@link MediaErrorCode} + */ + selectTrack(index: number, callback: AsyncCallback): void; + + /** + * Select a media track to be played. Only the most recent one will be effective if this + * function called multiple times on same type of track. There is a audio track selected + * by defaut, even though this function is not called. + * @since NA + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @param index the index of the track to be selected. The total number of the tracks is + * the length of the {@link #getTrackDescription}'s return result array. + * @return a promise to report the selection result, refer to {@link MediaErrorCode} + */ + selectTrack(index: number): Promise; + + /** + * Get the index of tracks currently selected. For each type track, one track index will + * be returned. + * @since NA + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @return a promise to return the indexes of currently selected tracks. + */ + getSelectedTracks(): Promise>; + + /** + * Get the index of tracks currently selected. For each type track, one track index will + * be returned. + * @since NA + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @param callback async callback return the the indexes of currently selected tracks. + */ + getSelectedTracks(callback: AsyncCallback>): void + /** * Listens for audio playback buffering events. * @since 8 @@ -314,6 +356,15 @@ declare namespace media { */ readonly state: AudioState; + /** + * the network stream playback's cache limit. Defautly, the player will decide cache limit by + * itself, set it to change the limit by yourself. For local file's playback, write this variable + * is no effect and get this variable will always return a object with that all property is -1. + * @since NA + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + */ + cacheLimit ?: PlaybackCacheLimit; + /** * Listens for audio playback events. * @since 6 @@ -973,6 +1024,48 @@ declare namespace media { */ getTrackDescription() : Promise>; + /** + * Select a media track to be played. Only the most recent one will be effective if this + * function called multiple times on same type of track. There are a video and audio track + * selected by defaut, even though this function is not called. + * @since NA + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @param index the index of the track to be selected. The total number of the tracks is + * the length of the {@link #getTrackDescription}'s return result array. + * @param callback async callback return the selection result, refer to {@link MediaErrorCode} + */ + selectTrack(index: number, callback: AsyncCallback): void; + + /** + * Select a media track to be played. Only the most recent one will be effective if this + * function called multiple times on same type of track. There are a video and audio track + * selected by defaut, even though this function is not called. + * @since NA + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @param index the index of the track to be selected. The total number of the tracks is + * the length of the {@link #getTrackDescription}'s return result array. + * @return a promise to report the selection result, refer to {@link MediaErrorCode} + */ + selectTrack(index: number): Promise; + + /** + * Get the index of tracks currently selected. For each type track, one track index will + * be returned. + * @since NA + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @return a promise to return the indexes of currently selected tracks. + */ + getSelectedTracks(): Promise>; + + /** + * Get the index of tracks currently selected. For each type track, one track index will + * be returned. + * @since NA + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @param callback async callback return the the indexes of currently selected tracks. + */ + getSelectedTracks(callback: AsyncCallback>): void + /** * media url. Mainstream video formats are supported. * local:fd://XXX, file://XXX. network:http://xxx @@ -1023,6 +1116,15 @@ declare namespace media { */ readonly height: number; + /** + * the network stream playback's cache limit. Defautly, the player will decide cache limit by + * itself, set it to change the limit by yourself. For local file's playback, write this variable + * is no effect and get this variable will always return a object with that all property is -1. + * @since NA + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ + cacheLimit ?: PlaybackCacheLimit; + /** * set payback speed. * @since 8 @@ -1086,6 +1188,29 @@ declare namespace media { on(type: 'error', callback: ErrorCallback): void; } + /** + * The network stream playback's cache limit. + * @since NA + * @syscap SystemCapability.Multimedia.Media.Core + */ + interface PlaybackCacheLimit { + /** + * The value indicates how much data need to be cached in memory expressed in milliseconds + * before starting playback. + * @since NA + * @syscap SystemCapability.Multimedia.Media.Core + */ + durationUpperLimit?: number; + + /** + * The value indicates how much data need to be cached in memory expressed in bytes before + * starting playback. + * @since NA + * @syscap SystemCapability.Multimedia.Media.Core + */ + sizeUpperLimit?: number; + } + /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8