-
Notifications
You must be signed in to change notification settings - Fork 28
ScreenShare Optimization
ScreenShare Optimization API's can be used to optimise the screen sharing experience for video and text. These modification to the API's are available from v3.9.0 onwards
Screen sharing APIs are available in Call object. Call object can be obtained as a result of webex.phone.dial API or it is notified in webex.phone.onIncoming API for an incoming call.
-
Start ScreenSharing with shareConfig.
call.startSharing(shareConfig: self.shareConfig, completionHandler: { error in if error != nil { print("share screen error:\(String(describing: error))") } })
The shareConfig parameter is optional. If not set, optimization will be Default and audio will not be shared. The parameter shareConfig is from v3.9.0 onwards.
-
To get the active sharing type for current call below API can be used.
let sharingConfig = call.getShareConfig()
//This doesn't set any special optimization. Maximum is 3 fps. This is the default setting if no parameters are passed to the shareConfig param.
let shareConfig = ShareConfig(ShareOptimizeType.Default, false)
//This helps in optimizing screenshare while sharing video and motion without audio. Maximum is 30 fps.
let shareConfig = ShareConfig(ShareOptimizeType.OptimizeVideo, false)
//This helps in optimizing screenshare while sharing text and images. Maximum is 3 fps. Resolution of text and images gets better.
let shareConfig = ShareConfig(ShareOptimizeType.OptimizeText, false)
Once the user select shareConfig type as ShareOptimizeType.OptimizeVideo in the app that information needs to be communicated to the BroadcastExtension using UserDefaults.
if let defaults = UserDefaults(suiteName: groupIdentifier)
{
switch self.shareConfig?.shareType {
case .OptimizeVideo:
defaults.setValue(true, forKey: "optimizeForVideo")
default:
defaults.setValue(false, forKey: "optimizeForVideo")
}
}
On the basis of this flag, the new API of WebexBroadcastExtension should be called
if UserDefaults(suiteName: groupIdentifier)?.bool(forKey: "optimizeForVideo") == true {
WebexBroadcastExtension.sharedInstance.optimizeForVideo()
}