From 5abcdeabb7c602cd37cbaac2f37f991dff929a40 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Wed, 13 Apr 2016 16:39:47 -0700 Subject: [PATCH] iOS-Cordova support --- README.md | 2 +- src/PluginMediaStreamRenderer.swift | 4 ++-- src/iosrtcPlugin.swift | 16 +++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6b545cb..a694d9f0 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ In order to make this Cordova plugin run into a iOS application some requirement * Xcode >= 7.2.1 * iOS >= 9 (run on lower versions at your own risk, but don't open issues) -* `cordova-ios` 3.9.X (don't attempt to use 4.X) +* `cordova-ios` 4.X * No bitcode (built-in *libwebrtc* does not contain bitcode so you need to disable it in your Xcode project settings) diff --git a/src/PluginMediaStreamRenderer.swift b/src/PluginMediaStreamRenderer.swift index d7c94d4d..e0aacfe4 100644 --- a/src/PluginMediaStreamRenderer.swift +++ b/src/PluginMediaStreamRenderer.swift @@ -3,7 +3,7 @@ import AVFoundation class PluginMediaStreamRenderer : NSObject, RTCEAGLVideoViewDelegate { - var webView: UIWebView + var webView: UIView var eventListener: (data: NSDictionary) -> Void var elementView: UIView var videoView: RTCEAGLVideoView @@ -13,7 +13,7 @@ class PluginMediaStreamRenderer : NSObject, RTCEAGLVideoViewDelegate { init( - webView: UIWebView, + webView: UIView, eventListener: (data: NSDictionary) -> Void ) { NSLog("PluginMediaStreamRenderer#init()") diff --git a/src/iosrtcPlugin.swift b/src/iosrtcPlugin.swift index ec799290..51aec3b5 100644 --- a/src/iosrtcPlugin.swift +++ b/src/iosrtcPlugin.swift @@ -9,21 +9,27 @@ class iosrtcPlugin : CDVPlugin { // Single PluginGetUserMedia instance. var pluginGetUserMedia: PluginGetUserMedia! // PluginRTCPeerConnection dictionary. - var pluginRTCPeerConnections: [Int : PluginRTCPeerConnection] = [:] + var pluginRTCPeerConnections: [Int : PluginRTCPeerConnection]! // PluginMediaStream dictionary. - var pluginMediaStreams: [String : PluginMediaStream] = [:] + var pluginMediaStreams: [String : PluginMediaStream]! // PluginMediaStreamTrack dictionary. - var pluginMediaStreamTracks: [String : PluginMediaStreamTrack] = [:] + var pluginMediaStreamTracks: [String : PluginMediaStreamTrack]! // PluginMediaStreamRenderer dictionary. - var pluginMediaStreamRenderers: [Int : PluginMediaStreamRenderer] = [:] + var pluginMediaStreamRenderers: [Int : PluginMediaStreamRenderer]! // Dispatch queue for serial operations. - let queue = dispatch_queue_create("cordova-plugin-iosrtc", DISPATCH_QUEUE_SERIAL) + var queue: dispatch_queue_t! // This is just called if in plugin.xml. override func pluginInitialize() { NSLog("iosrtcPlugin#pluginInitialize()") + pluginMediaStreams = [:] + pluginMediaStreamTracks = [:] + pluginMediaStreamRenderers = [:] + queue = dispatch_queue_create("cordova-plugin-iosrtc", DISPATCH_QUEUE_SERIAL) + pluginRTCPeerConnections = [:] + // Initialize DTLS stuff. RTCPeerConnectionFactory.initializeSSL()