diff --git a/BeanCovertor.swift b/BeanCovertor.swift index 0973defe2..868a41b34 100644 --- a/BeanCovertor.swift +++ b/BeanCovertor.swift @@ -305,20 +305,7 @@ func mapToRtcEngineConfig(_ map: Dictionary) -> AgoraRtcEngineConfi let config = AgoraRtcEngineConfig() config.appId = map["appId"] as? String if let areaCode = map["areaCode"] as? NSNumber { - config.areaCode = areaCode.uintValue - } - return config -} - -func mapToEncryptionConfig(_ map: Dictionary) -> AgoraEncryptionConfig { - let config = AgoraEncryptionConfig() - if let encryptionMode = map["encryptionMode"] as? NSNumber { - if let encryptionMode = AgoraEncryptionMode(rawValue: encryptionMode.intValue) { - config.encryptionMode = encryptionMode - } - } - if let encryptionKey = map["encryptionKey"] as? String { - config.encryptionKey = encryptionKey + config.areaCode = areaCode.int32Value } return config } diff --git a/Extensions.swift b/Extensions.swift index 6f69f1596..14ded003f 100644 --- a/Extensions.swift +++ b/Extensions.swift @@ -23,8 +23,7 @@ extension AgoraRtcLocalAudioStats { return [ "numChannels": numChannels, "sentSampleRate": sentSampleRate, - "sentBitrate": sentBitrate, - "txPacketLossRate": txPacketLossRate + "sentBitrate": sentBitrate ] } } @@ -83,8 +82,7 @@ extension AgoraRtcRemoteAudioStats { "receivedBitrate": receivedBitrate, "totalFrozenTime": totalFrozenTime, "frozenRate": frozenRate, - "totalActiveTime": totalActiveTime, - "publishDuration": publishDuration + "totalActiveTime": totalActiveTime ] } } @@ -103,9 +101,7 @@ extension AgoraRtcLocalVideoStats { "encodedFrameWidth": encodedFrameWidth, "encodedFrameHeight": encodedFrameHeight, "encodedFrameCount": encodedFrameCount, - "codecType": codecType.rawValue, - "txPacketLossRate": txPacketLossRate, - "captureFrameRate": captureFrameRate + "codecType": codecType.rawValue ] } } @@ -124,8 +120,7 @@ extension AgoraRtcRemoteVideoStats { "rxStreamType": rxStreamType.rawValue, "totalFrozenTime": totalFrozenTime, "frozenRate": frozenRate, - "totalActiveTime": totalActiveTime, - "publishDuration": publishDuration + "totalActiveTime": totalActiveTime ] } } diff --git a/RtcChannel.swift b/RtcChannel.swift index 5e4d7c22c..c79e8360d 100644 --- a/RtcChannel.swift +++ b/RtcChannel.swift @@ -106,8 +106,6 @@ protocol RtcChannelEncryptionInterface { func setEncryptionSecret(_ params: NSDictionary, _ callback: Callback) func setEncryptionMode(_ params: NSDictionary, _ callback: Callback) - - func enableEncryption(_ params: NSDictionary, _ callback: Callback) } protocol RtcChannelInjectStreamInterface { @@ -331,10 +329,6 @@ class RtcChannelManager: NSObject, RtcChannelInterface { callback.code(self[params["channelId"] as! String]?.setEncryptionMode(encryptionMode)) } - @objc func enableEncryption(_ params: NSDictionary, _ callback: Callback) { - callback.code(self[params["channelId"] as! String]?.enableEncryption(params["enabled"] as! Bool, encryptionConfig: mapToEncryptionConfig(params["config"] as! Dictionary))) - } - @objc func addInjectStreamUrl(_ params: NSDictionary, _ callback: Callback) { callback.code(self[params["channelId"] as! String]?.addInjectStreamUrl(params["url"] as! String, config: mapToLiveInjectStreamConfig(params["config"] as! Dictionary))) } diff --git a/RtcChannelEvent.swift b/RtcChannelEvent.swift index 47144ae9a..9d3e37561 100644 --- a/RtcChannelEvent.swift +++ b/RtcChannelEvent.swift @@ -40,11 +40,6 @@ class RtcChannelEvents { static let ChannelMediaRelayStateChanged = "ChannelMediaRelayStateChanged" static let ChannelMediaRelayEvent = "ChannelMediaRelayEvent" static let MetadataReceived = "MetadataReceived" - static let AudioPublishStateChanged = "AudioPublishStateChanged" - static let VideoPublishStateChanged = "VideoPublishStateChanged" - static let AudioSubscribeStateChanged = "AudioSubscribeStateChanged" - static let VideoSubscribeStateChanged = "VideoSubscribeStateChanged" - static let RtmpStreamingEvent = "RtmpStreamingEvent" static func toMap() -> Dictionary { return [ @@ -78,11 +73,6 @@ class RtcChannelEvents { "ChannelMediaRelayStateChanged": ChannelMediaRelayStateChanged, "ChannelMediaRelayEvent": ChannelMediaRelayEvent, "MetadataReceived": MetadataReceived, - "AudioPublishStateChanged": AudioPublishStateChanged, - "VideoPublishStateChanged": VideoPublishStateChanged, - "AudioSubscribeStateChanged": AudioSubscribeStateChanged, - "VideoSubscribeStateChanged": VideoSubscribeStateChanged, - "RtmpStreamingEvent": RtmpStreamingEvent, ] } } @@ -114,11 +104,11 @@ extension RtcChannelEventHandler: AgoraRtcChannelDelegate { } public func rtcChannelDidJoin(_ rtcChannel: AgoraRtcChannel, withUid uid: UInt, elapsed: Int) { - callback(RtcChannelEvents.JoinChannelSuccess, rtcChannel, rtcChannel.getId(), uid, elapsed) + callback(RtcChannelEvents.JoinChannelSuccess, rtcChannel, uid, elapsed) } public func rtcChannelDidRejoin(_ rtcChannel: AgoraRtcChannel, withUid uid: UInt, elapsed: Int) { - callback(RtcChannelEvents.RejoinChannelSuccess, rtcChannel, rtcChannel.getId(), uid, elapsed) + callback(RtcChannelEvents.RejoinChannelSuccess, rtcChannel, uid, elapsed) } public func rtcChannelDidLeave(_ rtcChannel: AgoraRtcChannel, with stats: AgoraChannelStats) { @@ -220,24 +210,4 @@ extension RtcChannelEventHandler: AgoraRtcChannelDelegate { public func rtcChannel(_ rtcChannel: AgoraRtcChannel, didReceive event: AgoraChannelMediaRelayEvent) { callback(RtcChannelEvents.ChannelMediaRelayEvent, rtcChannel, event.rawValue) } - - func rtcChannel(_ rtcChannel: AgoraRtcChannel, didAudioPublishStateChange oldState: AgoraStreamPublishState, newState: AgoraStreamPublishState, elapseSinceLastState: Int) { - callback(RtcChannelEvents.AudioPublishStateChanged, rtcChannel, rtcChannel.getId(), oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcChannel(_ rtcChannel: AgoraRtcChannel, didVideoPublishStateChange oldState: AgoraStreamPublishState, newState: AgoraStreamPublishState, elapseSinceLastState: Int) { - callback(RtcChannelEvents.VideoPublishStateChanged, rtcChannel, rtcChannel.getId(), oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcChannel(_ rtcChannel: AgoraRtcChannel, didAudioSubscribeStateChange uid: UInt, oldState: AgoraStreamSubscribeState, newState: AgoraStreamSubscribeState, elapseSinceLastState: Int) { - callback(RtcChannelEvents.AudioSubscribeStateChanged, rtcChannel, rtcChannel.getId(), uid, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcChannel(_ rtcChannel: AgoraRtcChannel, didVideoSubscribeStateChange uid: UInt, oldState: AgoraStreamSubscribeState, newState: AgoraStreamSubscribeState, elapseSinceLastState: Int) { - callback(RtcChannelEvents.VideoSubscribeStateChanged, rtcChannel, rtcChannel.getId(), uid, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcChannel(_ rtcChannel: AgoraRtcChannel, rtmpStreamingEventWithUrl url: String, eventCode: AgoraRtmpStreamingEvent) { - callback(RtcChannelEvents.RtmpStreamingEvent, rtcChannel, url, eventCode.rawValue) - } } diff --git a/RtcEngine.swift b/RtcEngine.swift index 097e8d318..30d26b198 100644 --- a/RtcEngine.swift +++ b/RtcEngine.swift @@ -52,8 +52,6 @@ protocol RtcEngineInterface: func getConnectionState(_ callback: Callback) - func sendCustomReportMessage(_ params: NSDictionary, _ callback: Callback) - func getCallId(_ callback: Callback) func rate(_ params: NSDictionary, _ callback: Callback) @@ -285,8 +283,6 @@ protocol RtcEngineEncryptionInterface { func setEncryptionSecret(_ params: NSDictionary, _ callback: Callback) func setEncryptionMode(_ params: NSDictionary, _ callback: Callback) - - func enableEncryption(_ params: NSDictionary, _ callback: Callback) } protocol RtcEngineAudioRecorderInterface { @@ -410,10 +406,6 @@ class RtcEngineManager: NSObject, RtcEngineInterface { } } - @objc func sendCustomReportMessage(_ params: NSDictionary, _ callback: Callback) { - callback.code(engine?.sendCustomReportMessage(params["id"] as! String, category: params["category"] as! String, event: params["event"] as! String, label: params["label"] as! String, value: (params["value"] as! NSNumber).intValue)) - } - @objc func getCallId(_ callback: Callback) { callback.resolve(engine) { $0.getCallId() @@ -849,21 +841,7 @@ class RtcEngineManager: NSObject, RtcEngineInterface { } @objc func setEncryptionMode(_ params: NSDictionary, _ callback: Callback) { - var encryptionMode = "" - switch (params["encryptionMode"] as! NSNumber).intValue { - case AgoraEncryptionMode.AES128XTS.rawValue: - encryptionMode = "aes-128-xts" - case AgoraEncryptionMode.AES128ECB.rawValue: - encryptionMode = "aes-128-ecb" - case AgoraEncryptionMode.AES256XTS.rawValue: - encryptionMode = "aes-256-xts" - default: encryptionMode = "" - } - callback.code(engine?.setEncryptionMode(encryptionMode)) - } - - @objc func enableEncryption(_ params: NSDictionary, _ callback: Callback) { - callback.code(engine?.enableEncryption(params["enabled"] as! Bool, encryptionConfig: mapToEncryptionConfig(params["config"] as! Dictionary))) + callback.code(engine?.setEncryptionMode(params["encryptionMode"] as? String)) } @objc func startAudioRecording(_ params: NSDictionary, _ callback: Callback) { diff --git a/RtcEngineEvent.swift b/RtcEngineEvent.swift index ed926d7d0..d8de1ea50 100644 --- a/RtcEngineEvent.swift +++ b/RtcEngineEvent.swift @@ -80,13 +80,6 @@ class RtcEngineEvents { static let CameraReady = "CameraReady" static let VideoStopped = "VideoStopped" static let MetadataReceived = "MetadataReceived" - static let FirstLocalAudioFramePublished = "FirstLocalAudioFramePublished" - static let FirstLocalVideoFramePublished = "FirstLocalVideoFramePublished" - static let AudioPublishStateChanged = "AudioPublishStateChanged" - static let VideoPublishStateChanged = "VideoPublishStateChanged" - static let AudioSubscribeStateChanged = "AudioSubscribeStateChanged" - static let VideoSubscribeStateChanged = "VideoSubscribeStateChanged" - static let RtmpStreamingEvent = "RtmpStreamingEvent" static func toMap() -> Dictionary { return [ @@ -160,13 +153,6 @@ class RtcEngineEvents { "CameraReady": CameraReady, "VideoStopped": VideoStopped, "MetadataReceived": MetadataReceived, - "FirstLocalAudioFramePublished": FirstLocalAudioFramePublished, - "FirstLocalVideoFramePublished": FirstLocalVideoFramePublished, - "AudioPublishStateChanged": AudioPublishStateChanged, - "VideoPublishStateChanged": VideoPublishStateChanged, - "AudioSubscribeStateChanged": AudioSubscribeStateChanged, - "VideoSubscribeStateChanged": VideoSubscribeStateChanged, - "RtmpStreamingEvent": RtmpStreamingEvent, ] } } @@ -469,32 +455,4 @@ extension RtcEngineEventHandler: AgoraRtcEngineDelegate { public func rtcEngineVideoDidStop(_ engine: AgoraRtcEngineKit) { callback(RtcEngineEvents.VideoStopped) } - - func rtcEngine(_ engine: AgoraRtcEngineKit, firstLocalAudioFramePublished elapsed: Int) { - callback(RtcEngineEvents.FirstLocalAudioFramePublished, elapsed) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, firstLocalVideoFramePublished elapsed: Int) { - callback(RtcEngineEvents.FirstLocalVideoFramePublished, elapsed) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, didAudioPublishStateChange channel: String, oldState: AgoraStreamPublishState, newState: AgoraStreamPublishState, elapseSinceLastState: Int) { - callback(RtcEngineEvents.AudioPublishStateChanged, channel, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, didVideoPublishStateChange channel: String, oldState: AgoraStreamPublishState, newState: AgoraStreamPublishState, elapseSinceLastState: Int) { - callback(RtcEngineEvents.VideoPublishStateChanged, channel, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, didAudioSubscribeStateChange channel: String, withUid uid: UInt, oldState: AgoraStreamSubscribeState, newState: AgoraStreamSubscribeState, elapseSinceLastState: Int) { - callback(RtcEngineEvents.AudioSubscribeStateChanged, channel, uid, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, didVideoSubscribeStateChange channel: String, withUid uid: UInt, oldState: AgoraStreamSubscribeState, newState: AgoraStreamSubscribeState, elapseSinceLastState: Int) { - callback(RtcEngineEvents.VideoSubscribeStateChanged, channel, uid, oldState.rawValue, newState.rawValue, elapseSinceLastState) - } - - func rtcEngine(_ engine: AgoraRtcEngineKit, rtmpStreamingEventWithUrl url: String, eventCode: AgoraRtmpStreamingEvent) { - callback(RtcEngineEvents.RtmpStreamingEvent, url, eventCode.rawValue) - } }