1# Media Subsystem Changelog 2 3## cl.multimedia.1 OH_AVPlayerOnError Deprecated 4 5**Access Level** 6 7Public API 8 9**Reason for Change** 10 11The NDK interface is optimized, and the **userData** parameter is added to the callback. 12 13**Change Impact** 14 15This change is a non-compatible change. 16 17Before change: Applications call **OH_AVPlayerOnError** to receive errors through a callback. 18 19After change: Applications call **OH_AVPlayerOnErrorCallback** to receive errors through a callback. 20 21**Start API Level** 22 2311 24 25**Change Since** 26 27OpenHarmony SDK 5.0.0.38 28 29**Adaptation Guide** 30 31Refer to the following example of **OH_AVPlayerOnErrorCallback** for adaptation. 32``` 33struct MyPlayer 34{ 35 const char* url; 36 int32_t errorCode; 37} 38 39void PlayerErrorCallback(OH_AVPlayer *player, int32_t errorCode, const char *errorMsg, void *userData) 40{ 41 MyPlayer* myPlayer = (MyPlayer*)userData; 42 myPlayer->errorCode = errorCode; 43} 44 45void PlayerInfoCallback(OH_AVPlayer *player, AVPlayerOnInfoType type, OH_AVFormat* infoBody, void *userData) 46{ 47 if (type == AV_INFO_TYPE_STATE_CHANGE) { 48 int32_t state, reason; 49 OH_AVFormat_GetIntValue(infoBody, OH_PLAYER_STATE, &state); 50 OH_AVFormat_GetIntValue(infoBody, OH_PLAYER_STATE_CHANGED_REASON, &reason); 51 // use state reason 52 } 53} 54 55int main() 56{ 57 MyPlayer myPlayer; 58 myPlayer.url = "http://localhost/test.mp4"; 59 OH_AVPlayer* player = OH_AVPlayer_Create(); 60 OH_AVPlayer_SetOnErrorCallback(player, PlayerErrorCallback, &myPlayer); 61 OH_AVPlayer_SetOnInfoCallback(player, PlayerInfoCallback, &myPlayer); 62 OH_AVPlayer_SetURLSource(player, myPlayer.url); 63 OH_AVPlayer_Prepare(player); 64 OH_AVPlayer_Play(player); 65 Sleep(10000); 66 OH_AVPlayer_Stop(player); 67 OH_AVPlayer_Release(player); 68} 69 70``` 71## cl.multimedia.2 OH_AVPlayerOnInfo Deprecated 72 73**Access Level** 74 75Public API 76 77**Reason for Change** 78 79The original callback can pass only **extra** of the int32_t type. Some information, such as the width, height, and available bit rate array, cannot be reported. A new callback is introduced to report **infoBody** of the OH_AVFormat type. More information now can be passed. 80 81**Change Impact** 82 83This change is a non-compatible change. 84 85Before change: Applications call **OH_AVPlayerOnInfo** to receive information through a callback. 86 87After change: Applications call **OH_AVPlayerOnInfoCallback** to receive information through a callback. 88 89**Start API Level** 90 9111 92 93**Change Since** 94 95OpenHarmony SDK 5.0.0.38 96 97**Adaptation Guide** 98 99Use **OH_AVPlayerOnInfoCallback** and **OH_AVPlayer_SetOnInfoCallback** to replace the original information callback. 100 101For details about the sample code, see **Adaptation Guide** in [OH_AVPlayerOnError Deprecated](#clmultimedia1-oh_avplayeronerror-deprecated). 102 103## cl.multimedia.3 AVPlayerCallback Deprecated 104 105**Access Level** 106 107Public API 108 109**Reason for Change** 110 111For **AVPlayerCallback**, its two members (**OH_AVPlayerOnInfo** and **OH_AVPlayerOnError**) are deprecated. Therefore, **AVPlayerCallback** is no longer needed. 112 113**Change Impact** 114 115This change is a non-compatible change. 116 117Before change: Applications use **OH_AVPlayerOnInfo**, **OH_AVPlayerOnError**, **AVPlayerCallback**, and **OH_AVPlayer_SetPlayerCallback** to receive information and errors through callbacks. 118 119After change: Applications use **OH_AVPlayerOnInfoCallback**, **OH_AVPlayerOnErrorCallback**, **OH_AVPlayer_SetOnInfoCallback**, and **OH_AVPlayer_SetOnErrorCallback** to receive information and errors through callbacks. 120 121**Start API Level** 122 12311 124 125**Change Since** 126 127OpenHarmony SDK 5.0.0.38 128 129**Adaptation Guide** 130 131Use **OH_AVPlayerOnInfoCallback** and **OH_AVPlayer_SetOnInfoCallback** to replace the original information callbacks. 132 133For details about the sample code, see **Adaptation Guide** in [OH_AVPlayerOnError Deprecated](#clmultimedia1-oh_avplayeronerror-deprecated). 134 135## cl.multimedia.4 OH_AVPlayer_SetPlayerCallback Deprecated 136 137**Access Level** 138 139Public API 140 141**Reason for Change** 142 143The original callback can pass only **extra** of the int32_t type. Some information, such as the width, height, and available bit rate array, cannot be reported. A new callback is introduced to report **infoBody** of the OH_AVFormat type. More information now can be passed. 144 145**OH_AVPlayerOnInfo**, **OH_AVPlayerOnError**, and **AVPlayerCallback** are deprecated, and therefore **OH_AVPlayer_SetPlayerCallback** is no longer needed. 146 147**Change Impact** 148 149This change is a non-compatible change. 150 151Before change: Applications use **OH_AVPlayerOnInfo**, **OH_AVPlayerOnError**, **AVPlayerCallback**, and **OH_AVPlayer_SetPlayerCallback** to receive information and errors. 152 153After change: Applications use **OH_AVPlayerOnInfoCallback**, **OH_AVPlayerOnErrorCallback**, **OH_AVPlayer_SetOnInfoCallback**, and **OH_AVPlayer_SetOnErrorCallback** to receive information and errors. 154 155**Start API Level** 156 15711 158 159**Change Since** 160 161OpenHarmony SDK 5.0.0.38 162 163**Adaptation Guide** 164 165Use **OH_AVPlayerOnInfoCallback** and **OH_AVPlayer_SetOnInfoCallback** to replace the original information callbacks. 166 167For details about the sample code, see **Adaptation Guide** in [OH_AVPlayerOnError Deprecated](#clmultimedia1-oh_avplayeronerror-deprecated). 168 169## cl.multimedia.5 Event Names in ProfessionalPhotoSession.on/off Changed 170 171**Access Level** 172 173System API 174 175**Reason for Change** 176 177The event names are changed to comply with the HAMS specifications. 178 179**Change Impact** 180 181This change is a non-compatible change. 182 183If any of the following event listeners is used in the code, an error is reported during compilation: 184 185on(type: 'isoInfo', callback: AsyncCallback\<IsoInfo>): void 186off(type: 'isoInfo', callback?: AsyncCallback\<IsoInfo>): void 187on(type: 'exposureInfo', callback: AsyncCallback\<ExposureInfo>): void 188off(type: 'exposureInfo', callback?: AsyncCallback\<ExposureInfo>): void 189on(type: 'apertureInfo', callback: AsyncCallback\<ApertureInfo>): void 190off(type: 'apertureInfo', callback?: AsyncCallback\<ApertureInfo>): void 191on(type: 'luminationInfo', callback: AsyncCallback\<LuminationInfo>): void 192off(type: 'luminationInfo', callback?: AsyncCallback\<LuminationInfo>): void 193 194 195**Start API Level** 196 19712 198 199**Change Since** 200 201OpenHarmony SDK 5.0.0.38 202 203**Key API/Component Changes** 204 205| API | Before Change | After Change | 206| :----------------------------: | :----------------------------------: | :---------------------------: | 207| on(type: 'isoInfo', callback: AsyncCallback\<IsoInfo>): void | type: 'isoInfo' | type: 'isoInfoChange' | 208| off(type: 'isoInfo', callback?: AsyncCallback\<IsoInfo>): void | type: 'isoInfo' | type: 'isoInfoChange' | 209| on(type: 'exposureInfo', callback: AsyncCallback\<ExposureInfo>): void | type: 'exposureInfo' | type: 'exposureInfoChange' | 210| off(type: 'exposureInfo', callback?: AsyncCallback\<ExposureInfo>): void | type: 'exposureInfo' | type: 'exposureInfoChange' | 211| on(type: 'apertureInfo', callback: AsyncCallback\<ApertureInfo>): void | type: 'apertureInfo' | type: 'apertureInfoChange' | 212| off(type: 'apertureInfo', callback?: AsyncCallback\<ApertureInfo>): void | type: 'apertureInfo' | type: 'apertureInfoChange' | 213| on(type: 'luminationInfo', callback: AsyncCallback\<LuminationInfo>): void | type: 'luminationInfo' | type: 'luminationInfoChange' | 214| off(type: 'luminationInfo', callback?: AsyncCallback\<LuminationInfo>): void | type: 'luminationInfo' | type: 'luminationInfoChange' | 215 216**Adaptation Guide** 217 218Change the value of the **type** parameter to adapt to the new event names. 219 220## cl.multimedia.6 Event Names in ProfessionalVideoSession.on/off Changed 221 222**Access Level** 223 224System API 225 226**Reason for Change** 227 228The event names are changed to comply with the HAMS specifications. 229 230**Change Impact** 231 232This change is a non-compatible change. 233 234If any of the following event listeners is used in the code, an error is reported during compilation: 235 236on(type: 'isoInfo', callback: AsyncCallback\<IsoInfo>): void 237off(type: 'isoInfo', callback?: AsyncCallback\<IsoInfo>): void 238on(type: 'exposureInfo', callback: AsyncCallback\<ExposureInfo>): void 239off(type: 'exposureInfo', callback?: AsyncCallback\<ExposureInfo>): void 240on(type: 'apertureInfo', callback: AsyncCallback\<ApertureInfo>): void 241off(type: 'apertureInfo', callback?: AsyncCallback\<ApertureInfo>): void 242on(type: 'luminationInfo', callback: AsyncCallback\<LuminationInfo>): void 243off(type: 'luminationInfo', callback?: AsyncCallback\<LuminationInfo>): void 244 245 246**Start API Level** 247 24812 249 250**Change Since** 251 252OpenHarmony SDK 5.0.0.38 253 254**Key API/Component Changes** 255 256| API | Before Change | After Change | 257| :----------------------------: | :----------------------------------: | :---------------------------: | 258| on(type: 'isoInfo', callback: AsyncCallback\<IsoInfo>): void | type: 'isoInfo' | type: 'isoInfoChange' | 259| off(type: 'isoInfo', callback?: AsyncCallback\<IsoInfo>): void | type: 'isoInfo' | type: 'isoInfoChange' | 260| on(type: 'exposureInfo', callback: AsyncCallback\<ExposureInfo>): void | type: 'exposureInfo' | type: 'exposureInfoChange' | 261| off(type: 'exposureInfo', callback?: AsyncCallback\<ExposureInfo>): void | type: 'exposureInfo' | type: 'exposureInfoChange' | 262| on(type: 'apertureInfo', callback: AsyncCallback\<ApertureInfo>): void | type: 'apertureInfo' | type: 'apertureInfoChange' | 263| off(type: 'apertureInfo', callback?: AsyncCallback\<ApertureInfo>): void | type: 'apertureInfo' | type: 'apertureInfoChange' | 264| on(type: 'luminationInfo', callback: AsyncCallback\<LuminationInfo>): void | type: 'luminationInfo' | type: 'luminationInfoChange' | 265| off(type: 'luminationInfo', callback?: AsyncCallback\<LuminationInfo>): void | type: 'luminationInfo' | type: 'luminationInfoChange' | 266 267**Adaptation Guide** 268 269Change the value of the **type** parameter to adapt to the new event names. 270