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