1e41f4b71Sopenharmony_ci# Multimedia Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.multimedia.1 Implementation of Error Code 5400102 Corrected 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciIf a parameter passed in to an API is incorrect or an API is called in an incorrect state (for example, **play()** is called before **load()** is complete), the API should throw an error according to the API declaration. 6e41f4b71Sopenharmony_ciHowever, certain APIs that contain input parameters and is of API version 10 do not throw errors as expected. This issue is rectified. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**Change Impact** 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ciThe scenario where these APIs are incorrectly used is affected. 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ciThe following lists the API prototypes involved in this change. 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci```ts 15e41f4b71Sopenharmony_ciload(uri: string): Promise<number> 16e41f4b71Sopenharmony_ciload(fd: number, offset: number, length: number): Promise<number> 17e41f4b71Sopenharmony_ciplay(soundID: number, params: PlayParameters, callback: AsyncCallback<number>): void 18e41f4b71Sopenharmony_ciplay(soundID: number, callback: AsyncCallback<number>): void 19e41f4b71Sopenharmony_ciplay(soundID: number, params?: PlayParameters): Promise<number> 20e41f4b71Sopenharmony_cistop(streamID: number, callback: AsyncCallback<void>): void 21e41f4b71Sopenharmony_cistop(streamID: number): Promise<void> 22e41f4b71Sopenharmony_cisetLoop(streamID: number, loop: number): Promise<void> 23e41f4b71Sopenharmony_cisetPriority(streamID: number, priority: number): Promise<void> 24e41f4b71Sopenharmony_cisetRate(streamID: number, rate: audio.AudioRendererRate): Promise<void> 25e41f4b71Sopenharmony_cisetVolume(streamID: number, leftVolume: number, rightVolume: number): Promise<void> 26e41f4b71Sopenharmony_ciunload(soundID: number): Promise<void> 27e41f4b71Sopenharmony_ci``` 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciError code 5400102 is declared in these APIs. 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci```ts 32e41f4b71Sopenharmony_ci@throws { BusinessError } 5400102 - Operation not allowed. 33e41f4b71Sopenharmony_ci``` 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**Adaptation Guide** 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If error code 5400102 is thrown, call the API according to the API definition. 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci## cl.multimedia.2 Implementation of Error Code 5400103 Corrected 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ciIf an I/O error occurs during the interaction between the media module and other modules, the API should throw an error according to the API declaration. 42e41f4b71Sopenharmony_ciHowever, certain APIs that contain input parameters and is of API version 10 do not throw errors as expected. This issue is rectified. 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci**Change Impact** 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ciThe scenario where these APIs are incorrectly used is affected. 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ciThe following lists the API prototypes involved in this change. 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci```ts 51e41f4b71Sopenharmony_ciload(uri: string): Promise<number> 52e41f4b71Sopenharmony_ciload(fd: number, offset: number, length: number, callback: AsyncCallback<number>): void 53e41f4b71Sopenharmony_ciload(fd: number, offset: number, length: number): Promise<number> 54e41f4b71Sopenharmony_ciunload(soundID: number): Promise<void> 55e41f4b71Sopenharmony_ci``` 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ciError code 5400103 is declared in these APIs. 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci```ts 60e41f4b71Sopenharmony_ci@throws { BusinessError } 5400103 - I/O error. 61e41f4b71Sopenharmony_ci``` 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci**Adaptation Guide** 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If error code 5400103 is thrown, call the API according to the API definition. 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci## cl.multimedia.3 Implementation of Error Code 5400105 Corrected 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ciIf the playback service is dead when an API is called, the API should throw an error according to the API declaration. 70e41f4b71Sopenharmony_ciHowever, certain APIs that contain input parameters and is of API version 10 do not throw errors as expected. This issue is rectified. 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Change Impact** 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ciThe scenario where these APIs are incorrectly used is affected. 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ciThe following lists the API prototypes involved in this change. 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci```ts 79e41f4b71Sopenharmony_ciload(uri: string): Promise<number> 80e41f4b71Sopenharmony_ciload(fd: number, offset: number, length: number): Promise<number> 81e41f4b71Sopenharmony_ciplay(soundID: number, params?: PlayParameters): Promise<number> 82e41f4b71Sopenharmony_cistop(streamID: number): Promise<void> 83e41f4b71Sopenharmony_cisetLoop(streamID: number, loop: number): Promise<void> 84e41f4b71Sopenharmony_cisetPriority(streamID: number, priority: number): Promise<void> 85e41f4b71Sopenharmony_cisetRate(streamID: number, rate: audio.AudioRendererRate): Promise<void> 86e41f4b71Sopenharmony_cisetVolume(streamID: number, leftVolume: number, rightVolume: number): Promise<void> 87e41f4b71Sopenharmony_ciunload(soundID: number): Promise<void> 88e41f4b71Sopenharmony_cirelease(): Promise<void> 89e41f4b71Sopenharmony_ci``` 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ciError code 5400105 is declared in these APIs. 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci```ts 94e41f4b71Sopenharmony_ci@throws { BusinessError } 5400105 - Service died. 95e41f4b71Sopenharmony_ci``` 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci**Adaptation Guide** 98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If error code 5400105 is thrown, call the API according to the API definition. 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci## cl.multimedia.4 Implementation of SoundPool.on('loadComplete') Corrected 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ciAccording to the API definition, if an error occurs during sound loading, **on('error')** is triggered to throw the error. There is no need for the system to throw errors in **on('loadComplete')**. 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci**Change Impact** 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ciThe scenario where the API is incorrectly used is affected. 108e41f4b71Sopenharmony_ci 109e41f4b71Sopenharmony_ciThe following lists the API prototype involved in this change. 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci```ts 112e41f4b71Sopenharmony_cion(type: 'loadComplete', callback: Callback<number>): void 113e41f4b71Sopenharmony_ci``` 114e41f4b71Sopenharmony_ci 115e41f4b71Sopenharmony_ciNo error code is declared in this API. 116e41f4b71Sopenharmony_ci 117e41f4b71Sopenharmony_ci```ts 118e41f4b71Sopenharmony_ci@param {'loadComplete'} type Type of the play finish event to listen for. 119e41f4b71Sopenharmony_ci@param {Callback<number>} callback Callback used to listen for load result event 120e41f4b71Sopenharmony_ci@syscap SystemCapability.Multimedia.Media.SoundPool 121e41f4b71Sopenharmony_ci@since 10 122e41f4b71Sopenharmony_ci``` 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ci**Adaptation Guide** 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If an error occurs during sounds loading, **on('error')** will be triggered to throw the error. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci## cl.multimedia.5 Implementation of SoundPool.on('playFinished') Corrected 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ciAccording to the API definition, if an error occurs during sound playback, **on('error')** is triggered to throw the error. There is no need for the system to throw errors in **on('playFinished')**. 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**Change Impact** 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ciThe scenario where the API is incorrectly used is affected. 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ciThe following lists the API prototype involved in this change. 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ci```ts 139e41f4b71Sopenharmony_cion(type: 'playFinished', callback: Callback<void>): void 140e41f4b71Sopenharmony_ci``` 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ciNo error code is declared in this API. 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ci```ts 145e41f4b71Sopenharmony_ci@param {'loadComplete'} type Type of the play finish event to listen for. 146e41f4b71Sopenharmony_ci@param {Callback<number>} callback Callback used to listen for load result event 147e41f4b71Sopenharmony_ci@syscap SystemCapability.Multimedia.Media.SoundPool 148e41f4b71Sopenharmony_ci@since 10 149e41f4b71Sopenharmony_ci``` 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci**Adaptation Guide** 152e41f4b71Sopenharmony_ci 153e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If an error occurs during sound playback, **on('error')** will be triggered to throw the error. 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci## cl.multimedia.6 Implementation of Error Code 401 Corrected 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_ciIf a mandatory parameter is not passed in to an API, the API should throw an error according to the API declaration. 158e41f4b71Sopenharmony_ciHowever, certain APIs that contain input parameters and is of API version 10 do not throw errors as expected. This issue is rectified. 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci**Change Impact** 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ciThe scenario where these APIs are incorrectly used is affected. 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ciThe following lists the API prototypes involved in this change. 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ci```ts 167e41f4b71Sopenharmony_ciplay(soundID: number, params: PlayParameters, callback: AsyncCallback<number>): void; 168e41f4b71Sopenharmony_ciplay(soundID: number, callback: AsyncCallback<number>): void; 169e41f4b71Sopenharmony_ciplay(soundID: number, params?: PlayParameters): Promise<number>; 170e41f4b71Sopenharmony_cistop(streamID: number, callback: AsyncCallback<void>): void; 171e41f4b71Sopenharmony_cistop(streamID: number): Promise<void>; 172e41f4b71Sopenharmony_cisetLoop(streamID: number, loop: number, callback: AsyncCallback<void>): void; 173e41f4b71Sopenharmony_cisetLoop(streamID: number, loop: number): Promise<void>; 174e41f4b71Sopenharmony_cisetPriority(streamID: number, priority: number, callback: AsyncCallback<void>): void; 175e41f4b71Sopenharmony_cisetPriority(streamID: number, priority: number): Promise<void>; 176e41f4b71Sopenharmony_cisetRate(streamID: number, rate: audio.AudioRendererRate, callback: AsyncCallback<void>): void; 177e41f4b71Sopenharmony_cisetRate(streamID: number, rate: audio.AudioRendererRate): Promise<void>; 178e41f4b71Sopenharmony_cisetVolume(streamID: number, leftVolume: number, rightVolume: number, callback: AsyncCallback<void>): void; 179e41f4b71Sopenharmony_cisetVolume(streamID: number, leftVolume: number, rightVolume: number): Promise<void>; 180e41f4b71Sopenharmony_ci``` 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ciError code 401 is declared in these APIs. 183e41f4b71Sopenharmony_ci 184e41f4b71Sopenharmony_ci```ts 185e41f4b71Sopenharmony_ci@throws { BusinessError } 401 - The parameter check failed. Return by callback. 186e41f4b71Sopenharmony_ci``` 187e41f4b71Sopenharmony_ci 188e41f4b71Sopenharmony_ci**Adaptation Guide** 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ciIf the API is called correctly, no adaptation is required. If error code 401 is thrown, pass in the mandatory parameters and call the API according to the API definition. 191