diff --git a/api/@ohos.multimedia.avsession.d.ts b/api/@ohos.multimedia.avsession.d.ts index fcd35786e..0f398e121 100644 --- a/api/@ohos.multimedia.avsession.d.ts +++ b/api/@ohos.multimedia.avsession.d.ts @@ -24,6 +24,7 @@ import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; import { ElementName } from './bundleManager/ElementName'; import image from './@ohos.multimedia.image'; import audio from './@ohos.multimedia.audio'; +import { AVCastPickerState, AVCastPickerColorMode } from './@ohos.multimedia.avCastPickerParam' import type media from './@ohos.multimedia.media'; import type Context from './application/BaseContext'; @@ -3578,6 +3579,83 @@ declare namespace avSession { off(type: 'keyRequest', callback?: KeyRequestCallback): void; } + /** + * A helper to enable a picker to select output devices + * + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + class AVCastPickerHelper { + /** + * The constructor used to create a AVCastPickerHelper object. + * + * @param { Context } context - represents the context. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + constructor(context: Context); + + /** + * Pull up the avcastpicker based on the options. + * + * @param { AVCastPickerOptions } [options] - represents the options provided to the picker. + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + select(options?: AVCastPickerOptions): Promise; + + /** + * Register picker state change callback. + * @param { 'pickerStateChange' } type - 'pickerStateChange' + * @param { Callback } callback - The callback used to handle picker state changed event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + on(type: 'pickerStateChange', callback: Callback) : void; + + /** + * Unregister picker state change callback. + * @param { 'pickerStateChange' } type - 'pickerStateChange' + * @param { Callback } callback - The callback used to handle picker state changed event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + off(type: 'pickerStateChange', callback?: Callback) : void; + } + + /** + * An option to make different picker usage + * + * @typedef AVCastPickerOptions + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + interface AVCastPickerOptions { + /** + * Indicates current session type to show different picker ui. + * If not set, default value is 'audio'. + * + * @type { ? AVSessionType } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 14 + */ + sessionType?: AVSessionType; + } + /** * The callback of key request. *