diff --git a/api/multimedia/systemTonePlayer.d.ts b/api/multimedia/systemTonePlayer.d.ts index 0694ab387695b565491d9b80ccae7a8c571c1dbd..35df3813a07aa2e25c7e03f1b773405c2817b257 100644 --- a/api/multimedia/systemTonePlayer.d.ts +++ b/api/multimedia/systemTonePlayer.d.ts @@ -19,7 +19,7 @@ */ import type systemSoundManager from '../@ohos.multimedia.systemSoundManager'; - +import { ErrorCallback, Callback } from '../@ohos.base'; /** * System tone player object. * @typedef SystemTonePlayer @@ -155,6 +155,68 @@ export interface SystemTonePlayer { * @since 11 */ release(): Promise; + + /** + * Subscribes the play finished events. + * @param { 'playFinished' } type - Type of the event to listen for. + * @param { number } streamId - Stream id, received from start(). + * @param { Callback } callback - Callback used to obtain the finished event. The callback info is the stream + * id that is finished. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 20700002 -Parameter check error. + * @syscap SystemCapability.Multimedia.SystemSound.Core + * @systemapi + * @since 16 + */ + on(type: 'playFinished', streamId: number, callback: Callback): void; + + /** + * Unsubscribes the play finished events. + * @param { 'playFinished' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to obtain the finished event. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 20700002 -Parameter check error. + * @syscap SystemCapability.Multimedia.SystemSound.Core + * @systemapi + * @since 16 + */ + off(type: 'playFinished', callback?: Callback): void; + + /** + * Subscribes the error events. + * @param { 'error'} type - Type of the event to listen for. + * @param { ErrorCallback } callback - Error callback while receiving the error event. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 20700002 -Parameter check error. + * @syscap SystemCapability.Multimedia.SystemSound.Core + * @systemapi + * @since 16 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unsubscribes the error events. + * @param { 'error'} type - Type of the event to listen for. + * @param { ErrorCallback } callback - Error callback while receiving the error event. + * @throws { BusinessError } 202 - Not system App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 20700002 -Parameter check error. + * @syscap SystemCapability.Multimedia.SystemSound.Core + * @systemapi + * @since 16 + */ + off(type: 'error', callback?: ErrorCallback): void } /**