diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index d406fe07df4da9a2e7d98b393c56d75e1c1d23b0..d6f0a0353e7177c57203f20e1b8827c96ccdc833 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -24,33 +24,50 @@ declare namespace audio { /** * Obtains an AudioManager instance. + * @return AudioManager object. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ function getAudioManager(): AudioManager; /** - * Creates a AudioCapturer instance. - * @param options All options used for audio capturer. - * @return AudioCapturer instance. + * Obtains an AudioCapturer instance. This method uses an asynchronous callback to return the capturer instance. + * @param options Capturer configurations. + * @param callback Callback used to return the audio capturer instance. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback): void; + + /** + * Obtains an AudioCapturer instance. This method uses a promise to return the capturer instance. + * @param options Capturer configurations. + * @return Promise used to return the audio capturer instance. + * @since 8 + * @syscap SystemCapability.Multimedia.Audio.Capturer + */ function createAudioCapturer(options: AudioCapturerOptions): Promise; /** - * Creates a AudioRenderer instance. - * @param options All options used for audio renderer. - * @return AudioRenderer instance. + * Obtains an AudioRenderer instance. This method uses an asynchronous callback to return the renderer instance. + * @param options Renderer configurations. + * @param callback Callback used to return the audio renderer instance. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback): void; + + /** + * Obtains an AudioRenderer instance. This method uses a promise to return the renderer instance. + * @param options Renderer configurations. + * @return Promise used to return the audio renderer instance. + * @since 8 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ function createAudioRenderer(options: AudioRendererOptions): Promise; /** - * Enumerates the rendering states of the current device. + * Enumerates the audio states. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -62,7 +79,7 @@ declare namespace audio { */ STATE_INVALID = -1, /** - * Create New instance state. + * Create new instance state. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -106,25 +123,25 @@ declare namespace audio { */ enum AudioVolumeType { /** - * Audio streams for voice calls + * Audio streams for voice calls. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume */ VOICE_CALL = 0, /** - * Audio streams for ring tones + * Audio streams for ringtones. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ RINGTONE = 2, /** - * Audio streams for media purpose + * Audio streams for media purpose. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ MEDIA = 3, /** - * Audio stream for voice assistant + * Audio stream for voice assistant. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume */ @@ -138,19 +155,19 @@ declare namespace audio { */ enum DeviceFlag { /** - * Output devices + * Output devices. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ OUTPUT_DEVICES_FLAG = 1, /** - * Input devices + * Input devices. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ INPUT_DEVICES_FLAG = 2, /** - * All devices + * All devices. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -164,13 +181,13 @@ declare namespace audio { */ enum DeviceRole { /** - * Input role + * Input role. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ INPUT_DEVICE = 1, /** - * Output role + * Output role. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -184,13 +201,13 @@ declare namespace audio { */ enum DeviceType { /** - * Invalid device + * Invalid device. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ INVALID = 0, /** - * A pair of built-in earpieces. + * Built-in earpiece. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -214,19 +231,19 @@ declare namespace audio { */ WIRED_HEADPHONES = 4, /** - * Bluetooth device using the synchronous connection oriented link (SCO) + * Bluetooth device using the synchronous connection oriented link (SCO). * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ BLUETOOTH_SCO = 7, /** - * Bluetooth device using advanced audio distribution profile (A2DP) + * Bluetooth device using advanced audio distribution profile (A2DP). * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ BLUETOOTH_A2DP = 8, /** - * Built-in microphone + * Built-in microphone. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -240,19 +257,19 @@ declare namespace audio { } /** - * Enumerates Active device types. + * Enumerates the active device types. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ enum ActiveDeviceType { /** - * Speaker + * Speaker. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ SPEAKER = 2, /** - * Bluetooth device using the synchronous connection oriented link (SCO) + * Bluetooth device using the SCO link. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -260,25 +277,25 @@ declare namespace audio { } /** - * Enumerates Audio Ringer modes + * Enumerates ringer modes. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ enum AudioRingMode { /** - * Silent mode + * Silent mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ RINGER_MODE_SILENT = 0, /** - * Vibration mode + * Vibration mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ RINGER_MODE_VIBRATE = 1, /** - * Normal mode + * Normal mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ @@ -286,7 +303,7 @@ declare namespace audio { } /** - * Enumerates the sample format. + * Enumerates the audio sample formats. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -304,19 +321,19 @@ declare namespace audio { */ SAMPLE_FORMAT_U8 = 0, /** - * Signed 16 low-end format. + * Signed 16 bit integer, little endian. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ SAMPLE_FORMAT_S16LE = 1, /** - * Signed 24 low-end format. + * Signed 24 bit integer, little endian. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ SAMPLE_FORMAT_S24LE = 2, /** - * Signed 32 low-end format. + * Signed 32 bit integer, little endian. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -330,13 +347,13 @@ declare namespace audio { */ enum AudioChannel { /** - * First channel. + * Channel 1. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ CHANNEL_1 = 0x1 << 0, /** - * Second channel. + * Channel 2. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -430,7 +447,7 @@ declare namespace audio { */ ENCODING_TYPE_INVALID = -1, /** - * Raw pcm type. + * PCM encoding. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -514,31 +531,31 @@ declare namespace audio { } /** - * Interface for audio stream info + * Describes audio stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ interface AudioStreamInfo { /** - * Audio sampling rate + * Sampling rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ samplingRate: AudioSamplingRate; /** - * Audio channels + * Audio channels. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ channels: AudioChannel; /** - * Audio sample format + * Audio sample format. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ sampleFormat: AudioSampleFormat; /** - * Audio encoding type + * Audio encoding type. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -546,25 +563,25 @@ declare namespace audio { } /** - * Interface for audio renderer info + * Describes audio renderer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ interface AudioRendererInfo { /** - * Audio content type + * Content type. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ content: ContentType; /** - * Audio stream usage + * Stream usage. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ usage: StreamUsage; /** - * Audio renderer flags + * Audio renderer flags. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -572,19 +589,19 @@ declare namespace audio { } /** - * Interface for audio renderer options + * Describes audio renderer configuration options. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ interface AudioRendererOptions { /** - * Audio stream info + * Stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ streamInfo: AudioStreamInfo; /** - * Audio renderer info + * Renderer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ @@ -592,25 +609,25 @@ declare namespace audio { } /** - * Enum for audio renderer rate + * Enumerates the audio renderer rates. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ enum AudioRendererRate { /** - * Normal rate + * Normal rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ RENDER_RATE_NORMAL = 0, /** - * Double rate + * Double rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ RENDER_RATE_DOUBLE = 1, /** - * Half rate + * Half rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ @@ -618,20 +635,20 @@ declare namespace audio { } /** - * Enumerates audio interruption event types. + * Enumerates the interrupt types. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ enum InterruptType { /** - * An audio interruption event starts. + * Audio playback interruption started. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_TYPE_BEGIN = 1, /** - * An audio interruption event ends. + * Audio playback interruption ended. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ @@ -639,47 +656,47 @@ declare namespace audio { } /** - * Enumerates the types of hints for audio interruption. + * Enumerates the interrupt hints. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ enum InterruptHint { /** - * Audio no interrupt. + * None. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_HINT_NONE = 0, /** - * Audio resumed. + * Resume the playback. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_HINT_RESUME = 1, /** - * Audio paused. + * Paused/Pause the playback. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_HINT_PAUSE = 2, /** - * Audio stopped. + * Stopped/Stop the playback. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_HINT_STOP = 3, /** - * Audio ducking. (In ducking, the audio volume is reduced, but not silenced.) + * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_HINT_DUCK = 4, /** - * Audio unducking. + * Unducked the playback. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ @@ -687,50 +704,48 @@ declare namespace audio { } /** - * Interrupt force type. - * @since 8 + * Enumerates the interrupt force types. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @systemapi */ enum InterruptForceType { /** - * Force type, system change audio state. - * @since 8 + * Forced action taken by system. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_FORCE = 0, /** - * Share type, application change audio state. - * @since 8 + * Share type, application can choose to take action or ignore. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ INTERRUPT_SHARE } /** - * Interrupt events - * @since 8 + * Describes the interrupt event received by the app when playback is interrupted. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ interface InterruptEvent { /** - * Interrupt event type, begin or end - * @since 8 + * Indicates whether the interruption has started or finished. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ eventType: InterruptType; /** - * Interrupt force type, force or share - * @since 8 + * Indicates whether the action is taken by system or to be taken by the app. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ forceType: InterruptForceType; /** - * Interrupt hint type. In force type, the audio state already changed, - * but in share mode, only provide a hint for application to decide. - * @since 8 + * Indicates the kind of action. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ hintType: InterruptHint; @@ -814,264 +829,350 @@ declare namespace audio { } /** - * Manages audio volume and audio device information. + * Implements audio volume and audio device management. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ interface AudioManager { /** - * Sets volume for a stream. This method uses an asynchronous callback to return the execution result. + * Sets the volume for a stream. This method uses an asynchronous callback to return the result. + * @param volumeType Audio stream type. + * @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** - * Sets volume for a stream. This method uses a promise to return the execution result. + * Sets the volume for a stream. This method uses a promise to return the result. + * @param volumeType Audio stream type. + * @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setVolume(volumeType: AudioVolumeType, volume: number): Promise; /** - * Obtains volume of a stream. This method uses an asynchronous callback to return the execution result. + * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Obtains the volume of a stream. This method uses a promise to return the execution result. + * Obtains the volume of a stream. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getVolume(volumeType: AudioVolumeType): Promise; /** - * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the execution result. + * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the minimum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Obtains the minimum volume allowed for a stream. This method uses a promise to return the execution result. + * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the minimum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getMinVolume(volumeType: AudioVolumeType): Promise; /** - * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the execution result. + * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the maximum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Obtains the maximum volume allowed for a stream. This method uses a promise to return the execution result. + * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the maximum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ getMaxVolume(volumeType: AudioVolumeType): Promise; /** - * Obtains the audio devices of a specified flag. This method uses an asynchronous callback to return the execution result. + * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. + * @param deviceFlag Audio device flag. + * @param callback Callback used to return the device list. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; /** - * Obtains the audio devices with a specified flag. This method uses a promise to return the execution result. + * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. + * @param deviceFlag Audio device flag. + * @return Promise used to return the device list. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ getDevices(deviceFlag: DeviceFlag): Promise; /** - * Sets the stream to mute. This method uses an asynchronous callback to return the execution result. + * Mutes a stream. This method uses an asynchronous callback to return the result. + * @param volumeType Audio stream type. + * @param mute Mute status to set. The value true means to mute the stream, and false means the opposite. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** - * Sets the stream to mute. This method uses a promise to return the execution result. + * Mutes a stream. This method uses a promise to return the result. + * @param volumeType Audio stream type. + * @param mute Mute status to set. The value true means to mute the stream, and false means the opposite. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** - * Checks whether the stream is muted. This method uses an asynchronous callback to return the execution result. + * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the mute status of the stream. The value true means that the stream is + * muted, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Checks whether the stream is muted. This method uses a promise to return the execution result. + * Checks whether a stream is muted. This method uses a promise to return the result. + * @param volumeType Audio stream type. + * @return Promise used to return the mute status of the stream. The value true means that the stream is muted, + * and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ isMute(volumeType: AudioVolumeType): Promise; /** - * Checks whether the stream is active. This method uses an asynchronous callback to return the execution result. + * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the active status of the stream. The value true means that the stream is + * active, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Checks whether the stream is active. This method uses a promise to return the execution result. + * Checks whether a stream is active. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the active status of the stream. The value true means that the stream is active, + * and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ isActive(volumeType: AudioVolumeType): Promise; /** - * Mute/Unmutes the microphone. This method uses an asynchronous callback to return the execution result. + * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. + * @param mute Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE */ setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; /** - * Mute/Unmutes the microphone. This method uses a promise to return the execution result. + * Mutes or unmutes the microphone. This method uses a promise to return the result. + * @param mute Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE */ setMicrophoneMute(mute: boolean): Promise; /** - * Checks whether the microphone is muted. This method uses an asynchronous callback to return the execution result. + * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. + * @param Callback used to return the mute status of the microphone. The value true means that the microphone is + * muted, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE */ isMicrophoneMute(callback: AsyncCallback): void; /** - * Checks whether the microphone is muted. This method uses a promise to return the execution result. + * Checks whether the microphone is muted. This method uses a promise to return the query result. + * @return Promise used to return the mute status of the microphone. The value true means that the microphone is + * muted, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE */ isMicrophoneMute(): Promise; /** - * Sets the ringer mode. This method uses an asynchronous callback to return the execution result. + * Sets the ringer mode. This method uses an asynchronous callback to return the result. + * @param mode Ringer mode. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; /** - * Sets the ringer mode. This method uses a promise to return the execution result. + * Sets the ringer mode. This method uses a promise to return the result. + * @param mode Ringer mode. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setRingerMode(mode: AudioRingMode): Promise; /** - * Gets the ringer mode. This method uses an asynchronous callback to return the execution result. + * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. + * @param callback Callback used to return the ringer mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ getRingerMode(callback: AsyncCallback): void; /** - * Gets the ringer mode. This method uses a promise to return the execution result. + * Obtains the ringer mode. This method uses a promise to return the query result. + * @return Promise used to return the ringer mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ getRingerMode(): Promise; /** - * Sets the audio parameter. This method uses an asynchronous callback to return the execution result. + * Sets an audio parameter. This method uses an asynchronous callback to return the result. + * @param key Key of the audio parameter to set. + * @param value Value of the audio parameter to set. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core * @permission ohos.permission.MODIFY_AUDIO_SETTINGS */ setAudioParameter(key: string, value: string, callback: AsyncCallback): void; /** - * Sets the audio parameter. This method uses a promise to return the execution result. + * Sets an audio parameter. This method uses a promise to return the result. + * @param key Key of the audio parameter to set. + * @param value Value of the audio parameter to set. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core * @permission ohos.permission.MODIFY_AUDIO_SETTINGS */ setAudioParameter(key: string, value: string): Promise; /** - * Gets the audio parameter. This method uses an asynchronous callback to return the execution result. + * Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. + * @param key Key of the audio parameter whose value is to be obtained. + * @param callback Callback used to return the value of the audio parameter. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ getAudioParameter(key: string, callback: AsyncCallback): void; /** - * Gets the audio parameter. This method uses a promise to return the execution result. + * Obtains the value of an audio parameter. This method uses a promise to return the query result. + * @param key Key of the audio parameter whose value is to be obtained. + * @return Promise used to return the value of the audio parameter. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ getAudioParameter(key: string): Promise; /** - * Activates the device. This method uses an asynchronous callback to return the execution result. + * Sets a device to the active state. This method uses an asynchronous callback to return the result. + * @param deviceType Audio device type. + * @param active Active status to set. The value true means to set the device to the active status, and false + * means the opposite. + * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback): void; /** - * Activates the device. This method uses a promise to return the execution result. + * Sets a device to the active state. This method uses a promise to return the result. + * @param deviceType Audio device type. + * @param active Active status to set. The value true means to set the device to the active status, and false + * means the opposite. + * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise; /** - * Checks whether the device is active. This method uses an asynchronous callback to return the execution result. + * Checks whether a device is active. This method uses an asynchronous callback to return the query result. + * @param deviceType Audio device type. + * @param callback Callback used to return the active status of the device. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback): void; /** - * Checks whether the device is active. This method uses a promise to return the execution result. + * Checks whether a device is active. This method uses a promise to return the query result. + * @param deviceType Audio device type. + * @return Promise used to return the active status of the device. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ isDeviceActive(deviceType: ActiveDeviceType): Promise; /** - * Subscribes volume change event callback, only for system - * @return VolumeEvent callback. + * Listens for system volume change events. This method uses a callback to get volume change events. + * @param callback Callback used to get the system volume change event. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi */ on(type: 'volumeChange', callback: Callback): void; /** - * Monitors ringer mode change + * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. + * @param callback Callback used to get the updated ringer mode. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi */ on(type: 'ringerModeChange', callback: Callback): void; /** - * Sets the audio scene mode to change audio strategy. - * This method uses an asynchronous callback to return the execution result. + * Sets the audio scene mode to change audio strategies. This method uses an asynchronous callback to return the + * result. + * @param scene Audio scene mode. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi */ setAudioScene(scene: AudioScene, callback: AsyncCallback ): void; /** - * Sets the audio scene mode to change audio strategy. This method uses a promise to return the execution result. + * Sets the audio scene mode to change audio strategies. This method uses a promise to return the result. + * @param scene Audio scene mode. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi */ setAudioScene(scene: AudioScene): Promise; /** - * Obtains the system audio scene mode. This method uses an asynchronous callback to return the execution result. + * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. + * @param callback Callback used to return the audio scene mode. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication */ getAudioScene(callback: AsyncCallback): void; /** - * Obtains the system audio scene mode. This method uses a promise to return the execution result. + * Obtains the audio scene mode. This method uses a promise to return the query result. + * @return Promise used to return the audio scene mode. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication */ getAudioScene(): Promise; /** - * Monitors device changes + * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param callback Callback used to obtain the device update details. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ on(type: 'deviceChange', callback: Callback): void; /** - * Cancels the listening of device change events. + * UnSubscribes to device change events. + * @param callback Callback used to obtain the device update details. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -1080,21 +1181,21 @@ declare namespace audio { /** * Listens for audio interruption events. When the audio of an application is interrupted by another application, * the callback is invoked to notify the former application. - * @since 7 - * @syscap SystemCapability.Multimedia.Audio.Renderer * @param type Type of the event to listen for. Only the interrupt event is supported. * @param interrupt Parameters of the audio interruption event type. * @param callback Callback invoked for the audio interruption event. + * @since 7 + * @syscap SystemCapability.Multimedia.Audio.Renderer */ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback): void; /** * Cancels the listening of audio interruption events. - * @since 7 - * @syscap SystemCapability.Multimedia.Audio.Renderer * @param type Type of the event to listen for. Only the interrupt event is supported. * @param interrupt Input parameters of the audio interruption event. * @param callback Callback invoked for the audio interruption event. + * @since 7 + * @syscap SystemCapability.Multimedia.Audio.Renderer */ off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; } @@ -1106,13 +1207,13 @@ declare namespace audio { */ interface AudioDeviceDescriptor { /** - * Audio device role + * Audio device role. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ readonly deviceRole: DeviceRole; /** - * Audio device type + * Audio device type. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ @@ -1120,33 +1221,33 @@ declare namespace audio { } /** - * A queue of AudioDeviceDescriptor, which is read-only. + * Array of AudioDeviceDescriptors, which is read-only. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device */ type AudioDeviceDescriptors = Array>; /** - * Audio volume event + * Describes the volume event received by the app when the volume is changed. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi */ interface VolumeEvent { /** - * volumeType of current stream + * Volume type of the current stream. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume */ volumeType: AudioVolumeType; /** - * volume level + * Volume level. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume */ volume: number; /** - * updateUi show volume change in Ui + * Whether to show the volume change in UI. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume */ @@ -1244,224 +1345,244 @@ declare namespace audio { } /** - * Provides functions for applications for audio playback. + * Provides audio playback APIs. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ interface AudioRenderer { /** - * Gets audio state. + * Defines the current render state. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ readonly state: AudioState; /** - * Gets audio renderer info. - * @return AudioRendererInfo value + * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous + * callback to return the result. + * @param callback Callback used to return the renderer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRendererInfo(callback: AsyncCallback): void; /** - * Gets audio renderer info. - * @return AudioRendererInfo value + * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to + * return the result. + * @return Promise used to return the renderer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRendererInfo(): Promise; /** - * Gets audio stream info. - * @return AudioStreamInfo value + * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getStreamInfo(callback: AsyncCallback): void; /** - * Gets audio stream info. - * @return AudioStreamInfo value + * Obtains the renderer stream information. This method uses a promise to return the result. + * @return Promise used to return the stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getStreamInfo(): Promise; /** - * Starts audio rendering. This method uses an asynchronous callback to return the execution result. + * Starts the renderer. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ start(callback: AsyncCallback): void; /** - * Starts audio rendering. This method uses a promise to return the execution result. + * Starts the renderer. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ start(): Promise; /** - * Render audio data. This method uses an asynchronous callback to return the execution result. + * Writes the buffer. This method uses an asynchronous callback to return the result. + * @param buffer Buffer to be written. + * @param callback Returns the number of bytes written if the operation is successful; returns an error code + * otherwise. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ write(buffer: ArrayBuffer, callback: AsyncCallback): void; /** - * Render audio data. This method uses a promise to return the execution result. + * Writes the buffer. This method uses a promise to return the result. + * @param buffer Buffer to be written. + * @return Returns the number of bytes written if the operation is successful; returns an error code otherwise. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ write(buffer: ArrayBuffer): Promise; /** - * Obtains the current timestamp. This method uses an asynchronous callback to return the execution result. + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an + * asynchronous callback to return the result. + * @param callback Callback used to return the timestamp. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getAudioTime(callback: AsyncCallback): void; /** - * Obtains the current timestamp. This method uses a promise to return the execution result. + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a + * promise to return the result. + * @return Promise used to return the timestamp. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getAudioTime(): Promise; /** - * Drain renderer buffer. This method uses an asynchronous callback to return the execution result. + * Drains the playback buffer. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ drain(callback: AsyncCallback): void; /** - * Drain renderer buffer. This method uses a promise to return the execution result. + * Drains the playback buffer. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ drain(): Promise; /** - * Pauses audio rendering. This method uses an asynchronous callback to return the execution result. + * Pauses rendering. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ pause(callback: AsyncCallback): void; /** - * Pauses audio rendering. This method uses a promise to return the execution result. + * Pauses rendering. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ pause(): Promise; /** - * Stops audio rendering. This method uses an asynchronous callback to return the execution result. + * Stops rendering. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ stop(callback: AsyncCallback): void; /** - * Stops audio rendering. This method uses a promise to return the execution result. + * Stops rendering. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ stop(): Promise; /** - * Releases resources. This method uses an asynchronous callback to return the execution result. + * Releases the renderer. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ release(callback: AsyncCallback): void; /** - * Releases resources. This method uses a promise to return the execution result. + * Releases the renderer. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ release(): Promise; /** - * Obtains a reasonable minimum buffer size for renderer, however, the renderer can - * accept other read sizes as well. This method uses an asynchronous callback to return the execution result. + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to + * return the result. + * @param callback Callback used to return the buffer size. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getBufferSize(callback: AsyncCallback): void; /** - * Obtains a reasonable minimum buffer size for renderer, however, the renderer can - * accept other read sizes as well. This method uses a promise to return the execution result. + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. + * @return Promise used to return the buffer size. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getBufferSize(): Promise; /** - * Set the render rate. This method uses an asynchronous callback to return the execution result. + * Sets the render rate. This method uses an asynchronous callback to return the result. + * @param rate Audio render rate. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ setRenderRate(rate: AudioRendererRate, callback: AsyncCallback): void; /** - * Set the render rate. This method uses a promise to return the execution result. + * Sets the render rate. This method uses a promise to return the result. + * @param rate Audio render rate. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ setRenderRate(rate: AudioRendererRate): Promise; /** - * Obtains the current render rate. This method uses an asynchronous callback to return the execution result. + * Obtains the current render rate. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the audio render rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRenderRate(callback: AsyncCallback): void; /** - * Obtains the current render rate. This method uses a promise to return the execution result. + * Obtains the current render rate. This method uses a promise to return the result. + * @return Promise used to return the audio render rate. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRenderRate(): Promise; /** - * Subscribes for audio interrupt event callback. - * @param type Event type. - * @return InterruptEvent callback. - * @since 8 + * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is + * triggered when audio playback is interrupted. + * @param callback Callback used to listen for interrupt callback. + * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @systemapi */ on(type: 'interrupt', callback: Callback): void; /** - * Subscribes mark reach event callback. - * @param type Event type. - * @param frame Mark reach frame count. - * @return Mark reach event callback. + * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, + * the callback is invoked. + * @param frame Number of frames to trigger the event. The value must be greater than 0. + * @param callback Callback invoked when the event is triggered. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @initial */ on(type: "markReach", frame: number, callback: (position: number) => {}): void; /** - * Unsubscribes mark reach event callback. + * Unsubscribes from mark reached events. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @initial */ off(type: "markReach"): void; /** - * Subscribes period reach event callback. - * @param type Event type. - * @param frame Period reach frame count. - * @return Period reach event callback. + * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, + * the callback is invoked. + * @param frame Period during which frame rendering is listened. The value must be greater than 0. + * @param callback Callback invoked when the event is triggered. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @initial */ on(type: "periodReach", frame: number, callback: (position: number) => {}): void; /** - * Unsubscribes period reach event callback. + * Unsubscribes from period reached events. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @initial */ off(type: "periodReach"): void; /** * Subscribes audio state change event callback. - * @param type Event type. - * @param callback Callback used to listen for the audio state change event - * @return AudioState + * @param callback Callback invoked when state change. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Renderer - * @initial */ on(type: "stateChange", callback: Callback): void; } /** - * Enum for source type. + * Enumerates source types. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -1479,7 +1600,7 @@ declare namespace audio { */ SOURCE_TYPE_MIC = 0, /** - * Voice communication source. + * Voice communication source type. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -1487,19 +1608,19 @@ declare namespace audio { } /** - * Interface for audio capturer info. + * Describes audio capturer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ interface AudioCapturerInfo { /** - * Audio source type + * Audio source type. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ source: SourceType; /** - * Audio capturer flags + * Audio capturer flags. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -1507,19 +1628,19 @@ declare namespace audio { } /** - * Interface for audio capturer options. + * Describes audio capturer configuration options. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ interface AudioCapturerOptions { /** - * Audio stream info. + * Stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ streamInfo: AudioStreamInfo; /** - * Audio capturer info. + * Capturer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ @@ -1527,171 +1648,183 @@ declare namespace audio { } /** - * Provides functions for applications to manage audio capturing. + * Provides APIs for audio recording. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ interface AudioCapturer { /** - * Gets capture state. + * Defines the current capture state. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ readonly state: AudioState; /** - * Gets audio capturer info. - * @return AudioCapturerInfo value + * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous + * callback to return the result. + * @param callback Callback used to return the capturer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getCapturerInfo(callback: AsyncCallback): void; /** - * Gets audio capturer info. - * @return AudioCapturerInfo value + * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to + * return the result. + * @return Promise used to return the capturer information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getCapturerInfo(): Promise; /** - * Gets audio stream info. - * @return AudioStreamInfo value + * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getStreamInfo(callback: AsyncCallback): void; /** - * Gets audio stream info. - * @return AudioStreamInfo value + * Obtains the capturer stream information. This method uses a promise to return the result. + * @return Promise used to return the stream information. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getStreamInfo(): Promise; /** - * Starts audio capturing. This method uses an asynchronous callback to return the execution result. + * Starts capturing. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ start(callback: AsyncCallback): void; /** - * Starts audio capturing. This method uses a promise to return the execution result. + * Starts capturing. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ start(): Promise; /** - * Capture audio data. This method uses an asynchronous callback to return the execution result. + * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. + * @param size Number of bytes to read. + * @param isBlockingRead Whether the read operation should be blocked. + * @param callback Callback used to return the buffer. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ read(size: number, isBlockingRead: boolean, callback: AsyncCallback): void; /** - * Capture audio data. This method uses a promise to return the execution result. + * Reads the buffer from the audio capturer. This method uses a promise to return the result. + * @param size Number of bytes to read. + * @param isBlockingRead Whether the read operation should be blocked. + * @return Returns the buffer data read if the operation is successful; returns an error code otherwise. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ read(size: number, isBlockingRead: boolean): Promise; /** - * Obtains the current timestamp. This method uses an asynchronous callback to return the execution result. + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an + * asynchronous callback to return the result. + * @param callback Callback used to return the timestamp. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getAudioTime(callback: AsyncCallback): void; /** - * Obtains the current timestamp. This method uses a promise to return the execution result. + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a + * promise to return the result. + * @return Promise used to return the timestamp. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getAudioTime(): Promise; /** - * Stops audio capturing. This method uses an asynchronous callback to return the execution result. + * Stops capturing. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ stop(callback: AsyncCallback): void; /** - * Stops audio capturing. This method uses a promise to return the execution result. + * Stops capturing. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ stop(): Promise; /** - * Releases a capture resources. This method uses an asynchronous callback to return the execution result. + * Releases the capturer. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ release(callback: AsyncCallback): void; /** - * Releases a capture resources. This method uses a promise to return the execution result. + * Releases the capturer. This method uses a promise to return the result. + * @return Promise used to return the result. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ release(): Promise; /** - * Obtains a reasonable minimum buffer size for capturer, however, the capturer can - * accept other read sizes as well. This method uses an asynchronous callback to return the execution result. + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to + * return the result. + * @param callback Callback used to return the buffer size. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getBufferSize(callback: AsyncCallback): void; /** - * Obtains a reasonable minimum buffer size for capturer, however, the capturer can - * accept other read sizes as well. This method uses a promise to return the execution result. + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. + * @return Promise used to return the buffer size. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer */ getBufferSize(): Promise; /** - * Subscribes mark reach event callback. - * @param type Event type. - * @param frame Mark reach frame count. - * @return Mark reach event callback. + * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, + * the callback is invoked. + * @param frame Number of frames to trigger the event. The value must be greater than 0. + * @param callback Callback invoked when the event is triggered. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer - * @initial */ on(type: "markReach", frame: number, callback: (position: number) => {}): void; /** - * Unsubscribes mark reach event callback. + * Unsubscribes from the mark reached events. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer - * @initial */ off(type: "markReach"): void; /** - * Subscribes period reach event callback. - * @param type Event type. - * @param frame Period reach frame count. - * @return Period reach event callback. + * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, + * the callback is invoked. + * @param frame Period during which frame capturing is listened. The value must be greater than 0. + * @param callback Callback invoked when the event is triggered. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer - * @initial */ on(type: "periodReach", frame: number, callback: (position: number) => {}): void; /** - * Unsubscribes period reach event callback. + * Unsubscribes from period reached events. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer - * @initial */ off(type: "periodReach"): void; /** * Subscribes audio state change event callback. - * @param type Event type. - * @param callback Callback used to listen for the audio state change event - * @return AudioState + * @param callback Callback used to listen for the audio state change event. * @since 8 * @syscap SystemCapability.Multimedia.Audio.Capturer - * @initial */ on(type: "stateChange", callback: Callback): void; } diff --git a/api/@ohos.multimedia.camera.d.ts b/api/@ohos.multimedia.camera.d.ts index 5acbd7dcff0dfe27d0a35509b1f110fd16b082c6..3f5c1c8b57ece7afb2f4f37cef2e436bf9c19327 100644 --- a/api/@ohos.multimedia.camera.d.ts +++ b/api/@ohos.multimedia.camera.d.ts @@ -14,117 +14,151 @@ */ import {ErrorCallback, AsyncCallback} from './basic'; -import Context from './@ohos.ability'; +import { Context } from './app/context'; /** * @name camera * @syscap SystemCapability.Multimedia.Camera.Core * @import import camera from '@ohos.multimedia.camera'; - * @since 8 - * @systemapi + * @since 9 */ declare namespace camera { /** * Creates a CameraManager instance. * @param context Current application context. - * @return CameraManager instance. - * @since 8 + * @param callback Callback used to return the CameraManager instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ function getCameraManager(context: Context, callback: AsyncCallback): void; + + /** + * Creates a CameraManager instance. + * @param context Current application context. + * @return Promise used to return the CameraManager instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ function getCameraManager(context: Context): Promise; /** * Enum for camera status. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum CameraStatus { /** * Appear status. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_STATUS_APPEAR = 0, /** * Disappear status. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_STATUS_DISAPPEAR, /** * Available status. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_STATUS_AVAILABLE, /** * Unavailable status. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_STATUS_UNAVAILABLE } /** * Camera manager object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface CameraManager { /** * Gets all camera descriptions. - * @return All camera descriptions. - * @since 8 + * @param callback Callback used to return the array of supported cameras. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getCameras(callback: AsyncCallback>): void; + + /** + * Gets all camera descriptions. + * @return Promise used to return an array of supported cameras. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getCameras(): Promise>; /** * Creates a CameraInput instance by camera id. - * @param cameraId Target camera id. - * @return CameraInput instance. - * @since 8 + * @param cameraId Camera ID used to create the instance. + * @param callback Callback used to return the CameraInput instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ createCameraInput(cameraId: string, callback: AsyncCallback): void; + + /** + * Creates a CameraInput instance by camera id. + * @param cameraId Camera ID used to create the instance. + * @return Promise used to return the CameraInput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ createCameraInput(cameraId: string): Promise; /** * Creates a CameraInput instance by camera position and type. * @param position Target camera position. * @param type Target camera type. - * @return CameraInput instance. - * @since 8 + * @param callback Callback used to return the CameraInput instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void; + + /** + * Creates a CameraInput instance by camera position and type. + * @param position Target camera position. + * @param type Target camera type. + * @return Promise used to return the CameraInput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ createCameraInput(position: CameraPosition, type: CameraType): Promise; /** * Subscribes camera status change event callback. * @param type Event type. - * @return CameraStatusInfo event callback. - * @since 8 + * @param callback Callback used to get the camera status change. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "cameraStatus", callback: AsyncCallback): void; + on(type: 'cameraStatus', callback: AsyncCallback): void; } /** * Camera status info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface CameraStatusInfo { /** * Camera instance. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ camera: Camera; /** * Current camera status. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ status: CameraStatus; @@ -132,116 +166,127 @@ declare namespace camera { /** * Enum for camera position. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum CameraPosition { /** * Unspecified position. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_POSITION_UNSPECIFIED = 0, /** * Back position. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_POSITION_BACK, /** * Front position. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_POSITION_FRONT } /** * Enum for camera type. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum CameraType { /** * Unspecified camera type - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_TYPE_UNSPECIFIED = 0, /** * Wide camera - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_TYPE_WIDE_ANGLE, /** * Ultra wide camera - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_TYPE_ULTRA_WIDE, /** * Telephoto camera - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_TYPE_TELEPHOTO, /** * True depth camera - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_TYPE_TRUE_DEPTH } /** * Enum for camera connection type. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum ConnectionType { /** * Built-in camera. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_CONNECTION_BUILT_IN = 0, /** * Camera connected using USB - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_CONNECTION_USB_PLUGIN, /** * Remote camera - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ CAMERA_CONNECTION_REMOTE } /** * Camera object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface Camera { /** * Camera id attribute. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ readonly cameraId: string; /** * Camera position attribute. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ readonly cameraPosition: CameraPosition; /** * Camera type attribute. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ readonly cameraType: CameraType; /** * Camera connection type attribute. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ readonly connectionType: ConnectionType; @@ -249,19 +294,19 @@ declare namespace camera { /** * Size parameter. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface Size { /** * Height. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ height: number; /** * Width. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ width: number; @@ -269,153 +314,247 @@ declare namespace camera { /** * Camera input object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface CameraInput { /** * Gets camera id. - * @return Camera id. - * @since 8 + * @param callback Callback used to return the camera ID. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getCameraId(callback: AsyncCallback): void; + + /** + * Gets camera id. + * @return Promise used to return the camera ID. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getCameraId(): Promise; /** * Check if device has flash light. - * @return Flash light has or not. - * @since 8 + * @param callback Callback used to return the flash light support status. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ hasFlash(callback: AsyncCallback): void; + + /** + * Check if device has flash light. + * @return Promise used to return the flash light support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ hasFlash(): Promise; /** - * Gets all supported flash modes for current camera input. - * @return Supported flash mode array. - * @since 8 + * Checks whether a specified flash mode is supported. + * @param flashMode Flash mode. + * @param callback Callback used to return the flash light support status. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; + + /** + * Checks whether a specified flash mode is supported. + * @param flashMode Flash mode + * @return Promise used to return flash mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ isFlashModeSupported(flashMode: FlashMode): Promise; /** * Gets current flash mode. - * @return Current flash mode. - * @since 8 + * @param callback Callback used to return the current flash mode. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getFlashMode(callback: AsyncCallback): void; + + /** + * Gets current flash mode. + * @return Promise used to return the flash mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getFlashMode(): Promise; /** * Sets flash mode. * @param flashMode Target flash mode. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void; + + /** + * Sets flash mode. + * @param flashMode Target flash mode. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ setFlashMode(flashMode: FlashMode): Promise; /** - * Gets all supported focus modes for current camera input. - * @return Supported focus mode array. - * @since 8 + * Checks whether a specified focus mode is supported. + * @param afMode Focus mode. + * @param callback Callback used to return the device focus support status. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; + + /** + * Checks whether a specified focus mode is supported. + * @param afMode Focus mode. + * @return Promise used to return the focus mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ isFocusModeSupported(afMode: FocusMode): Promise; /** * Gets current focus mode. - * @return Current focus mode. - * @since 8 + * @param callback Callback used to return the current focus mode. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getFocusMode(callback: AsyncCallback): void; + + /** + * Gets current focus mode. + * @return Promise used to return the focus mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getFocusMode(): Promise; /** * Sets focus mode. * @param afMode Target focus mode. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; + + /** + * Sets focus mode. + * @param afMode Target focus mode. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ setFocusMode(afMode: FocusMode): Promise; /** * Gets all supported zoom ratio range. - * @param afMode Target focus mode. - * @since 8 + * @param callback Callback used to return the zoom ratio range. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getZoomRatioRange(callback: AsyncCallback>): void; + + /** + * Gets all supported zoom ratio range. + * @return Promise used to return the zoom ratio range. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getZoomRatioRange(): Promise>; /** * Gets zoom ratio. - * @return Current zoom ratio. - * @since 8 + * @param callback Callback used to return the current zoom ratio value. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ getZoomRatio(callback: AsyncCallback): void; + + /** + * Gets zoom ratio. + * @return Promise used to return the zoom ratio value. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ getZoomRatio(): Promise; /** * Sets zoom ratio. * @param zoomRatio Target zoom ratio. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; + + /** + * Sets zoom ratio. + * @param zoomRatio Target zoom ratio. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ setZoomRatio(zoomRatio: number): Promise; /** * Releases instance. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ release(callback: AsyncCallback): void; + + /** + * Releases instance. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ release(): Promise; /** * Subscribes focus status change event callback. * @param type Event type. - * @return FocusState event callback. - * @since 8 + * @param callback Callback used to get the focus state change. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "focusStateChange", callback: AsyncCallback): void; + on(type: 'focusStateChange', callback: AsyncCallback): void; /** * Subscribes error event callback. * @param type Event type. - * @return Error event callback. - * @since 8 + * @param callback Callback used to get the camera input errors. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "error", callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Enum for CameraInput error code. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum CameraInputErrorCode { /** * Unknown error. - * @since 8 + * @since 9 */ ERROR_UNKNOWN = -1 } /** * Camera input error object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface CameraInputError extends Error { @@ -424,78 +563,90 @@ declare namespace camera { /** * Enum for flash mode. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum FlashMode { /** * Close mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FLASH_MODE_CLOSE = 0, /** * Open mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FLASH_MODE_OPEN, /** * Auto mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FLASH_MODE_AUTO, /** * Always open mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FLASH_MODE_ALWAYS_OPEN } /** * Enum for focus mode. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum FocusMode { /** * Manual mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_MODE_MANUAL = 0, /** * Continuous auto mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_MODE_CONTINUOUS_AUTO, /** * Auto mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_MODE_AUTO, /** * Locked mode. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_MODE_LOCKED } /** * Enum for focus state. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ enum FocusState { /** * Scan state. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_STATE_SCAN = 0, /** * Focused state. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_STATE_FOCUSED, /** * Unfocused state. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ FOCUS_STATE_UNFOCUSED } @@ -503,146 +654,265 @@ declare namespace camera { /** * Gets a CaptureSession instance. * @param context Current application context. - * @return CaptureSession instance. - * @since 8 + * @param callback Callback used to return the CaptureSession instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ function createCaptureSession(context: Context, callback: AsyncCallback): void; + + /** + * Gets a CaptureSession instance. + * @param context Current application context. + * @return Promise used to return the CaptureSession instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ function createCaptureSession(context: Context): Promise; /** * Capture session object. - * @since 8 + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core */ interface CaptureSession { /** * Begin capture session config. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ beginConfig(callback: AsyncCallback): void; + + /** + * Begin capture session config. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ beginConfig(): Promise; /** * Commit capture session config. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ commitConfig(callback: AsyncCallback): void; + + /** + * Commit capture session config. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ commitConfig(): Promise; /** * Adds a camera input. * @param cameraInput Target camera input to add. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ addInput(cameraInput: CameraInput, callback: AsyncCallback): void; + + /** + * Adds a camera input. + * @param cameraInput Target camera input to add. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ addInput(cameraInput: CameraInput): Promise; /** * Adds a camera preview output. * @param previewOutput Target camera preview output to add. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void; + + /** + * Adds a camera preview output. + * @param previewOutput Target camera preview output to add. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ addOutput(previewOutput: PreviewOutput): Promise; /** * Adds a camera photo output. * @param photoOutput Target camera photo output to add. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void; + + /** + * Adds a camera photo output. + * @param photoOutput Target camera photo output to add. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ addOutput(photoOutput: PhotoOutput): Promise; /** * Adds a camera video output. * @param videoOutput Target camera video output to add. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void; + + /** + * Adds a camera video output. + * @param videoOutput Target camera video output to add. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ addOutput(videoOutput: VideoOutput): Promise; /** * Removes a camera input. * @param cameraInput Target camera input to remove. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ removeInput(cameraInput: CameraInput, callback: AsyncCallback): void; + + /** + * Removes a camera input. + * @param cameraInput Target camera input to remove. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ removeInput(cameraInput: CameraInput): Promise; /** * Removes a camera preview output. * @param previewOutput Target camera preview output to remove. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void; + + /** + * Removes a camera preview output. + * @param previewOutput Target camera preview output to remove. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ removeOutput(previewOutput: PreviewOutput): Promise; /** * Removes a camera photo output. * @param photoOutput Target camera photo output to remove. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void; + + /** + * Removes a camera photo output. + * @param photoOutput Target camera photo output to remove. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ removeOutput(photoOutput: PhotoOutput): Promise; /** * Removes a camera video output. * @param videoOutput Target camera video output to remove. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void; + + /** + * Removes a camera video output. + * @param videoOutput Target camera video output to remove. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ removeOutput(videoOutput: VideoOutput): Promise; /** * Starts capture session. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ start(callback: AsyncCallback): void; + + /** + * Starts capture session. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ start(): Promise; /** * Stops capture session. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ stop(callback: AsyncCallback): void; + + /** + * Stops capture session. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ stop(): Promise; /** * Release capture session instance. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ release(callback: AsyncCallback): void; + + /** + * Release capture session instance. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ release(): Promise; /** * Subscribes error event callback. * @param type Event type. - * @return Error event callback. - * @since 8 + * @param callback Callback used to get the capture session errors. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "error", callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Enum for CaptureSession error code. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ enum CaptureSessionErrorCode { ERROR_UNKNOWN = -1 @@ -650,9 +920,8 @@ declare namespace camera { /** * Capture session error object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ interface CaptureSessionError extends Error { code: CaptureSessionErrorCode; @@ -661,61 +930,75 @@ declare namespace camera { /** * Creates a PreviewOutput instance. * @param surfaceId Surface object id used in camera preview output. - * @return PreviewOutput instance. - * @since 8 + * @param callback Callback used to return the PreviewOutput instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ function createPreviewOutput(surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a PreviewOutput instance. + * @param surfaceId Surface object id used in camera preview output. + * @return Promise used to return the PreviewOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ function createPreviewOutput(surfaceId: string): Promise; /** * Preview output object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface PreviewOutput { /** * Release output instance. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ release(callback: AsyncCallback): void; + + /** + * Release output instance. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ release(): Promise; /** * Subscribes frame start event callback. * @param type Event type. - * @return Frame start event callback. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "frameStart", callback: AsyncCallback): void; + on(type: 'frameStart', callback: AsyncCallback): void; /** * Subscribes frame end event callback. * @param type Event type. - * @return Frame end event callback. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "frameEnd", callback: AsyncCallback): void; + on(type: 'frameEnd', callback: AsyncCallback): void; /** * Subscribes error event callback. * @param type Event type. - * @return Error event callback. - * @since 8 + * @param callback Callback used to get the preview output errors. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "error", callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Enum for preview output error code. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ enum PreviewOutputErrorCode { ERROR_UNKNOWN = -1 @@ -723,9 +1006,8 @@ declare namespace camera { /** * Preview output error object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ interface PreviewOutputError extends Error { code: PreviewOutputErrorCode; @@ -734,43 +1016,51 @@ declare namespace camera { /** * Creates a PhotoOutput instance. * @param surfaceId Surface object id used in camera photo output. - * @return PhotoOutput instance. - * @since 8 + * @param callback Callback used to return the PhotoOutput instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ function createPhotoOutput(surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a PhotoOutput instance. + * @param surfaceId Surface object id used in camera photo output. + * @return Promise used to return the PhotoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ function createPhotoOutput(surfaceId: string): Promise; /** * Enumerates the image rotation angles. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum ImageRotation { /** * The capture image rotates 0 degrees. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ ROTATION_0 = 0, - + /** * The capture image rotates 90 degrees. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ ROTATION_90 = 90, - + /** * The capture image rotates 180 degrees. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ ROTATION_180 = 180, - + /** * The capture image rotates 270 degrees. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ ROTATION_270 = 270 @@ -778,27 +1068,27 @@ declare namespace camera { /** * Enumerates the image quality levels. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ enum QualityLevel { /** * High image quality. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ QUALITY_LEVEL_HIGH = 0, - + /** * Medium image quality. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ QUALITY_LEVEL_MEDIUM, - + /** * Low image quality. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ QUALITY_LEVEL_LOW @@ -806,18 +1096,18 @@ declare namespace camera { /** * Photo capture options to set. - * @since 8 + * @since 9 */ interface PhotoCaptureSetting { /** * Photo image quality. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ quality?: QualityLevel; /** * Photo rotation. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ rotation?: ImageRotation; @@ -825,81 +1115,104 @@ declare namespace camera { /** * Photo output object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface PhotoOutput { /** * Start capture output. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ capture(callback: AsyncCallback): void; + + /** + * Start capture output. + * @param setting Photo capture settings. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void; + + /** + * Start capture output. + * @param setting Photo capture settings. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ capture(setting?: PhotoCaptureSetting): Promise; /** * Release output instance. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ release(callback: AsyncCallback): void; + + /** + * Release output instance. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ release(): Promise; /** * Subscribes capture start event callback. * @param type Event type. - * @return Capture start event callback. - * @since 8 + * @param callback Callback used to get the capture ID. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "captureStart", callback: AsyncCallback): void; + on(type: 'captureStart', callback: AsyncCallback): void; /** * Subscribes frame shutter event callback. * @param type Event type. - * @return Frame shutter event callback. - * @since 8 + * @param callback Callback used to get the frame shutter information. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "frameShutter", callback: AsyncCallback): void; + on(type: 'frameShutter', callback: AsyncCallback): void; /** * Subscribes capture end event callback. * @param type Event type. - * @return Capture end event callback. - * @since 8 + * @param callback Callback used to get the capture end information. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "captureEnd", callback: AsyncCallback): void; + on(type: 'captureEnd', callback: AsyncCallback): void; /** * Subscribes error event callback. * @param type Event type. - * @return Error event callback. - * @since 8 + * @param callback Callback used to get the photo output errors. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "error", callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Frame shutter callback info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface FrameShutterInfo { /** * Capture id. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ captureId: number; /** * Timestamp for frame. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ timestamp: number; @@ -907,19 +1220,19 @@ declare namespace camera { /** * Capture end info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface CaptureEndInfo { /** * Capture id. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ captureId: number; /** * Frame count. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ frameCount: number; @@ -927,9 +1240,8 @@ declare namespace camera { /** * Enum for photo output error code. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ enum PhotoOutputErrorCode { ERROR_UNKNOWN = -1 @@ -937,9 +1249,8 @@ declare namespace camera { /** * Photo output error object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ interface PhotoOutputError extends Error { code: PhotoOutputErrorCode; @@ -948,77 +1259,107 @@ declare namespace camera { /** * Creates a VideoOutput instance. * @param surfaceId Surface object id used in camera video output. - * @return VideoOutput instance. - * @since 8 + * @param callback Callback used to return the VideoOutput instance. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ function createVideoOutput(surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a VideoOutput instance. + * @param surfaceId Surface object id used in camera video output. + * @return Promise used to return the VideoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ function createVideoOutput(surfaceId: string): Promise; /** * Video output object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ interface VideoOutput { /** * Start video output. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ start(callback: AsyncCallback): void; + + /** + * Start video output. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ start(): Promise; /** * Stop video output. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ stop(callback: AsyncCallback): void; + + /** + * Stop video output. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ stop(): Promise; /** * Release output instance. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ release(callback: AsyncCallback): void; + + /** + * Release output instance. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ release(): Promise; /** * Subscribes frame start event callback. * @param type Event type. - * @return Frame start event callback. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "frameStart", callback: AsyncCallback): void; + on(type: 'frameStart', callback: AsyncCallback): void; /** * Subscribes frame end event callback. * @param type Event type. - * @return Frame end event callback. - * @since 8 + * @param callback Callback used to return the result. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: "frameEnd", callback: AsyncCallback): void; + on(type: 'frameEnd', callback: AsyncCallback): void; /** * Subscribes error event callback. * @param type Event type. - * @return Error event callback. - * @since 8 + * @param callback Callback used to get the video output errors. + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ - on(type: "error", callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Enum for video output error code. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ enum VideoOutputErrorCode { ERROR_UNKNOWN = -1 @@ -1026,9 +1367,8 @@ declare namespace camera { /** * Video output error object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core - * @initial */ interface VideoOutputError extends Error { code: VideoOutputErrorCode; diff --git a/api/@ohos.multimedia.image.d.ts b/api/@ohos.multimedia.image.d.ts index 59e7a118c4a56a2944077fc37fd05e037b4d7186..384a7f93ec361715f3b8b7a6ce43edc8c6ea84f5 100644 --- a/api/@ohos.multimedia.image.d.ts +++ b/api/@ohos.multimedia.image.d.ts @@ -139,20 +139,20 @@ declare namespace image { /** * Enum for image formats. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ enum ImageFormat { /** * YCBCR422 semi-planar format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ YCBCR_422_SP = 1000, /** * JPEG encoding format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ JPEG = 2000 @@ -160,35 +160,34 @@ declare namespace image { /** * The componet type of image. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver - * @systemapi */ enum ComponentType { /** * Luma info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ YUV_Y = 1, /** * Chrominance info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ YUV_U = 2, /** * Chroma info. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ YUV_V = 3, /** * Jpeg type. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ JPEG = 4, @@ -373,35 +372,34 @@ declare namespace image { /** * Describes image color components. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core - * @systemapi */ interface Component { /** * Component type. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly componentType: ComponentType; /** * Row stride. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly rowStride: number; /** * Pixel stride. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly pixelStride: number; /** * Component buffer. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly byteBuffer: ArrayBuffer; @@ -477,7 +475,7 @@ declare namespace image { /** * Creates an ImageReceiver instance. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param width The default width in pixels of the Images that this receiver will produce. * @param height The default height in pixels of the Images that this receiver will produce. @@ -485,7 +483,6 @@ declare namespace image { * {@link ImageFormat} constants. Note that not all formats are supported, like ImageFormat.NV21. * @param capacity The maximum number of images the user will want to access simultaneously. * @return Returns the ImageReceiver instance if the operation is successful; returns null otherwise. - * @systemapi */ function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver; @@ -818,35 +815,34 @@ declare namespace image { /** * Provides basic image operations, including obtaining image information, and reading and writing image data. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core - * @systemapi */ interface Image { /** * Sets or gets the image area to crop, default is size. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ clipRect: Region; /** * Image size. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly size: Size; /** * Image format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core */ readonly format: number; /** * Get component buffer from image and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param componentType The componet type of image. * @param callback Callback used to return the component buffer. @@ -855,7 +851,7 @@ declare namespace image { /** * Get component buffer from image and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param componentType The componet type of image. * @return A Promise instance used to return the component buffer. @@ -864,7 +860,7 @@ declare namespace image { /** * Release current image to receive another and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param callback Callback to return the operation result. */ @@ -872,7 +868,7 @@ declare namespace image { /** * Release current image to receive another and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @return A Promise instance used to return the operation result. */ @@ -881,28 +877,27 @@ declare namespace image { /** * Image receiver object. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver - * @systemapi */ interface ImageReceiver { /** * Image size. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ readonly size: Size; /** * Image capacity. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ readonly capacity: number; /** * Image format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver */ readonly format: ImageFormat; @@ -910,7 +905,7 @@ declare namespace image { /** * get an id which indicates a surface and can be used to set to Camera or other component can receive a surface * and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param callback Callback used to return the surface id. */ @@ -919,7 +914,7 @@ declare namespace image { /** * get an id which indicates a surface and can be used to set to Camera or other component can receive a surface * and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @return A Promise instance used to return the surface id. */ @@ -927,7 +922,7 @@ declare namespace image { /** * Get lasted image from receiver and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param callback Callback used to return the latest image. */ @@ -935,7 +930,7 @@ declare namespace image { /** * Get lasted image from receiver and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @return A Promise instance used to return the latest image. */ @@ -943,7 +938,7 @@ declare namespace image { /** * Get next image from receiver and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param callback Callback used to return the next image. */ @@ -951,7 +946,7 @@ declare namespace image { /** * Get next image from receiver and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @return A Promise instance used to return the next image. */ @@ -959,7 +954,7 @@ declare namespace image { /** * Subscribe callback when receiving an image - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param type Callback used to return the next image. * @param callback Callback used to return image. @@ -968,7 +963,7 @@ declare namespace image { /** * Release image receiver instance and uses a callback to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @param callback Callback to return the operation result. */ @@ -976,7 +971,7 @@ declare namespace image { /** * Release image receiver instance and uses a promise to return the result. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Image.ImageReceiver * @return A Promise instance used to return the operation result. */ diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 5d6692bde378c59d6101b65bcd21832c182375c2..a74858ec7a89fbd838da56c397f375b8e7c159ad 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -58,20 +58,18 @@ declare namespace media { /** * Creates an VideoRecorder instance. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. - * @systemapi */ function createVideoRecorder(callback: AsyncCallback): void; /** * Creates an VideoRecorder instance. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. - * @systemapi */ function createVideoRecorder(): Promise; @@ -610,23 +608,21 @@ declare namespace media { /** * Describes video recorder states. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi */ type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Manages and record video. Before calling an VideoRecorder method, you must use createVideoRecorder() * to create an VideoRecorder instance. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi */ interface VideoRecorder { /** * Prepares for recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. @@ -634,7 +630,7 @@ declare namespace media { prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; /** * Prepares for recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @return A Promise instance used to return when prepare completed. @@ -642,84 +638,84 @@ declare namespace media { prepare(config: VideoRecorderConfig): Promise; /** * get input surface.it must be called between prepare completed and start. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback Callback used to return the input surface id in string. */ getInputSurface(callback: AsyncCallback): void; /** * get input surface. it must be called between prepare completed and start. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return the input surface id in string. */ getInputSurface(): Promise; /** * Starts video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. */ start(callback: AsyncCallback): void; /** * Starts video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when start completed. */ start(): Promise; /** * Pauses video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Resumes video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. */ resume(callback: AsyncCallback): void; /** * Resumes video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when resume completed. */ resume(): Promise; /** * Stops video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Releases resources used for video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when release completed. */ @@ -728,7 +724,7 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. */ @@ -737,14 +733,14 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Listens for video recording error events. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param type Type of the video recording error event to listen for. * @param callback Callback used to listen for the video recording error event. @@ -753,7 +749,7 @@ declare namespace media { /** * video recorder state. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly state: VideoRecordState; @@ -1211,77 +1207,76 @@ declare namespace media { /** * Provides the video recorder profile definitions. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi */ interface VideoRecorderProfile { /** * Indicates the audio bit rate. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioBitrate: number; /** * Indicates the number of audio channels. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioChannels: number; /** * Indicates the audio encoding format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioSampleRate: number; /** * Indicates the output file format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly fileFormat: ContainerFormatType; /** * Indicates the video bit rate. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoBitrate: number; /** * Indicates the video encoding format. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoCodec: CodecMimeType; /** * Indicates the video width. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameWidth: number; /** * Indicates the video height. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameHeight: number; /** * Indicates the video frame rate. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameRate: number; @@ -1289,21 +1284,20 @@ declare namespace media { /** * Enumerates audio source type for recorder. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @systemapi */ enum AudioSourceType { /** * default audio source type. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, @@ -1311,21 +1305,20 @@ declare namespace media { /** * Enumerates video source type for recorder. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @systemapi */ enum VideoSourceType { /** * surface raw data. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, @@ -1333,29 +1326,28 @@ declare namespace media { /** * Provides the video recorder configuration definitions. - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi */ interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . - * @since 8 + * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ - profile:VideoRecorderProfile; + profile: VideoRecorderProfile; /** * video output uri.support two kind of uri now. * format like: scheme + "://" + "context".