This topic describes how to upgrade ApsaraVideo Player SDK for Android from a version that is earlier than V4.5.0 to V4.5.0. This topic also describes major changes in ApsaraVideo Player SDK V4.5.0 for Android.
Background information
Upgrade path
This topic describes how to upgrade a version to V4.5.0. V3.4.10 is used in this example. ApsaraVideo Player SDK V4.5.0 for Android and later differ only in class names, methods, and version numbers. For information about API operation changes when V4.5.0 is upgraded to V5.1.4, see Upgrade ApsaraVideo Player SDK for Android from V4.5.0 to V5.1.4 or later. If you want to upgrade a version that is earlier than V4.5.0 to V5.1.4, submit a ticket to contact Alibaba Cloud technical support.
Changes in local dependencies
If you use the local dependency mode to integrate an ApsaraVideo Player SDK for Android, you need to replace local dependencies and gradle dependencies to upgrade the SDK to V4.5.0. After you replace the dependencies, modify the code as instructed to perform the upgrade.
Changes in gradle dependencies
If you use the gradle dependency mode to integrate an ApsaraVideo Player SDK for Android, you need to delete local dependencies and replace gradle dependencies to upgrade the SDK to V4.5.0.
Changes in players
Change | Earlier than V4.5.0 | 4.5.0 |
---|---|---|
Unified player |
The following players are provided to play videos by URL and video ID separately:
|
In ApsaraVideo Player SDK V4.5.0 for Android, AlivcMediaPlayer and AliyunVodPlayer are integrated. AliPlayer is used to play both videos by URL and video ID. |
Changes in dependencies
Change | Earlier than V4.5.0 | 4.5.0 |
---|---|---|
Dependencies | The following local dependencies and gradle dependency are used:
|
|
Changes in the obfuscation configuration
-keep class com.alivc.**{*;}
-keep class com.aliyun.**{*;}
-keep class com.cicada.**{*;}
-dontwarn com.alivc.**
-dontwarn com.aliyun.**
Changes in class names and methods
In ApsaraVideo Player SDK V4.5.0 for Android, some class names are changed, and new features and event callbacks are added. In addition, some API operations are removed from versions that are earlier than V4.5.0.
Changes in listeners
Method | Feature | Change | Sample code |
---|---|---|---|
OnPreparedListener | The listener for successful preparation | Not changed | N/A |
OnSeekCompleteListener | The listener for the completion of seeking | Not changed | N/A |
OnCompletionListener | The listener for the completion of playback | Not changed | N/A |
OnFirstFrameStartListener | The listener for the appearance of the first frame | OnRenderingStartListener |
|
OnStoppedListener | The listener for the stop of video playback | OnStateChangedListener |
The
newState parameter of the OnStateChangedListener callback indicates the new status of the player. The valid values of the status are
defined in the IPlayer class. Example:
|
OnPcmDataListener | The listener for pulse-code modulation (PCM) audio data | Deleted | N/A |
OnCircleStartListener | The listener for the start of loop playback | OnInfoListener |
Note The InfoBean.getCode() = InfoCode.LoopingStart callback is fired when the loop playback
starts.
|
OnLoadingListener | The listener for video loading | OnLoadingStatusListener |
Note The value of the netSpeed parameter in the onLoadingProgress method is 0.
|
OnBufferingUpdateListener | The listener for the progress of video buffering | OnInfoListener |
Note The InfoBean.getCode() = InfoCode.BufferedPosition callback is fired when the buffering
progress is updated. You can call the
InfoBean.getExtraValue() method to obtain the buffering progress. The InfoBean.getCode() = InfoCode.CurrentPosition callback is fired when the playback progress is updated. You can call the InfoBean.getExtraValue() method to obtain the playback progress.
|
OnErrorListener | The listener for a playback error | OnErrorListener |
Note ErrorInfo is the error information class. You can call the
ErrorInfo.getCode() method to obtain the error code, and call the ErrorInfo.getMsg() method to obtain the error message.
|
OnInfoListener | The listener for playback information | OnInfoListener |
InfoBean is the playback information class. You can call the
InfoBean.getCode() method to obtain the playback code, and call the InfoBean.getExtraMsg() method to obtain the playback message. InfoCode contains the following values:
|
OnVideoSizeChangedListener | The listener for the change of the video image size | Not changed | N/A |
OnChangeQualityListener | The listener for video resolution switching | OnTrackChangedListener |
Note The OnTrackChangedListener callback is fired after the
selectTrack(index) method is called.
|
LockPortraitListener | The listener for the lock of portrait display | Deleted | N/A |
OnRePlayListener | The listener for the start of replay | Deleted | N/A |
OnAutoPlayListener | The listener for the start of autoplay | OnInfoListener |
Note ErrorInfo is the error information class. You can call the
ErrorInfo.getCode() method to obtain the error code, and call the ErrorInfo.getMsg() method to obtain the error message. For more information about codes that indicate
expiration errors, see Error codes.
|
OnTimeShiftUpdaterListener | The listener for the change of time shifting | Classified into the AliLiveshiftPlayer class | N/A |
OnSeekLiveCompletionListener | The listener for the completion of seeking during time shifting | Classified into the AliLiveshiftPlayer class | N/A |
OnTimeExpiredErrorListener | The listener for the expiration of request information | OnErrorListener |
|
OnUrlTimeExpiredListener | The listener for the event that the video playback URL is about to expire | Deleted | N/A |
OnTrackReadyListener | The listener for obtaining the stream | New | N/A |
OnSubtitleDisplayListener | The listener for obtaining the time when subtitles are displayed | New | N/A |
OnSnapShotListener | The listener for the snapshot result | New | N/A |
Changes in major API operations
Method in V3.4.10 | Method in V4.5.0 | Description |
---|---|---|
surfaceChanged | redraw | Called when the surface changes |
getPlayerState | OnStateChangedListener | Called to obtain the status of the player |
Documents related to versions earlier than ApsaraVideo Player SDK V4.5.0 for Android
For more information about API operations that are provided by an ApsaraVideo Player SDK for Android earlier than V4.5.0, see Release notes of ApsaraVideo Player SDK for Android. Find the update records of the version that you want to view and click the download link of the sample code in the historical version to obtain the information about the API operations.