This topic describes how to update Push SDK for iOS from V4.0.2 to V4.1.0 or later.
Prerequisites
The latest version of Push SDK for iOS is downloaded.
For more information, see Download SDKs.
Procedure
Remove the related class libraries and resource files of SDK V4.0.2 from the project. Add the related class libraries and resource files of SDK V4.1.0 or later. Check and modify the related key methods and methods in the main process of stream ingest.
In the libs directory of the project, replace the AliLivesdk.framework file with the AlivcLivePusher.framework and AlivcLibRtmp.framework files in the SDK package of V4.1.0 or later.
Update ApsaraVideo Player SDKs to AliyunPlayer SDKs. For more information, see Push SDK for iOS and ApsaraVideo Player SDKs used in the demo directory of Push SDK for iOS.
If you want to integrate Queen SDK for iOS, view the usage notes in the demo directory of Push SDK for iOS to facilitate the integration of Queen SDK for iOS and UI.
Changes are made to some key methods. View the "Comparison of key methods" section of this topic to check and modify the related methods in your code.
Changes are made to some methods in the main process of stream ingest. View the "Changes in methods in the main process of stream ingest" section of this topic to check and modify your code.
Comparison of key methods
Basic methods
V4.0.2
V4.1.0 and later
Description
getSdkVersion
getSdkVersion
Queries the version number of Push SDK for iOS.
initWithConfig
initWithConfig
Creates a stream ingest object.
destorySdk
destroy
Destroys a stream ingest object.
setStatusDelegate
setRtsDelegate
setVidePreProcessDelegate
setDataStatsDelegate
AlivcPublisherViewDelegate
AlivcLivePusherInfoDelegate
AlivcLivePusherErrorDelegate
Sets the callback for the audio and video streams of a fan during stream ingest over Real-Time Communication (RTC). To set video preprocessing callbacks, use the AliLiveRtsDelegate class. Sets the callback for parameters that are related to live streaming media.
setNetworkDelegate
AlivcLivePusherNetworkDelegate
Sets the callback for the network status during stream ingest.
setLogDirPath
N/A: Custom logs are written.
Sets the path for storing the log files of Push SDK for iOS. To prevent log loss, you must call this method before other methods. In addition, make sure that the specified path exists and is writable.
setLogLevel
N/A
Sets the log level.
Basic stream ingest methods
V4.0.2
V4.1.0 and later
Description
startPreview
startPreview
Starts the preview. This method is called on the streamer side.
stopPreview
stopPreview
Stops the preview. This method is called on the streamer side.
pausePush
pause
Stops the camera from collecting live streams and ingests standby streams. This method is supported only for stream ingest over Real-Time Messaging Protocol (RTMP). You must call the startPush() method before the pausePush() method.
resumePush
resume()
Enables the camera to collect live streams again and stops ingesting standby streams. This method is supported only for stream ingest over RTMP. You must call the pausePush method before the resumePush method.
startPush
startPushWithURL
Starts the stream ingest.
stopPush
stopPush
Stops the stream ingest.
isPublishing
isPushing
Queries whether streams are being ingested.
getPublishUrl
getPushURL
Queries the current ingest URL.
Video-related methods
V4.0.2
V4.1.0 and later
Description
setPreviewMode
setpreviewDisplayMode
Sets the preview mode.
switchCamera
switchCamera
Switches between the front and rear cameras.
setCameraZoom
setZoom
Sets the zoom factor of the camera and specifies whether to enable the flash.
isCameraExposurePointSupported
setExposure
Queries whether an exposure point can be set for the camera.
setCameraFocusPoint
setAutoFocus
Sets the focus point of the camera.
Audio-related methods
V4.0.2
V4.1.0 and later
Description
setMute
setMute
Specifies whether the frames collected from the local audio are mute frames.
isAudioOnly
isAudioOnly
Queries whether the ingested streams are audio-only streams.
enableEarBack
setBGMEarsBack
Enables in-ear monitoring. To prevent echoes, we recommend that you enable in-ear monitoring after you insert the headset.
playBGM
startBGMAsync
Starts the playback of background music.
stopBGM
stopBGM
Stops the playback of background music.
pauseBGM
pauseBGM
Pauses the playback of background music.
resumeBGM
resumeBGM
Resumes the playback of background music.
setBGMVolume
setBGMVolume
Sets the volume of background music.