From 09e098f34bed5a5a4593ba96bad2eddd3e8dae32 Mon Sep 17 00:00:00 2001 From: liyu233 Date: Tue, 7 Jan 2025 15:46:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=96=E5=8A=A8=E9=A2=84=E8=A7=88&SEI?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyu233 --- api/@ohos.multimedia.media.d.ts | 103 +++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 4a9c775119..d4d417edf7 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -1491,6 +1491,13 @@ declare namespace media { * @since 14 */ AVERR_IO_UNSUPPORTED_REQUEST = 5411011, + /** + * Seek continuous unsupported. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 16 + */ + AVERR_SEEK_CONTINUOUS_UNSUPPORTED = 5410002, } /** @@ -1568,6 +1575,46 @@ declare namespace media { */ type OnVideoSizeChangeHandler = (width: number, height: number) => void; + /** + * SEI message. + * + * @typedef SeiMessage + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 16 + */ + interface SeiMessage { + /** + * Payload type of SEI message. + * @type { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 16 + */ + payloadType: number; + + /** + * Payload data of SEI message. + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 16 + */ + payload: ArrayBuffer; + } + + /** + * Defines the OnSeiMessageHandle callback. + * + * @typedef { function } OnSeiMessageHandle + * @param { Array } messages - SEI messages. + * @param { ?number } playbackPosition - playback position. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 16 + */ + type OnSeiMessageHandle = (messages: Array, playbackPosition?: number) => void; + /** * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer() * to create an AVPlayer instance. @@ -2140,6 +2187,27 @@ declare namespace media { */ setPlaybackRange(startTimeMs: number, endTimeMs: number, mode?: SeekMode) : Promise; + /** + * Get current playback position. + * @returns { number } return the time of current playback position - millisecond(ms) + * @throws { BusinessError } 5400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 16 + */ + getPlaybackPosition() : number; + + /** + * Check whether the media stream currently being played by the player supports seek continuous. + * Should be called after {@link #prepare}. + * @returns { boolean } true: seek continuous is supported; + * false: seek continuous is not supported or the support status is uncertain. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 16 + */ + isSeekContinuousSupported() : boolean; + /** * Media URI. Mainstream media formats are supported. * Network:http://xxx @@ -3207,6 +3275,32 @@ declare namespace media { * @since 13 */ off(type: 'amplitudeUpdate', callback?: Callback>): void + + /** + * Subscribes listener for video SEI message event, only for live video streaming. + * Call before the {@link #prepare}, repeated invocation overwrites the last subscribed callback and payload types. + * + * @param { 'seiMessageReceived' } type - Type of the playback event to listen for. + * @param { Array } payloadTypes - The subscribed payload types of the SEI message. + * @param { OnSeiMessageHandle } callback - Callback to listen SEI message event with subscribed payload types. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 16 + */ + on(type: 'seiMessageReceived', payloadTypes: Array, callback: OnSeiMessageHandle): void; + + /** + * Unsubscribes listener for video SEI message event. + * @param { 'seiMessageReceived' } type - Type of the playback event to listen for. + * @param { Array } payloadTypes - The payload types of the SEI message. + * Null means unsubscribe all payload types. + + * @param { OnSeiMessageHandle } callback - Callback to listen SEI message event with subscribed payload types. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 16 + */ + off(type: 'seiMessageReceived', payloadTypes?: Array, callback?: OnSeiMessageHandle): void; } /** @@ -7335,9 +7429,14 @@ declare namespace media { SEEK_CLOSEST = 2, /** * Seek in continuous mode. + * Seek continuous can provide a smoother dragging experience, but the device needs to support + * the current stream to execute seek continuous. Before calling seek continuous, + * check whether it is supported, see {@link #isSeekContinuousSupported}. + * If an unsupported scenario occurs, seek continuous will report an error({@link #AVERR_SEEK_CONTINUOUS_UNSUPPORTED}) + * through the on error callback. * @syscap SystemCapability.Multimedia.Media.Core - * @systemapi - * @since 13 + * @atomicservice + * @since 16 */ SEEK_CONTINUOUS = 3, } -- Gitee