diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index f9a6af9e1de4ac19c1623914fcd7e6a62c41a3fd..7b8496a76bdbc1842b1eaca55f8d1e7199b31d66 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -210,6 +210,9 @@ - [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md) - [@ohos.multimedia.image (Image Processing)](js-apis-image.md) - [@ohos.multimedia.media (Media)](js-apis-media.md) + - [@ohos.multimedia.systemSoundManager (System Sound Management)](js-apis-systemSoundManager.md) + - multimedia + - [ringtonePlayer (Ringtone Player)](js-apis-inner-multimedia-ringtonePlayer.md) - Resource Manager - [@ohos.i18n (Internationalization)](js-apis-i18n.md) @@ -319,6 +322,7 @@ - [@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)](js-apis-inputmethod-extension-ability.md) - [@ohos.InputMethodExtensionContext (InputMethodExtensionContext)](js-apis-inputmethod-extension-context.md) - [@ohos.InputMethodSubtype (Input Method Subtype)](js-apis-inputmethod-subtype.md) + - [@ohos.logLibrary (Log Library)](js-apis-loglibrary.md) - [@ohos.pasteboard (Pasteboard)](js-apis-pasteboard.md) - [@ohos.screenLock (Screenlock)](js-apis-screen-lock.md) - [@ohos.systemDateTime (System Time and Time Zone)](js-apis-system-date-time.md) diff --git a/en/application-dev/reference/apis/js-apis-inner-multimedia-ringtonePlayer.md b/en/application-dev/reference/apis/js-apis-inner-multimedia-ringtonePlayer.md new file mode 100644 index 0000000000000000000000000000000000000000..66aa7fbf4972c578b1dd544c18618defed8dedeb --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-multimedia-ringtonePlayer.md @@ -0,0 +1,471 @@ +# ringtonePlayer (Ringtone Player) + +The **ringtonePlayer** module provides APIs for playing, configuring, and obtaining system ringtones. + +This module must work with [@ohos.multimedia.systemSoundManager](js-apis-systemSoundManager.md) to manage system ringtones. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + +## Modules to Import + +```js +import systemSoundManager from '@ohos.multimedia.systemSoundManager'; +``` + +## RingtoneOptions + +Enumerates the ringtone parameters. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +| Name | Type |Mandatory | Description | +| --------- | -------------- | ---- | --------------------------------- | +| volume | number | Yes | Relative volume. The value ranges from 0.00 to 1.00. The value **1.00** indicates the maximum volume (100%).| +| loop | boolean | Yes | Whether to enable loop playback. The value **true** means to enable loop playback, and **false** means the opposite.| + +## RingtonePlayer + +Provides APIs for setting and obtaining system ringtone parameters as well as playing and stopping system ringtones. Before calling any API in **RingtonePlayer**, you must use [getSystemRingtonePlayer](js-apis-systemSoundManager.md#getsystemringtoneplayer) to create a **RingtonePlayer** instance. + +### Attributes + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +| Name | Type | Readable| Writable| Description | +| ----- | -------------------------- | ---- | ---- | ------------------ | +| state | [media.AVPlayerState](js-apis-media.md#avplayerstate9) | Yes | No | Audio renderer state.| + +**Example** + +```js +let state = systemRingtonePlayer.state; +``` + +### getTitle + +getTitle(callback: AsyncCallback<string>): void + +Obtains the title of a system ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| callback | AsyncCallback<string> | Yes | Callback used to return the ringtone title obtained. | + +**Example** + +```js +systemRingtonePlayer.getTitle((err, value) => { + if (err) { + console.error(`Failed to get system ringtone title. ${err}`); + return; + } + console.info(`Callback invoked to indicate the value of the system ringtone title is obtained ${value}.`); +}); +``` + +### getTitle + +getTitle(): Promise<string> + +Obtains the title of a system ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| --------------------- | -------------------------------- | +| Promise<string> | Promise used to return the ringtone title obtained.| + +**Example** + +```js +systemRingtonePlayer.getTitle().then((value) => { + console.info(`Promise returned to indicate that the value of the system ringtone title is obtained ${value}.`); +}).catch ((err) => { + console.error(`Failed to get the system ringtone title ${err}`); +}); +``` + +### getAudioRendererInfo + +getAudioRendererInfo(callback: AsyncCallback<audio.AudioRendererInfo>): void + +Obtains the information about the audio renderer used by the ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| callback | AsyncCallback<[audio.AudioRendererInfo](js-apis-audio.md#audiorendererinfo8)> | Yes| Callback used to return the audio renderer information obtained.| + +**Example** + +```js +import audio from '@ohos.multimedia.audio'; + +let audioRendererInfo: audio.AudioRendererInfo = null; + +systemRingtonePlayer.getAudioRendererInfo((err, value) => { + if (err) { + console.error(`Failed to get ringtone AudioRendererInfo. ${err}`); + return; + } + console.info(`Callback invoked to indicate the value of the ringtone AudioRendererInfo is obtained.`); + audioRendererInfo = value; +}); +``` + +### getAudioRendererInfo + +getAudioRendererInfo(): Promise<audio.AudioRendererInfo> + +Obtains the information about the audio renderer used by the ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------- | +| Promise<[audio.AudioRendererInfo](js-apis-audio.md#audiorendererinfo8)> | Promise used to return the audio renderer information obtained.| + +**Example** + +```js +import audio from '@ohos.multimedia.audio'; + +let audioRendererInfo: audio.AudioRendererInfo = null; + +systemRingtonePlayer.getAudioRendererInfo().then((value) => { + console.info(`Promise returned to indicate that the value of the ringtone AudioRendererInfo is obtained ${value}.`); + audioRendererInfo = value; +}).catch ((err) => { + console.error(`Failed to get the ringtone AudioRendererInfo ${err}`); +}); +``` + +### configure + +configure(options: RingtoneOptions, callback: AsyncCallback<void>): void + +Sets ringtone parameters. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| options | [RingtoneOptions](#ringtoneoptions) | Yes | Ringtone parameters. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Example** + +```js +let ringtoneOptions = {volume: 0.5, loop: true}; + +systemRingtonePlayer.configure(ringtoneOptions, (err) => { + if (err) { + console.error(`Failed to configure ringtone options. ${err}`); + return; + } + console.info(`Callback invoked to indicate a successful setting of ringtone options.`); +}); +``` + +### configure + +configure(options: RingtoneOptions): Promise<void> + +Sets ringtone parameters. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| options | [RingtoneOptions](#ringtoneoptions) | Yes | Ringtone parameters. | + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------- | +| Promise<void> | Promise used to return the result.| + +**Example** + +```js +let ringtoneOptions = {volume: 0.5, loop: true}; + +systemRingtonePlayer.configure(ringtoneOptions).then(() => { + console.info(`Promise returned to indicate a successful setting of ringtone options.`); +}).catch ((err) => { + console.error(`Failed to configure ringtone options. ${err}`); +}); +``` + +### start + +start(callback: AsyncCallback<void>): void + +Starts playing the ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Example** + +```js +systemRingtonePlayer.start((err) => { + if (err) { + console.error(`Failed to start playing ringtone. ${err}`); + return; + } + console.info(`Callback invoked to indicate a successful starting of ringtone.`); +}); +``` + +### start + +start(): Promise<void> + +Starts playing the ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| ------------------- | -------------------------------- | +| Promise<void> | Promise used to return the result.| + +**Example** + +```js +systemRingtonePlayer.start().then(() => { + console.info(`Promise returned to indicate a successful starting of ringtone.`); +}).catch ((err) => { + console.error(`Failed to start playing ringtone. ${err}`); +}); +``` + +### stop + +stop(callback: AsyncCallback<void>): void + +Stops playing the ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Example** + +```js +systemRingtonePlayer.stop((err) => { + if (err) { + console.error(`Failed to stop playing ringtone. ${err}`); + return; + } + console.info(`Callback invoked to indicate a successful stopping of ringtone.`); +}); +``` + +### stop + +stop(): Promise<void> + +Stops playing the ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| ------------------- | -------------------------------- | +| Promise<void> | Promise used to return the result.| + +**Example** + +```js +systemRingtonePlayer.stop().then(() => { + console.info(`Promise returned to indicate a successful stopping of ringtone.`); +}).catch ((err) => { + console.error(`Failed to stop playing ringtone. ${err}`); +}); +``` + +### release + +release(callback: AsyncCallback<void>): void + +Releases the ringtone player. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | ------------------------- | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Example** + +```js +systemRingtonePlayer.release((err) => { + if (err) { + console.error(`Failed to release ringtone player. ${err}`); + return; + } + console.info(`Callback invoked to indicate a successful releasing of ringtone player.`); +}); +``` + +### release + +release(): Promise<void> + +Releases the ringtone player. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------- | +| Promise<void> | Promise used to return the result. | + +**Example** + +```js +systemRingtonePlayer.release().then(() => { + console.info(`Promise returned to indicate a successful releasing of ringtone player.`); +}).catch ((err) => { + console.error(`Failed to release ringtone player. ${err}`); +}); +``` + +### on('audioInterrupt') + +on(type: 'audioInterrupt', callback: Callback<audio.InterruptEvent>): void + +Subscribes to audio interruption events. This API uses a callback to obtain interrupt events. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | -------------------------------------------------------------------------- | +| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio rendering is interrupted.| +| callback | Callback<[audio.InterruptEvent](js-apis-audio.md#interruptevent9)> | Yes | Callback used to return the audio interruption event. | + +**Error codes** + +For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). + +| ID| Error Message| +| ------- | --------------------------------------------| +| 401 | if input parameter type or number mismatch | +| 6800101 | if input parameter value error | + +**Example** + +```js +import audio from '@ohos.multimedia.audio'; + +let isPlaying; // An identifier specifying whether rendering is in progress. +let isDucked; // An identifier specifying whether the audio volume is reduced. + +systemRingtonePlayer.on('audioInterrupt', async(interruptEvent) => { +if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + // The system forcibly interrupts audio rendering. The application must update the status and displayed content accordingly. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // The audio stream has been paused and temporarily loses the focus. It will receive the interruptEvent corresponding to resume when it is able to regain the focus. + console.info('Force paused. Update playing status and stop writing'); + isPlaying = false; // A simplified processing indicating several operations for switching the application to the paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // The audio stream has been stopped and permanently loses the focus. The user must manually trigger the operation to resume rendering. + console.info('Force stopped. Update playing status and stop writing'); + isPlaying = false; // A simplified processing indicating several operations for switching the application to the paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // The audio stream is rendered at a reduced volume. + console.info('Force ducked. Update volume status'); + isDucked = true; // A simplified processing indicating several operations for updating the volume status. + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // The audio stream is rendered at the normal volume. + console.info('Force ducked. Update volume status'); + isDucked = false; // A simplified processing indicating several operations for updating the volume status. + break; + default: + break; + } +} else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + // The application can choose to take action or ignore. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // It is recommended that the application continue rendering. (The audio stream has been forcibly paused and temporarily lost the focus. It can resume rendering now.) + console.info('Resume force paused renderer or ignore'); + // To continue rendering, the application must perform the required operations. + break; + default: + break; + } +} +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-systemSoundManager.md b/en/application-dev/reference/apis/js-apis-systemSoundManager.md new file mode 100644 index 0000000000000000000000000000000000000000..3689684d5d4d547c4ca5b5e8c60f94d7c80cc833 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-systemSoundManager.md @@ -0,0 +1,268 @@ +# @ohos.multimedia.systemSoundManager (System Sound Management) + +The **systemSoundManager** module provides basic capabilities for managing system sounds, including setting and obtaining system ringtones and obtaining a player to play the system ringtone. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + +## Modules to Import + +```js +import systemSoundManager from '@ohos.multimedia.systemSoundManager'; +``` + +## RingtoneType + +Enumerates the ringtone types. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +| Name | Value | Description | +| ------------------------------- | ------ | -------------------------------------------- | +| RINGTONE_TYPE_DEFAULT | 0 | Default ringtone type. | +| RINGTONE_TYPE_MULTISIM | 1 | Multi-SIM ringtone type. | + +## systemSoundManager.getSystemSoundManager + +getSystemSoundManager(): SystemSoundManager + +Obtains a system sound manager. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Return value** + +| Type | Description | +| ----------------------------- | ------------ | +| [SystemSoundManager](#systemsoundmanager) | System sound manager obtained.| + +**Example** +```js +let systemSoundManagerInstance = systemSoundManager.getSystemSoundManager(); +``` + +## SystemSoundManager + +Provides APIs to manage system sounds. Before calling any API in **SystemSoundManager**, you must use [getSystemSoundManager](#systemsoundmanagergetsystemsoundmanager) to create a **SystemSoundManager** instance. + +### setSystemRingtoneUri + +setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType, callback: AsyncCallback<void>): void + +Sets a URI for the system ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| context | Context | Yes | Application context. | +| uri | string | Yes | URI of the system ringtone. For details, see [media.AVPlayer](js-apis-media.md#avplayer9).| +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Example** + +```js +let context = this.context; +let uri = 'file://data/test.wav'; // Set the URI of the target ringtone file. +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; + +systemSoundManagerInstance.setSystemRingtoneUri(context, uri, type, (err) => { + if (err) { + console.error(`Failed to set system ringtone uri. ${err}`); + return; + } + console.info(`Callback invoked to indicate a successful setting of the system ringtone uri.`); +}); +``` + +### setSystemRingtoneUri + +setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType): Promise<void> + +Sets a URI for the system ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| context | Context | Yes | Application context. | +| uri | string | Yes | URI of the system ringtone. For details, see [media.AVPlayer](js-apis-media.md#avplayer9).| +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone. | + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------- | +| Promise<void> | Promise used to return the result. | + +**Example** + +```js +let context = this.context; +let uri = 'file://data/test.wav'; // Set the URI of the target ringtone file. +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; + +systemSoundManagerInstance.setSystemRingtoneUri(context, uri, type).then(() => { + console.info(`Promise returned to indicate a successful setting of the system ringtone uri.`); +}).catch ((err) => { + console.error(`Failed to set the system ringtone uri ${err}`); +}); +``` + +### getSystemRingtoneUri + +getSystemRingtoneUri(context: Context, type: RingtoneType, callback: AsyncCallback<string>): void + +Obtains the URI of a system ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| context | Context | Yes | Application context. | +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone. | +| callback | AsyncCallback<string> | Yes | Callback used to return the ringtone URI obtained.| + +**Example** + +```js +let context = this.context; +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; + +systemSoundManagerInstance.getSystemRingtoneUri(context, type, (err, value) => { + if (err) { + console.error(`Failed to get system ringtone uri. ${err}`); + return; + } + console.info(`Callback invoked to indicate the value of the system ringtone uri is obtained ${value}.`); +}); +``` + +### getSystemRingtoneUri + +getSystemRingtoneUri(context: Context, type: RingtoneType): Promise<string> + +Obtains the URI of a system ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| context | Context | Yes | Application context. | +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone. | + +**Return value** + +| Type | Description | +| ------------------- | ---------------------------------- | +| Promise<string> | Promise used to return the ringtone URI obtained.| + +**Example** + +```js +let context = this.context; +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; + +systemSoundManagerInstance.getSystemRingtoneUri(context, type).then((value) => { + console.info(`Promise returned to indicate that the value of the system ringtone uri is obtained ${value}.`); +}).catch ((err) => { + console.error(`Failed to get the system ringtone uri ${err}`); +}); +``` + +### getSystemRingtonePlayer + +getSystemRingtonePlayer(context: Context, type: RingtoneType, callback: AsyncCallback<RingtonePlayer>): void + +Obtains a player to play the system ringtone. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | --------------------------- | +| context | Context | Yes | Application context. | +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone.| +| callback | AsyncCallback<[RingtonePlayer](js-apis-inner-multimedia-ringtonePlayer.md#ringtoneplayer)> | Yes| Callback used to return the ringtone player obtained.| + +**Example** + +```js +let context = this.context; +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; +let systemRingtonePlayer = null; + +systemSoundManagerInstance.getSystemRingtonePlayer(context, type, (err, value) => { + if (err) { + console.error(`Failed to get system ringtone player. ${err}`); + return; + } + console.info(`Callback invoked to indicate the value of the system ringtone player is obtained.`); + systemRingtonePlayer = value; +}); +``` + +### getSystemRingtonePlayer + +getSystemRingtonePlayer(context: Context, type: RingtoneType): Promise<RingtonePlayer> + +Obtains a player to play the system ringtone. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Multimedia.SystemSound.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -----------------------------------------| ---- | --------------------------- | +| context | Context | Yes | Application context. | +| type | [RingtoneType](#ringtonetype) | Yes | Type of the system ringtone.| + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------- | +| Promise<[RingtonePlayer](js-apis-inner-multimedia-ringtonePlayer.md#ringtoneplayer)> | Promise used to return the ringtone player obtained.| + +**Example** + +```js +let context = this.context; +let type = systemSoundManager.RingtoneType.RINGTONE_TYPE_DEFAULT; +let systemRingtonePlayer = null; + +systemSoundManagerInstance.getSystemRingtonePlayer(context, type).then((value) => { + console.info(`Promise returned to indicate that the value of the system ringtone player is obtained.`); + systemRingtonePlayer = value; +}).catch ((err) => { + console.error(`Failed to get the system ringtone player ${err}`); +}); +``` diff --git a/en/application-dev/website.md b/en/application-dev/website.md index 61c9a6794e0102a128d62b06daaf35ac42f353ef..d5c8e0b5f522b298c4321ad0ead08b96f12b1f04 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -774,8 +774,8 @@ - [Shape](reference/arkui-ts/ts-drawing-components-shape.md) - Canvas Components - [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md) - - [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md) - [CanvasGradient](reference/arkui-ts/ts-components-canvas-canvasgradient.md) + - [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md) - [ImageBitmap](reference/arkui-ts/ts-components-canvas-imagebitmap.md) - [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md) - [OffscreenCanvasRenderingConxt2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md) @@ -1185,6 +1185,9 @@ - [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md) - [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md) - [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md) + - [@ohos.multimedia.systemSoundManager (System Sound Management)](reference/apis/js-apis-systemSoundManager.md) + - multimedia + - [ringtonePlayer (Ringtone Player)](reference/apis/js-apis-inner-multimedia-ringtonePlayer.md) - Resource Manager - [@ohos.i18n (Internationalization)](reference/apis/js-apis-i18n.md) - [@ohos.intl (Internationalization)](reference/apis/js-apis-intl.md) @@ -1285,6 +1288,7 @@ - [@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)](reference/apis/js-apis-inputmethod-extension-ability.md) - [@ohos.InputMethodExtensionContext (InputMethodExtensionContext)](reference/apis/js-apis-inputmethod-extension-context.md) - [@ohos.InputMethodSubtype (Input Method Subtype)](reference/apis/js-apis-inputmethod-subtype.md) + - [@ohos.logLibrary (Log Library)](reference/apis/js-apis-loglibrary.md) - [@ohos.pasteboard (Pasteboard)](reference/apis/js-apis-pasteboard.md) - [@ohos.screenLock (Screenlock)](reference/apis/js-apis-screen-lock.md) - [@ohos.systemDateTime (System Time and Time Zone)](reference/apis/js-apis-system-date-time.md) @@ -1315,6 +1319,7 @@ - [@ohos.multimodalInput.mouseEvent (Mouse Event)](reference/apis/js-apis-mouseevent.md) - [@ohos.multimodalInput.pointer (Mouse Pointer)](reference/apis/js-apis-pointer.md) - [@ohos.multimodalInput.touchEvent (Touch Event)](reference/apis/js-apis-touchevent.md) + - [@ohos.multimodalInput.shortKey (Shortcut Key)](reference/apis/js-apis-shortKey.md) - [@ohos.power (System Power Management)](reference/apis/js-apis-power.md) - [@ohos.runningLock (Runninglock)](reference/apis/js-apis-runninglock.md) - [@ohos.sensor (Sensor)](reference/apis/js-apis-sensor.md) @@ -1494,6 +1499,7 @@ - [Application Event Logging Error Codes](reference/errorcodes/errorcode-hiappevent.md) - [HiSysEvent Error Codes](reference/errorcodes/errorcode-hisysevent.md) - [HiDebug Error Codes](reference/errorcodes/errorcode-hiviewdfx-hidebug.md) + - [Log Library Error Codes](reference/errorcodes/errorcode-loglibrary.md) - [Input Method Framework Error Codes](reference/errorcodes/errorcode-inputmethod-framework.md) - [Pasteboard Error Codes](reference/errorcodes/errorcode-pasteboard.md) - [Screen Lock Management Error Codes](reference/errorcodes/errorcode-screenlock.md) @@ -1615,7 +1621,7 @@ - [OH_Huks_PubKeyInfo](reference/native-apis/_o_h___huks___pub_key_info.md) - [OH_Huks_Result](reference/native-apis/_o_h___huks___result.md) - Standard Libraries Supported by Native APIs - - [Node_API](reference/native-lib/third_party_napi/napi.md) + - [Node-API](reference/native-lib/third_party_napi/napi.md) - [libuv](reference/native-lib/third_party_libuv/libuv.md) - [Native Standard Libraries Supported by Openharmony](reference/native-lib/third_party_libc/musl.md) - Appendix @@ -1649,4 +1655,3 @@ - [SDK Usage](faqs/faqs-sdk.md) - [Usage of Third- and Fourth-Party Libraries](faqs/faqs-third-fourth-party-library.md) - \ No newline at end of file