Created
July 8, 2022 09:37
-
-
Save larryluoo/98598ba558778c9c5b7976d1e7b8d830 to your computer and use it in GitHub Desktop.
ProviderDelegate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation | |
import CallKit | |
class ProviderDelegate: NSObject { | |
// 1. | |
fileprivate let callController = CXCallController() | |
fileprivate let provider: CXProvider | |
init(callManager: CallManager) { | |
// 2. | |
provider = CXProvider(configuration: type(of: self).providerConfiguration) | |
super.init() | |
// 3. | |
provider.setDelegate(self, queue: nil) | |
} | |
// 4. | |
static var providerConfiguration: CXProviderConfiguration { | |
let providerConfiguration = CXProviderConfiguration(localizedName: "ZEGOCall") | |
providerConfiguration.supportsVideo = true | |
providerConfiguration.maximumCallsPerCallGroup = 1 | |
providerConfiguration.supportedHandleTypes = [.generic] | |
if let iconMaskImage = UIImage(named: "IconMask") { | |
providerConfiguration.iconTemplateImageData = iconMaskImage.pngData() | |
} | |
roviderConfiguration.ringtoneSound = "Ringtone.caf" | |
return providerConfiguration | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment