From ce09916837a397d4d761767681795eae2bfbf0ba Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Sat, 5 Mar 2016 17:41:20 -0800 Subject: [PATCH 1/3] WebSocket hack loads iff iOS Cordova --- extra/ios-websocket-hack.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extra/ios-websocket-hack.js b/extra/ios-websocket-hack.js index bf3a56c8..fad773dc 100644 --- a/extra/ios-websocket-hack.js +++ b/extra/ios-websocket-hack.js @@ -17,6 +17,9 @@ (function () { + // run on iOS Cordova only + if (!(window.cordova && window.cordova.platformId === 'ios')) return; + // Store a reference of the native WebSocket class. var NativeWebSocket = window.WebSocket; From 27be30b42e23ce094a9f87ce36fc06f801078c07 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Fri, 18 Mar 2016 14:26:41 -0700 Subject: [PATCH 2/3] adhere to project indenting --- extra/ios-websocket-hack.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/ios-websocket-hack.js b/extra/ios-websocket-hack.js index fad773dc..f0d7df6f 100644 --- a/extra/ios-websocket-hack.js +++ b/extra/ios-websocket-hack.js @@ -17,8 +17,8 @@ (function () { - // run on iOS Cordova only - if (!(window.cordova && window.cordova.platformId === 'ios')) return; + // run on iOS Cordova only + if (!(window.cordova && window.cordova.platformId === 'ios')) return; // Store a reference of the native WebSocket class. var NativeWebSocket = window.WebSocket; From 92bdb984a2dd30f327434a519ff78dce2e2652b2 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Thu, 31 Mar 2016 17:00:11 -0700 Subject: [PATCH 3/3] Update README for ios-websocket-hack usage --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6b545cb..3bfeba0e 100644 --- a/README.md +++ b/README.md @@ -136,8 +136,12 @@ If you are using the plugin we would love to [heard back from you](WHO_USES_IT.m Don't call plugin methods within WebSocket events (`onopen`, `onmessage`, etc). There is an issue in iOS Safari (see [issue #12](https://github.com/eface2face/cordova-plugin-iosrtc/issues/12)). Instead run a `setTimeout()` within the WebSocket event if you need to call plugin methods on it. -Or better, just load the provided [ios-websocket-hack.js](extra/ios-websocket-hack.js) script into your Cordova iOS app and you are done. +Or better yet, include the provided [ios-websocket-hack.js](extra/ios-websocket-hack.js) in your app and load into your `index.html` as follows: +``` + + +``` #### HTML5 video API