Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
cerated own directory for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Feb 3, 2015
1 parent 3c041da commit d8a4270
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -26,3 +26,6 @@ node_modules

# Users Environment Variables
.lock-wscript

# video files
*.y4m
59 changes: 0 additions & 59 deletions example.js

This file was deleted.

61 changes: 61 additions & 0 deletions examples/getstats.demo.js
@@ -0,0 +1,61 @@
var WebdriverIO = require('webdriverio'),
WebdriverRTC = require('../'),
path = require('path'),
fs = require('fs'),
args = [
"use-fake-device-for-media-stream",
"use-fake-ui-for-media-stream"
];

/**
* check if fake videos exist
*/
var argsBrowserA = args.slice(0, args.length);
if(fs.existsSync(path.join(__dirname, '..', 'sign_irene_qcif.y4m'))) {
argsBrowserA.push('use-file-for-fake-video-capture=' + path.join(__dirname, '..', 'sign_irene_qcif.y4m'))
}
var argsBrowserB = args.slice(0, args.length);
if(fs.existsSync(path.join(__dirname, '..', 'silent_qcif.y4m'))) {
argsBrowserB.push('use-file-for-fake-video-capture=' + path.join(__dirname, '..', 'silent_qcif.y4m'))
}

var matrix = WebdriverIO.multiremote({
browserA: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: { args: argsBrowserA }
}
},
browserB: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: { args: argsBrowserB }
}
}
});

WebdriverRTC.init(matrix);

var channel = Math.round(Math.random() * 100000000000);

matrix
.init()
.url('https://apprtc.appspot.com/r/' + channel)
.click('#confirm-join-button')
.pause(5000)
.startAnalyzing({
selectorMethod: function() {
return appController.call_.pcClient_.pc_;
}
})
.getConnectionInformation(function(err, connectionType) {
console.log(connectionType);
})
.pause(10000)
.getStats(10000, function(err, mean, median, max, min) {
console.log('mean:', mean);
console.log('median:', median);
console.log('max:', max);
console.log('min:', min);
})
.end();

0 comments on commit d8a4270

Please sign in to comment.