1e41f4b71Sopenharmony_ci# Multimedia Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## c1.multimedia.1 APIs setAudioParameter and getAudioParameter of the AudioManager Class in ohos.multimedia.audio Are Deprecated 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci**Access Level** 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciPublic API 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Reason for Change** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciThird-party applications and audio chips can no longer modify configurations through custom parameters. Instead, the configuration modification is now controlled by the system. Dedicated APIs are provided for common functionalities. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci**Change Impact** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciThis change is a non-compatible change. You are advised to use new APIs. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Deprecated Since** 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Deprecated APIs** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciIn the **AudioManager** class: 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_cisetAudioParameter(key: string, value: string, callback: AsyncCallback<void>): void; 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_cisetAudioParameter(key: string, value: string): Promise<void>; 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_cigetAudioParameter(key: string, callback: AsyncCallback<string>): void; 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_cigetAudioParameter(key: string): Promise<string>; 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Adaptation Guide** 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciFor system applications, use the alternative APIs according to the deprecated API hints. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_cisetExtraParameters(mainKey: string, kvpairs: Record<string, string>): Promise<void>; 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_cigetExtraParameters(mainKey: string, subKeys?: Array<string>): Promise<Record<string, string>>; 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ciIn the preceding APIs, **mainKey** is the same as the original parameter **key**, and **kvpairs** is the key-value pairs in the string of the original parameter **value**. 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ciFor third-party applications, the preceding APIs are not available. Use the public APIs of the **AudioManager** class as required. 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ciThe deprecated APIs will be retained for five more SDK versions. Make your adaptation plan as required. 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci## c1.multimedia.2 API setMicrophoneMute of the AudioVolumeGroupManager Class in ohos.multimedia.audio Is Deprecated 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci**Access Level** 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ciPublic API 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci**Reason for Change** 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ciThe **setMicrophoneMute** API is a public API but requires the **ohos.permission.MANAGE_AUDIO_CONFIG** permission, which cannot be granted to third-party applications. According to the SDK specifications, the API is changed to a system API. 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci**Change Impact** 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ciThis change is a non-compatible change. You are advised to use new APIs. 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci**Deprecated Since** 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci**Deprecated APIs** 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ciIn the **AudioVolumeGroupManager** class: 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_cisetMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void; 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_cisetMicrophoneMute(mute: boolean): Promise<void>; 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci**Adaptation Guide** 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ciFor system applications, use the alternative API according to the deprecated API hints. The alternative API provides the same functionality. 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_cisetMicMute(mute: boolean): Promise<void>; 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ciThird-party applications cannot obtain the **ohos.permission.MANAGE_AUDIO_CONFIG** permission and therefore cannot actually use the original API. This change has no impact and requires no adaptation. 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ciThe deprecated APIs will be retained for five more SDK versions. Make your adaptation plan as required. 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci## c1.multimedia.3 Behavior of the usages Attribute of CaptureFilterOptions in ohos.multimedia.audio Is Changed 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci**Access Level** 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ciPublic API 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci**Reason for Change** 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ciThe **usages** attribute is used to filter audio clips by usage during internal audio recording. When the attribute is **STREAM_USAGE_VOICE_COMMUNICATION**, the application must have the **ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO** permission, which cannot be granted to third-party applications. According to the SDK specifications, the attribute must be removed from the public API. 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci**Change Impact** 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ciThis change is a non-compatible change. You are advised to use new APIs. 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci**Change Since** 98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci**Key API/Component Changes** 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ciBefore change: 104e41f4b71Sopenharmony_ci``` 105e41f4b71Sopenharmony_ci/** 106e41f4b71Sopenharmony_ci * Filter by stream usages. If you want to capture voice streams, additional permission is needed. 107e41f4b71Sopenharmony_ci * @permission ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO 108e41f4b71Sopenharmony_ci * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 109e41f4b71Sopenharmony_ci * @since 10 110e41f4b71Sopenharmony_ci */ 111e41f4b71Sopenharmony_ci``` 112e41f4b71Sopenharmony_ciAn application can use **STREAM_USAGE_VOICE_COMMUNICATION** to filter audio clips, under the prerequisites that it has the **ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO** permission. 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ciAfter change: 115e41f4b71Sopenharmony_ci``` 116e41f4b71Sopenharmony_ci/** 117e41f4b71Sopenharmony_ci * Filter by stream usages. But not allow to capture voice streams. 118e41f4b71Sopenharmony_ci * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 119e41f4b71Sopenharmony_ci * @since 11 120e41f4b71Sopenharmony_ci */ 121e41f4b71Sopenharmony_ci``` 122e41f4b71Sopenharmony_ciApplications can no longer use **STREAM_USAGE_VOICE_COMMUNICATION** to filter audio clips, and the declaration of the **ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO** permission is deleted. When an application without this permission uses **STREAM_USAGE_VOICE_COMMUNICATION**, an **AudioCapturer** object cannot be created and the **ERROR_SYSTEM** error is returned. 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ci**Adaptation Guide** 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciThird-party applications cannot obtain the permission and therefore cannot actually use **STREAM_USAGE_VOICE_COMMUNICATION**. This change has no impact and requires no adaptation. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ciSystem applications cannot use **STREAM_USAGE_VOICE_COMMUNICATION** even if they have the **ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO** permission. Therefore, remove **STREAM_USAGE_VOICE_COMMUNICATION** from your code. 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci## c1.multimedia.4 APIs for Subscribing to or Unsubscribing from the interrupt Event of the AudioManager Class in ohos.multimedia.audio Is Deprecated 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**Access Level** 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ciPublic API 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci**Reason for Change** 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ciIn SDK 10, the system uses the built-in focus mode. For details, see [Audio Playback Concurrency Policy](../../../application-dev/media/audio-playback-concurrency.md). 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ciThe APIs are related to the external focus and cannot be used to preempt the built-in focus. As such, they are deprecated. 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ci**Change Impact** 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ciThis change is a non-compatible change. You are advised to use new APIs. 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_ci**Deprecated Since** 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 149e41f4b71Sopenharmony_ci 150e41f4b71Sopenharmony_ci**Deprecated APIs** 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ciIn the **AudioManager** class: 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_cion(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback<InterruptAction>): void; 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_cioff(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback<InterruptAction>): void; 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci**Adaptation Guide** 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ciImplement concurrency policy control for audio playback based on the built-in focus mode. For details, see [Audio Playback Concurrency Policy](../../../application-dev/media/audio-playback-concurrency.md). 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci## c1.multimedia.5 API write of the AudioRenderer Class and read of the AudioCapturer Class in ohos.multimedia.audio Are Deprecated 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci**Access Level** 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ciPublic API 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_ci**Reason for Change** 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ciThe APIs for subscribing to the **'writeData'** and **'readData'** events are added to the **AudioRenderer** and **AudioCapturer** classes. Using the subscription APIs, you no longer need to manage data processing moments, avoiding the underrun/overrun problem caused by inaccurate data rotation time. 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci**Change Impact** 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ciThis change is a non-compatible change. You are advised to use new APIs. 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ci**Deprecated Since** 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_ci**Deprecated APIs** 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ciIn the **AudioRenderer** class: 183e41f4b71Sopenharmony_ci 184e41f4b71Sopenharmony_ciwrite(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 185e41f4b71Sopenharmony_ci 186e41f4b71Sopenharmony_ciwrite(buffer: ArrayBuffer): Promise<number>; 187e41f4b71Sopenharmony_ci 188e41f4b71Sopenharmony_ciIn the **AudioCapturer** class: 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ciread(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer>): void; 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ciread(size: number, isBlockingRead: boolean): Promise<ArrayBuffer>; 193e41f4b71Sopenharmony_ci 194e41f4b71Sopenharmony_ci**Adaptation Guide** 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ciUse the new APIs according to the deprecated API hints. 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ciNew **AudioRenderer** APIs: 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_cion(type: 'writeData', callback: Callback<ArrayBuffer>): void; 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_cioff(type: 'writeData', callback?: Callback<ArrayBuffer>): void; 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ciWhen the callback is received, the application needs to write the playback data to the ArrayBuffer. After the callback is complete, the system automatically obtains the data from the ArrayBuffer for output. 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ciNew **AudioCapturer** APIs: 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_cion(type: 'readData', callback: Callback<ArrayBuffer>): void; 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_cioff(type: 'readData', callback?: Callback<ArrayBuffer>): void; 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ciWhen the callback is received, the application needs to read the recording data from the ArrayBuffer. After the callback is complete, the system writes the subsequent recording data in the ArrayBuffer to prepare for the next callback trigger. 213e41f4b71Sopenharmony_ci 214e41f4b71Sopenharmony_ciThe deprecated APIs will be retained for five more SDK versions. Make your adaptation plan as required. 215e41f4b71Sopenharmony_ci 216e41f4b71Sopenharmony_ci## c1.multimedia.6 Obtaining Preferred Recording Device Behavior in ohos.multimedia.audio Is Changed in the Internal Recording Scenario 217e41f4b71Sopenharmony_ci 218e41f4b71Sopenharmony_ci**Access Level** 219e41f4b71Sopenharmony_ci 220e41f4b71Sopenharmony_ciPublic API 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ci**Reason for Change** 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ciIn the internal recording scenario, no microphone is used for recording. The correct device type should be returned. 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci**Change Impact** 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ciThis change is a compatible change. No adaptation is required. 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci**Change Since** 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**Key API/Component Changes** 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ciIn the **AudioRoutingManager** class: 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_cigetPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_cigetPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise<AudioDeviceDescriptors>; 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ciBefore change: 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ciWhen the input type is **SOURCE_TYPE_PLAYBACK_CAPTURE**, **AudioDeviceDescriptor** of a **DeviceType.MIC** device is returned. 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ciAfter change: 247e41f4b71Sopenharmony_ci 248e41f4b71Sopenharmony_ciWhen the input type is **SOURCE_TYPE_PLAYBACK_CAPTURE**, **AudioDeviceDescriptor** of a **DeviceType.INVALID** device is returned. 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci**Adaptation Guide** 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ciThe return value in the internal recording scenario is corrected. No adaptation is required. 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci## c1.multimedia.7 Behavior of Subscription APIs of the AudioManager Class in ohos.multimedia.audio Is Changed 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_ci**Access Level** 257e41f4b71Sopenharmony_ci 258e41f4b71Sopenharmony_ciPublic API 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ci**Reason for Change** 261e41f4b71Sopenharmony_ci 262e41f4b71Sopenharmony_ciThe implementation of the subscription APIs does not comply with the general subscription API specifications, and the subscription callbacks may be overwritten. 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**Change Impact** 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ciIf an application makes multiple subscriptions, all subscribed-to callbacks will be traversed and triggered in sequence when the subscribed-to event occurs. 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_ci**Change Since** 269e41f4b71Sopenharmony_ci 270e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 271e41f4b71Sopenharmony_ci 272e41f4b71Sopenharmony_ci**Key API/Component Changes** 273e41f4b71Sopenharmony_ci 274e41f4b71Sopenharmony_ciIn the **AudioVolumeManager** class: 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_cion(type: 'volumeChange', callback: Callback<VolumeEvent>): void; 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ciIn the **AudioVolumeGroupManager** class: 279e41f4b71Sopenharmony_ci 280e41f4b71Sopenharmony_cion(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void; 281e41f4b71Sopenharmony_ci 282e41f4b71Sopenharmony_cion(type: 'micStateChange', callback: Callback<MicStateChangeEvent>): void; 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ciIn the **AudioRoutingManager** class: 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_cion(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback<DeviceChangeAction>): void; 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ciIn the **AudioStreamManager** class: 289e41f4b71Sopenharmony_ci 290e41f4b71Sopenharmony_cion(type: 'audioRendererChange', callback: Callback<AudioRendererChangeInfoArray>): void; 291e41f4b71Sopenharmony_ci 292e41f4b71Sopenharmony_cion(type: 'audioCapturerChange', callback: Callback<AudioCapturerChangeInfoArray>): void; 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ciBefore change: 295e41f4b71Sopenharmony_ci 296e41f4b71Sopenharmony_ciWhen an event is subscribed to for multiple times, only the last callback is triggered. 297e41f4b71Sopenharmony_ci 298e41f4b71Sopenharmony_ciAfter change: 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_ciWhen an event is subscribed to for multiple times, all callbacks that are not unsubscribed from are triggered. 301e41f4b71Sopenharmony_ci 302e41f4b71Sopenharmony_ci**Adaptation Guide** 303e41f4b71Sopenharmony_ci 304e41f4b71Sopenharmony_ciIf an event is subscribed to only once, no adaptation is required. 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ciIf an event is subscribed to for multiple times, no adaptation is required if you want all subscribed-to callbacks will be traversed and triggered, no adaptation is required. 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ciIf an event is subscribed to for multiple times, but you only want the last callback to be triggered, use **off** to unsubscribe from the previous callbacks. 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci## c1.multimedia.8 Error Code Is Added for the System API availableDevice in ohos.multimedia.audio 311e41f4b71Sopenharmony_ci 312e41f4b71Sopenharmony_ci**Access Level** 313e41f4b71Sopenharmony_ci 314e41f4b71Sopenharmony_ciSystem API 315e41f4b71Sopenharmony_ci 316e41f4b71Sopenharmony_ci**Reason for Change** 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_ciThe corresponding error code is added to the system API. 319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci**Change Impact** 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ciThis change is a compatible change. No adaptation is required. 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ci**Change Since** 325e41f4b71Sopenharmony_ci 326e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci**Key API/Component Changes** 329e41f4b71Sopenharmony_ci 330e41f4b71Sopenharmony_ciIn the **AudioRoutingManager** class: 331e41f4b71Sopenharmony_ci 332e41f4b71Sopenharmony_cigetAvailableDevices(deviceUsage: DeviceUsage): AudioDeviceDescriptors; 333e41f4b71Sopenharmony_ci 334e41f4b71Sopenharmony_cion(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback<DeviceChangeAction>): void; 335e41f4b71Sopenharmony_ci 336e41f4b71Sopenharmony_cioff(type: 'availableDeviceChange', callback?: Callback<DeviceChangeAction>): void; 337e41f4b71Sopenharmony_ci 338e41f4b71Sopenharmony_ciBefore change: 339e41f4b71Sopenharmony_ci 340e41f4b71Sopenharmony_ciWhen a third-party application calls these system APIs, the default result is returned but the subscription does not take effect. 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_ciAfter change: 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ciWhen a third-party application calls these system APIs, error code 202 is thrown. 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci**Adaptation Guide** 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ciFor system applications, no adaptation is required. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ciFor third-party applications, they should not use system APIs. 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ci## c1.multimedia.9 Permission Statement Is Added for the createPlayer API in ohos.multimedia.audioHaptic 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ci**Access Level** 355e41f4b71Sopenharmony_ci 356e41f4b71Sopenharmony_ciPublic API 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ci**Reason for Change** 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci**AudioHapticPlayer** supports the haptic feedback, which depends on the **ohos.permission.VIBRATE** permission. 361e41f4b71Sopenharmony_ci 362e41f4b71Sopenharmony_ci**Change Impact** 363e41f4b71Sopenharmony_ci 364e41f4b71Sopenharmony_ciThis change is a non-compatible change. To use the haptic feedback, your application must obtain the permission. 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ci**Change Since** 367e41f4b71Sopenharmony_ci 368e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 369e41f4b71Sopenharmony_ci 370e41f4b71Sopenharmony_ci**Key API/Component Changes** 371e41f4b71Sopenharmony_ci 372e41f4b71Sopenharmony_ciIn the **AudioHapticManager** class: 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_cicreatePlayer(id: number, options?: AudioHapticPlayerOptions): Promise<AudioHapticPlayer>; 375e41f4b71Sopenharmony_ci 376e41f4b71Sopenharmony_ciBefore change: 377e41f4b71Sopenharmony_ci 378e41f4b71Sopenharmony_ci``` 379e41f4b71Sopenharmony_ci/** 380e41f4b71Sopenharmony_ci * Create an audio haptic player. This method uses a promise to return the result. 381e41f4b71Sopenharmony_ci * @param { number } id - Source id. 382e41f4b71Sopenharmony_ci * @param { AudioHapticPlayerOptions } options - Options when creating audio haptic player. 383e41f4b71Sopenharmony_ci * @returns { Promise<AudioHapticPlayer> } Promise used to return the result. 384e41f4b71Sopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. 385e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400102 - Operation not allowed. 386e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 387e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400106 - Unsupport format. 388e41f4b71Sopenharmony_ci * @syscap SystemCapability.Multimedia.AudioHaptic.Core 389e41f4b71Sopenharmony_ci * @since 11 390e41f4b71Sopenharmony_ci */ 391e41f4b71Sopenharmony_ci``` 392e41f4b71Sopenharmony_ci 393e41f4b71Sopenharmony_ciThere is no permission statement. However, applications without the permission cannot trigger the haptic feedback. Only audio playback is supported. 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ciAfter change: 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci``` 398e41f4b71Sopenharmony_ci/** 399e41f4b71Sopenharmony_ci * Create an audio haptic player. This method uses a promise to return the result. If haptics is needed, caller 400e41f4b71Sopenharmony_ci * should have the permission of ohos.permission.VIBRATE. 401e41f4b71Sopenharmony_ci * @permission ohos.permission.VIBRATE 402e41f4b71Sopenharmony_ci * @param { number } id - Source id. 403e41f4b71Sopenharmony_ci * @param { AudioHapticPlayerOptions } options - Options when creating audio haptic player. 404e41f4b71Sopenharmony_ci * @returns { Promise<AudioHapticPlayer> } Promise used to return the result. 405e41f4b71Sopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 406e41f4b71Sopenharmony_ci * @throws { BusinessError } 401 - The parameter check failed. 407e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400102 - Operation not allowed. 408e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 409e41f4b71Sopenharmony_ci * @throws { BusinessError } 5400106 - Unsupport format. 410e41f4b71Sopenharmony_ci * @syscap SystemCapability.Multimedia.AudioHaptic.Core 411e41f4b71Sopenharmony_ci * @since 11 412e41f4b71Sopenharmony_ci */ 413e41f4b71Sopenharmony_ci``` 414e41f4b71Sopenharmony_ci 415e41f4b71Sopenharmony_ciThe **ohos.permission.VIBRATE** permission statement and permission usage comments are provided. 416e41f4b71Sopenharmony_ci 417e41f4b71Sopenharmony_ci**Adaptation Guide** 418e41f4b71Sopenharmony_ci 419e41f4b71Sopenharmony_ciThe API behavior is not changed. To enable the haptic feedback, an application must request the **ohos.permission.VIBRATE** permission. 420e41f4b71Sopenharmony_ci 421e41f4b71Sopenharmony_ci## c1.multimedia.10 Error Code Implementation of the AudioManager Class in ohos.multimedia.audio Is Corrected 422e41f4b71Sopenharmony_ci 423e41f4b71Sopenharmony_ci**Access Level** 424e41f4b71Sopenharmony_ci 425e41f4b71Sopenharmony_ciPublic API 426e41f4b71Sopenharmony_ci 427e41f4b71Sopenharmony_ci**Reason for Change** 428e41f4b71Sopenharmony_ci 429e41f4b71Sopenharmony_ciThe error code is declared as a number, but the type string is used in the implementation. 430e41f4b71Sopenharmony_ci 431e41f4b71Sopenharmony_ci**Change Impact** 432e41f4b71Sopenharmony_ci 433e41f4b71Sopenharmony_ciThe declaration remains unchanged. If your code complies with the API definition, no adaptation is required. 434e41f4b71Sopenharmony_ci 435e41f4b71Sopenharmony_ci**Change Since** 436e41f4b71Sopenharmony_ci 437e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.6.5 438e41f4b71Sopenharmony_ci 439e41f4b71Sopenharmony_ci**Key API/Component Changes** 440e41f4b71Sopenharmony_ci 441e41f4b71Sopenharmony_ciIn the **AudioManager** class: 442e41f4b71Sopenharmony_ci 443e41f4b71Sopenharmony_cigetVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 444e41f4b71Sopenharmony_ci 445e41f4b71Sopenharmony_cigetVolume(volumeType: AudioVolumeType): Promise<number>; 446e41f4b71Sopenharmony_ci 447e41f4b71Sopenharmony_cigetMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 448e41f4b71Sopenharmony_ci 449e41f4b71Sopenharmony_cigetMaxVolume(volumeType: AudioVolumeType): Promise<number>; 450e41f4b71Sopenharmony_ci 451e41f4b71Sopenharmony_ciisMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 452e41f4b71Sopenharmony_ci 453e41f4b71Sopenharmony_ciisMute(volumeType: AudioVolumeType): Promise<boolean>; 454e41f4b71Sopenharmony_ci 455e41f4b71Sopenharmony_ciBefore change: 456e41f4b71Sopenharmony_ci 457e41f4b71Sopenharmony_ciThe value of **BusinessError.code** returned by the APIs asynchronously is of the string type. 458e41f4b71Sopenharmony_ci 459e41f4b71Sopenharmony_ciAfter change: 460e41f4b71Sopenharmony_ci 461e41f4b71Sopenharmony_ciThe value of **BusinessError.code** returned by the APIs asynchronously is of the number type. 462e41f4b71Sopenharmony_ci 463e41f4b71Sopenharmony_ci**Adaptation Guide** 464e41f4b71Sopenharmony_ci 465e41f4b71Sopenharmony_ciThe declaration is not changed. The error code is of the number type. 466e41f4b71Sopenharmony_ci 467e41f4b71Sopenharmony_ciIf you found that the returned error code does not comply with the definition and used the string for verification, adapt to the original API definition and use the **AudioErrors** error code of the number type. 468