Skip to content

Commit ac347e6

Browse files
author
Igor Khomenko
committed
added cordova-custom-config plugin for Cordova video chat sample
1 parent a52b313 commit ac347e6

File tree

147 files changed

+2290
-353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+2290
-353
lines changed

samples/cordova/video_chat/config.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3-
<name>Video Chat</name>
2+
<widget id="com.quickblox.cordova.video_chat" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>QB Video Chat</name>
44
<description>
5-
Apache Cordova simple code sample for Web Video (WebRTC) Chat (via QuickBlox SDK + API)
5+
QuickBlox Apache Cordova simple code sample for Web Video (WebRTC) Chat (via QuickBlox SDK + API)
66
</description>
77
<author email="assist@quickblox.com" href="https://quickblox.com">
88
QuickBlox Team
@@ -23,11 +23,18 @@
2323
<allow-intent href="itms:*" />
2424
<allow-intent href="itms-apps:*" />
2525
<hook src="hooks/iosrtc-swift-support.js" type="after_platform_add" />
26+
<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
27+
<string>Use camera for video calling</string>
28+
</config-file>
29+
<config-file parent="NSMicrophoneUsageDescription" platform="ios" target="*-Info.plist">
30+
<string>Use microphone for video calling</string>
31+
</config-file>
2632
</platform>
2733
<engine name="android" spec="~6.0.0" />
2834
<engine name="ios" spec="~4.3.0" />
2935
<engine name="browser" spec="~4.1.0" />
3036
<plugin name="cordova-plugin-iosrtc" spec="~3.1.0" />
3137
<plugin name="cordova-plugin-console" spec="~1.0.4" />
3238
<plugin name="cordova-plugin-device" spec="~1.1.3" />
39+
<plugin name="cordova-custom-config" spec="~3.0.14" />
3340
</widget>

samples/cordova/video_chat/platforms/android/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.quickblox.cordova.video_chat" xmlns:android="http://schemas.android.com/apk/res/android">
33
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
44
<uses-permission android:name="android.permission.INTERNET" />
55
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">

samples/cordova/video_chat/platforms/android/android.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
},
3434
"cordova-plugin-device": {
3535
"PACKAGE_NAME": "io.cordova.hellocordova"
36+
},
37+
"cordova-custom-config": {
38+
"PACKAGE_NAME": "io.cordova.hellocordova"
3639
}
3740
},
3841
"dependent_plugins": {},
@@ -50,6 +53,7 @@
5053
"cordova-plugin-whitelist": "1.3.0",
5154
"cordova-plugin-iosrtc": "3.1.0",
5255
"cordova-plugin-console": "1.0.4",
53-
"cordova-plugin-device": "1.1.3"
56+
"cordova-plugin-device": "1.1.3",
57+
"cordova-custom-config": "3.0.14"
5458
}
5559
}

samples/cordova/video_chat/platforms/android/assets/www/cordova_plugins.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports.metadata =
1515
"cordova-plugin-whitelist": "1.3.0",
1616
"cordova-plugin-iosrtc": "3.1.0",
1717
"cordova-plugin-console": "1.0.4",
18-
"cordova-plugin-device": "1.1.3"
18+
"cordova-plugin-device": "1.1.3",
19+
"cordova-custom-config": "3.0.14"
1920
};
2021
// BOTTOM OF METADATA
2122
});

samples/cordova/video_chat/platforms/android/assets/www/index.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ <h4 class="caller__name">
357357
}
358358

359359
// Load JavaScript files async
360+
//
360361
var loadScriptAsync = function(path){
361362
var jsScript = document.createElement("script");
362363
jsScript.type = "text/javascript";
@@ -370,14 +371,31 @@ <h4 class="caller__name">
370371
loadScriptAsync("js/stateBoard.js")
371372
loadScriptAsync("js/app.js")
372373
}
374+
375+
// Listen for orientation changes and scroll events
376+
//
377+
window.addEventListener('orientationchange', function(){
378+
refreshVideoViewPosition();
379+
});
380+
window.addEventListener("scroll", function(){
381+
console.log("SCROLL");
382+
refreshVideoViewPosition();
383+
});
384+
//
385+
function refreshVideoViewPosition(){
386+
if (window.device.platform === 'iOS') {
387+
cordova.plugins.iosrtc.refreshVideos();
388+
}
389+
}
390+
373391
</script>
374392

