Skip to content

Commit c38ca0a

Browse files
committed
Working in Android and iOS now
1 parent b1c71a6 commit c38ca0a

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,22 @@ Google's [AppRTC](https://apprtc.appspot.com/) adapted to [Cordova](http://cordo
88
This project takes the [HTML5 version](https://github.com/webrtc/apprtc/tree/master/src/web_app) of the *AppRTC* application and runs it in Cordova iOS (iPhone, iPad...) by using the [cordova-plugin-iosrtc](https://github.com/eface2face/cordova-plugin-iosrtc) to provide the [WebRTC W3C JavaScript APIs](http://www.w3.org/TR/webrtc/).
99

1010

11-
## Building
11+
## Building & usage
1212

1313
- Get the source code:
1414
```bash
1515
git clone https://github.com/eface2face/iOSRTCApp
1616
cd iOSRTCApp
1717
```
18-
- Change the Android WebView engine by the [Crosswalk](https://crosswalk-project.org/) one using [the proper plugin](https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview):
19-
```bash
20-
cordova plugin add https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview --save
21-
```
22-
- Then install this plugin:
23-
```bash
24-
cordova plugin add com.eface2face.iosrtc --save
25-
```
26-
- Add both platforms:
18+
- Add both platforms, all needed plugins are installed automatically because of being included in the "config.xml" file:
2719
```bash
2820
cordova platform add ios android
2921
```
3022
- Run as usual:
3123
```bash
3224
cordova run android --device
33-
cordova run ios --device
3425
```
35-
36-
37-
## Usage
38-
39-
Once running, enter the same room as one already created via web browser at https://apprtc.appspot.com/, and enjoy!
26+
- Once running, enter the same room as one already created via web browser at https://apprtc.appspot.com/, and enjoy!
4027

4128

4229
## Changes to the original AppRTC HTML5 code

config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<preference name="Orientation" value="portrait" />
1313
<preference name="EnableViewportScale" value="true" />
1414
<preference name="StatusBarOverlaysWebView" value="false" />
15+
<!-- TODO: Needed for now: http://stackoverflow.com/a/30992364 -->
16+
<!-- <plugin name="cordova-plugin-whitelist" version="1" /> -->
17+
<plugin name="cordova-plugin-whitelist" version="1.0.0" />
1518
<access origin="*" />
1619
<allow-intent href="http://*/*" />
1720
<allow-intent href="https://*/*" />
@@ -29,4 +32,5 @@
2932
<plugin name="com.eface2face.iosrtc" spec="^1.2.8" />
3033
<plugin name="cordova-plugin-crosswalk-webview" spec="https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview" />
3134
<plugin name="cordova-plugin-device" spec="^1.0.1" />
35+
<plugin name="cordova-plugin-camera" spec="https://github.com/eface2face/cordova-plugin-camera" />
3236
</widget>

www/appwindow.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<head>
1111

1212
<meta charset="utf-8">
13+
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> -->
14+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: gap: https://ssl.gstatic.com 'unsafe-eval';
15+
style-src 'self' 'unsafe-inline'; media-src *; connect-src *">
1316
<meta name="description" content="WebRTC reference app">
1417
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
1518
<meta itemprop="description" content="Video chat using the reference WebRTC application">
@@ -155,20 +158,19 @@ <h1>AppRTC</h1>
155158
window.updateVideos = function () {};
156159
}
157160

158-
// Wait a bit since we are adding more stuff into the DOM.
161+
// TODO: Wait a bit since we are adding more stuff into the DOM.
159162
setTimeout(function () {
160163
// Avoid iOS WebSocket crash:
161164
// https://github.com/eface2face/cordova-plugin-iosrtc/issues/12
162165
// Also looad the original AppRTC JS scripts once Cordova is ready (so the iosrtc plugin
163166
// has polluted the window namespace with WebRTC class/functions).
164167
["js/ios-websocket-hack.js", "js/apprtc.debug.js", "js/appwindow.js"].forEach(function (path) {
165-
setTimeout(function () {
166-
var script = document.createElement("script");
168+
var script = document.createElement("script");
167169

168-
script.type = "text/javascript";
169-
script.src = path;
170-
document.getElementsByTagName("head")[0].appendChild(script);
171-
});
170+
script.type = "text/javascript";
171+
script.src = path;
172+
script.async = false;
173+
document.getElementsByTagName("head")[0].appendChild(script);
172174
});
173175
}, 1000);
174176
}); // End of ondeviceready.

0 commit comments

Comments
 (0)