375393
<!-- hack for github Pages -->
376394
<script>
377-
console.log("aaaaa");
378395
var host = "quickblox.github.io";
379-
if ((host == window.location.host) && (window.location.protocol != "https:"))
396+
if ((host == window.location.host) && (window.location.protocol != "https:")){
380397
window.location.protocol = "https";
398+
}
381399
</script>
382400
</body>
383401
</html>

samples/cordova/video_chat/platforms/android/assets/www/js/app.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,11 @@
188188
return [item.name, item.value.trim()];
189189
}));
190190

191-
if(localStorage.getItem('isAuth')) {
192-
$('#already_auth').modal();
193-
return false;
191+
if (window.device.platform === 'browser') {
192+
if(localStorage.getItem('isAuth')) {
193+
$('#already_auth').modal();
194+
return false;
195+
}
194196
}
195197

196198
$form.addClass('join-wait');
@@ -225,7 +227,9 @@
225227
} else {
226228
$form.removeClass('join-wait');
227229
$form.trigger('reset');
228-
localStorage.setItem('isAuth', true);
230+
if (window.device.platform === 'browser') {
231+
localStorage.setItem('isAuth', true);
232+
}
229233
app.router.navigate('dashboard', { trigger: true });
230234
}
231235
});

samples/cordova/video_chat/platforms/android/assets/www/js/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
};
1010
app.network = {};
1111

12-
12+
1313
/* [getQueryVar get value of key from search string of url]
1414
* @param {[string]} q [name of query]
1515
* @return {[string]} [value of query]
@@ -207,7 +207,7 @@
207207
usersHTML = '',
208208
users = [];
209209

210-
QB.users.get({'tags': [app.caller.user_tags]}, function(err, result){
210+
QB.users.get({'tags': [app.caller.user_tags], 'per_page': 100}, function(err, result){
211211
if (err) {
212212
reject(err);
213213
} else {

samples/cordova/video_chat/platforms/android/assets/www/styles.css

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ b {
5050
position: relative;
5151
padding: 0 0 75% 0; /* 4:3 */
5252
background: #bfbfbf;
53+
/*border: 1px solid #00ffff;*/
54+
}
55+
.qb-video_source {
56+
position: absolute;
57+
top: 0; bottom: 0;
58+
left: 0; right: 0;
59+
width: 100%;
60+
height: 100%;
61+
margin: auto;
62+
/*border: 1px solid #ffffff;*/
5363
}
54-
.qb-video_source {
55-
position: absolute;
56-
top: 0; bottom: 0;
57-
left: 0; right: 0;
58-
max-width: 100%;
59-
max-height: 100%;
60-
margin: auto;
61-
}
6264

6365
.qb-error {
6466
color: #d0021b;

samples/cordova/video_chat/platforms/android/platform_www/cordova_plugins.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports.metadata =
1515
"cordova-plugin-whitelist": "1.3.0",
1616
"cordova-plugin-iosrtc": "3.1.0",
1717
"cordova-plugin-console": "1.0.4",
18-
"cordova-plugin-device": "1.1.3"
18+
"cordova-plugin-device": "1.1.3",
19+
"cordova-custom-config": "3.0.14"
1920
};
2021
// BOTTOM OF METADATA
2122
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='utf-8'?>
22
<resources>
3-
<string name="app_name">Video Chat</string>
3+
<string name="app_name">QB Video Chat</string>
44
<string name="launcher_name">@string/app_name</string>
55
<string name="activity_name">@string/launcher_name</string>
66
</resources>

0 commit comments

Comments
 (0)