Remove the Messenger app from trunk
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - messenger - Hooks, preferences and sidebox-menus and other hooks
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Hadi Nategh <hn[at]stylite.de>
|
||||
* @package messenger
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2014 by Stylite AG
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class containing admin, preferences and sidebox-menus and other hooks
|
||||
*/
|
||||
class messenger_hooks
|
||||
{
|
||||
/*
|
||||
* Messsenger App Name
|
||||
*/
|
||||
static $APPNAME = 'messenger';
|
||||
|
||||
/**
|
||||
* Hook called by link-class to include Messenger in the appregistry of the linkage
|
||||
*
|
||||
* @return array with method-names
|
||||
*/
|
||||
static function search_link()
|
||||
{
|
||||
return array(
|
||||
'dialog'=> array(
|
||||
'menuaction' => 'messenger.messenger_ui.dialog',
|
||||
),
|
||||
'dialog_id'=> 'id',
|
||||
'dialog_popup' => '480x420',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sidebox menu hook
|
||||
*
|
||||
* @param array|string $hook_data
|
||||
*/
|
||||
static function sidebox_menu($hook_data)
|
||||
{
|
||||
$menu_title = $GLOBALS['egw_info']['apps'][self::$APPNAME]['title'];
|
||||
$file = Array(
|
||||
'Add' => "javascript:egw_openWindowCentered2('".
|
||||
egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.edit'),false).
|
||||
"','_blank',870,480,'yes')",
|
||||
array(
|
||||
'text' => '<div id="messenger_contacts_sidebox"/>',
|
||||
'no_lang' => true,
|
||||
'link' => false,
|
||||
'icon' => false,
|
||||
),
|
||||
'menuOpened' => true
|
||||
);
|
||||
|
||||
// Display Contacts
|
||||
display_sidebox(self::$APPNAME,lang('Contacts'),$file);
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
$file = Array(
|
||||
'Site configuration' => egw::link('/index.php',array(
|
||||
'menuaction' => 'admin.uiconfig.index',
|
||||
'appname' => self::$APPNAME,
|
||||
)));
|
||||
}
|
||||
// Display Admin menu
|
||||
display_sidebox(self::$APPNAME,lang('Admin'),$file);
|
||||
}
|
||||
|
||||
}
|
@ -1,187 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - messenger - PHP UI definition
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Hadi Nategh <hn[at]stylite.de>
|
||||
* @package messenger
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2014 by Stylite AG
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
class messenger_ui extends admin_accesslog
|
||||
{
|
||||
/**
|
||||
* Public functions
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
var $public_functions = array(
|
||||
'dialog' => true,
|
||||
'index' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a conversation dialog with Video,Audio and Message exchange availability
|
||||
*
|
||||
* @param type $content
|
||||
*/
|
||||
function dialog($content=null)
|
||||
{
|
||||
|
||||
egw_framework::csp_connect_src_attrs(array("http://".$_SERVER['HTTP_HOST'],"ws://".$_SERVER['HTTP_HOST']));
|
||||
|
||||
$tmpl = new etemplate_new('messenger.dialog');
|
||||
$content['account_id'] = $_GET['id'];
|
||||
$content['type'] = $_GET['type'];
|
||||
|
||||
|
||||
$tmpl->exec('messenger.messenger_ui.dialog', $content,array(),array(),array(),array(),2);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of available users
|
||||
*
|
||||
* @param type $content
|
||||
*/
|
||||
function index($content=null)
|
||||
{
|
||||
egw_framework::csp_connect_src_attrs(array("http://".$_SERVER['HTTP_HOST'],"ws://".$_SERVER['HTTP_HOST']));
|
||||
|
||||
if (!isset($content))
|
||||
{
|
||||
$content['nm'] = array (
|
||||
'get_rows' => 'messenger.messenger_ui.get_rows',
|
||||
'no_filter' => True, // I disable the 1. filter
|
||||
'no_filter2' => True, // I disable the 2. filter (params are the same as for filter)
|
||||
'no_cat' => True, // I disable the cat-selectbox
|
||||
'sort' => 'DESC',
|
||||
'session_list' => 'active', // Choose active users from session
|
||||
'row_id' => 'account_id',
|
||||
'actions' => $this->get_actions(),
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
$tmpl = new etemplate_new('messenger.index');
|
||||
|
||||
// Initialise the toolbar actions
|
||||
$tmpl->setElementAttribute('dialog[indexToolbar]', 'actions', self::get_toolbarActions());
|
||||
|
||||
return $tmpl->exec('messenger.messenger_ui.index', $content, array(),array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends notification from calller to callee, and opens a conversation dialog for callee
|
||||
*
|
||||
* @param array $_param
|
||||
*/
|
||||
function ajax_makeChat (array $_param)
|
||||
{
|
||||
if (is_array($_param))
|
||||
{
|
||||
$account_id = (int)$_param[0];
|
||||
$chatType = $_param[1];
|
||||
}
|
||||
if ($account_id && is_int($account_id))
|
||||
{
|
||||
$egwPush_Obj = new egw_json_push($account_id);
|
||||
$egwPush_Obj->call("egw.open_link",'messenger.messenger_ui.dialog&id='.$GLOBALS['egw_info']['user']['account_id'].'&type='.$chatType,'_blank','600x750','messenger',true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create actions for nm action
|
||||
*
|
||||
* @return array an array of actions
|
||||
*/
|
||||
public static function get_actions ()
|
||||
{
|
||||
$actions = array(
|
||||
'chat' => array (
|
||||
'caption' => 'Send MSG',
|
||||
'default' => true,
|
||||
'url' => 'menuaction=messenger.messenger_ui.dialog&id=$id',
|
||||
'popup' => egw_link::get_registry('messenger', 'dialog_popup'),
|
||||
),
|
||||
'call' => array (
|
||||
'caption' => 'Call',
|
||||
'onExecute' => 'javaScript:app.messenger.makeCall',
|
||||
'popup' => egw_link::get_registry('messenger', 'dialog_popup')
|
||||
)
|
||||
);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* query rows for the nextmatch widget
|
||||
*
|
||||
* @param array $query with keys 'start', 'search', 'order', 'sort', 'col_filter'
|
||||
* @param array &$rows returned rows/competitions
|
||||
* @param array &$readonlys eg. to disable buttons based on acl, not use here, maybe in a derived class
|
||||
* @return int total number of rows
|
||||
*/
|
||||
function get_rows($query,&$rows,&$readonlys)
|
||||
{
|
||||
// Avoid to show own user name on the list
|
||||
$query['col_filter'][4] = "(account_id !=". $GLOBALS['egw_info']['user']['account_id']. ")";
|
||||
|
||||
$total = parent::get_rows($query, $rows, $readonlys);
|
||||
return $total || array();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function generates toolbar actions
|
||||
*
|
||||
* @return array an array of actions
|
||||
*/
|
||||
public static function get_toolbarActions ()
|
||||
{
|
||||
$actions = array (
|
||||
'call' => array(
|
||||
'caption' => 'Call',
|
||||
'icon' => 'call',
|
||||
'onExecute' => 'javaScript:app.messenger.toolbarActions',
|
||||
'popup' => egw_link::get_registry('messenger', 'dialog_popup'),
|
||||
),
|
||||
'vcall' => array(
|
||||
'caption' => 'Video call',
|
||||
'icon' => 'video_call',
|
||||
'onExecute' => 'javaScript:app.messenger.toolbarActions',
|
||||
'popup' => egw_link::get_registry('messenger', 'dialog_popup'),
|
||||
),
|
||||
'hangup' => array (
|
||||
'caption' => 'Hangup',
|
||||
'icon' => 'hangup',
|
||||
'onExecute' => 'javaScript:app.messenger.toolbarActions',
|
||||
),
|
||||
'video' => array(
|
||||
'caption' => 'Video',
|
||||
'icon' => 'camera',
|
||||
'checkbox' => true,
|
||||
'onExecute' => 'javaScript:app.messenger.toolbarActions',
|
||||
),
|
||||
'micro' => array(
|
||||
'caption' => 'Microphone',
|
||||
'icon' => 'microphone',
|
||||
'checkbox' => true,
|
||||
'onExecute' => 'javaScript:app.messenger.toolbarActions',
|
||||
),
|
||||
|
||||
);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
/**
|
||||
* EGroupware - messenger - Javascript UI
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Hadi Nategh <hn[at]stylite.de>
|
||||
* @package messenger
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2014 by Stylite AG
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
app.classes.messenger = AppJS.extend(
|
||||
{
|
||||
appname:'messenger',
|
||||
|
||||
connection:{},
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @memberOf app.messenger
|
||||
*/
|
||||
init: function ()
|
||||
{
|
||||
var self = this;
|
||||
var scripts = ['/socket.io/socket.io/socket.io.js','messenger/js/easyrtc/easyrtc.js'];
|
||||
egw_LAB.script(scripts).wait(function(){
|
||||
// Ready to make connection
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
destroy: function()
|
||||
{
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* This function is called when the etemplate2 object is loaded
|
||||
* and ready. If you must store a reference to the et2 object,
|
||||
* make sure to clean it up in destroy().
|
||||
*
|
||||
* @param {etemplate2} et2 newly ready object
|
||||
* @param {string} name
|
||||
*/
|
||||
et2_ready: function (et2,name)
|
||||
{
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
switch (name)
|
||||
{
|
||||
case 'messenger.dialog':
|
||||
|
||||
break;
|
||||
case 'messenger.index':
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize webrtc connection
|
||||
*/
|
||||
_init_webrtc: function ()
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
makeCall: function ()
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Get account label of a specific account_id
|
||||
* @param {type} _account_id
|
||||
* @returns {account.label} account label
|
||||
*/
|
||||
getAccountName: function (_account_id)
|
||||
{
|
||||
var accounts = egw.accounts('accounts');
|
||||
for (var account in accounts)
|
||||
{
|
||||
if (account.value == _account_id) return account.label;
|
||||
}
|
||||
},
|
||||
|
||||
userOnSelect: function (_rowId)
|
||||
{
|
||||
var id = _rowId[0].split('::')[1];
|
||||
},
|
||||
|
||||
/**
|
||||
* Index toolbar actions, handles selected toolbar actions and redirect them to
|
||||
* its related functionallity.
|
||||
*
|
||||
* @param {action object} _action selected toolbar action
|
||||
*/
|
||||
toolbarActions: function (_action)
|
||||
{
|
||||
var nm = this.et2.getWidgetById('nm');
|
||||
if (nm && _action)
|
||||
{
|
||||
var uid = nm.getSelection()['ids'][0];
|
||||
if (!uid) return;
|
||||
|
||||
switch (_action.id)
|
||||
{
|
||||
case 'call':
|
||||
// make call to selected uid
|
||||
this.makeCall(_action, {0:{id:uid}});
|
||||
break;
|
||||
case 'micro':
|
||||
//TODO
|
||||
case 'video':
|
||||
//TODO
|
||||
case 'video_call':
|
||||
//TODO
|
||||
case 'hangup':
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
@ -1,32 +0,0 @@
|
||||
EasyRTC Server Example
|
||||
======================
|
||||
|
||||
This folder contains all the files you'll need to create a simple server with EasyRTC, Express, and Socket.io. You can copy these files where you wish.
|
||||
|
||||
Files and Folders:
|
||||
------------------
|
||||
|
||||
- package.json - Provides project information allowing npm to find and install required modules.
|
||||
- server.js - Server code.
|
||||
- /static/ - Root folder for web server. Put html files here!
|
||||
|
||||
|
||||
Installing Required Modules:
|
||||
----------------------------
|
||||
|
||||
- Type `npm install` in console.
|
||||
- This will read the package.json file to find and install the required modules including EasyRTC, Express, and Socket.io.
|
||||
- Required modules will go into a new 'node_modules' subfolder
|
||||
|
||||
|
||||
Running the Server:
|
||||
-------------------
|
||||
|
||||
- Type `node server` in console.
|
||||
|
||||
|
||||
Viewing the examples:
|
||||
---------------------
|
||||
|
||||
- In your WebRTC enabled browser, visit your server address including the port. By default port 8080 is used.
|
||||
- http://localhost:8080/
|
182
messenger/js/easyrtc/node_modules/easyrtc/.npmignore
generated
vendored
@ -1,182 +0,0 @@
|
||||
# This file is used to restrict unnecessary files from being committed to git.
|
||||
# It the same as the recommended default, but with an addition of restricting
|
||||
# node_modules from being committed and .log files.
|
||||
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish
|
||||
|
||||
# Others
|
||||
[Bb]in
|
||||
[Oo]bj
|
||||
sql
|
||||
TestResults
|
||||
*.Cache
|
||||
ClientBin
|
||||
stylecop.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
|
||||
|
||||
############
|
||||
## Windows
|
||||
############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
#########
|
||||
# Node.js
|
||||
#########
|
||||
node_modules
|
||||
|
||||
#########
|
||||
# EasyRTC
|
||||
#########
|
||||
*.log
|
||||
config_override.js
|
||||
nbproject
|
||||
/.idea
|
||||
desktopCapture
|
||||
/api/labs/desktopCapture
|
23
messenger/js/easyrtc/node_modules/easyrtc/LICENSE
generated
vendored
@ -1,23 +0,0 @@
|
||||
Copyright (c) 2014, Priologic Software Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
147
messenger/js/easyrtc/node_modules/easyrtc/README.md
generated
vendored
@ -1,147 +0,0 @@
|
||||
![EasyRTC](./api/img/easyrtc.png "EasyRTC")
|
||||
|
||||
EasyRTC
|
||||
=======
|
||||
|
||||
**A bundle of Open Source WebRTC joy!**
|
||||
|
||||
Priologic's EasyRTC, a bundle of Open Source WebRTC joy, incorporates an EasyRTC server install and client API, and working, HTML5 and JavaScript, application source code under a BSD 2 license.
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
* Install EasyRTC's WebRTC Server on your own Linux, Windows, or Mac server in minutes not days.
|
||||
* Use our EasyRTC API and sample application code to build and deploy your WebRTC app in hours not weeks.
|
||||
* EasyRTC is completely free and open source under a BSD 2 license. No usage costs or other hidden fees.
|
||||
|
||||
|
||||
Installation In A Nutshell
|
||||
--------------------------
|
||||
1. Install [Node.js](http://nodejs.org)
|
||||
2. Download files from [server_example/](./server_example/) and place them in a local folder of your choice.
|
||||
- [package.json](./server_example/package.json)
|
||||
- [server.js](./server_example/server.js)
|
||||
- OR [download and extract this .zip](http://easyrtc.com/files/easyrtc_server_example.zip)
|
||||
3. Run `npm install` from the installation folder to install dependent packages (including EasyRTC)
|
||||
4. Start EasyRTC by running `node server.js`
|
||||
5. Browse the examples using a WebRTC enabled browser. *(defaults to port `8080`)*
|
||||
|
||||
Step by step instructions including additional setup options can be found in `/docs/easyrtc_server_install.md`
|
||||
|
||||
Note: there is no corresponding need to install the client files specifically; they were installed as part of EasyRTC in step 3.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
All documentation can be found within [the docs folder](./docs/).
|
||||
|
||||
**EasyRTC Server**
|
||||
|
||||
* [Install instructions for Ubuntu, Windows, and Mac](./docs/easyrtc_server_install.md)
|
||||
* `/docs/easyrtc_server_install.md`
|
||||
* [Configuration options](./docs/easyrtc_server_configuration.md)
|
||||
* `/docs/easyrtc_server_configuration.md`
|
||||
* [Using Server Events](./docs/easyrtc_server_events.md)
|
||||
* `/docs/easyrtc_server_events.md`
|
||||
* Server API
|
||||
* `/docs/server_html_docs/index.html`
|
||||
|
||||
**EasyRTC Client API**
|
||||
* [Client API tutorial](./docs/easyrtc_client_tutorial.md)
|
||||
* `/docs/easyrtc_client_tutorial.md`
|
||||
* Client API
|
||||
* `/docs/client_html_docs/easyrtc.html`
|
||||
* Client File Transfer API
|
||||
* `/docs/client_html_docs/easyrtc_ft.html`
|
||||
|
||||
**General Development**
|
||||
* [Frequently asked questions](./docs/easyrtc_faq.md)
|
||||
* `/docs/easyrtc_faq.md`
|
||||
* [Authentication](./docseasyrtc_authentication.md/)
|
||||
* `/docs/easyrtc_authentication.md`
|
||||
* [ICE, TURN, STUN Configuration](./docs/easyrtc_server_ice.md)
|
||||
* `/docs/easyrtc_server_ice.md`
|
||||
* [Using Rooms](./docs/easyrtc_rooms.md)
|
||||
* `/docs/easyrtc_rooms.md`
|
||||
* [Serving with SSL](./docs/easyrtc_server_ssl.md)
|
||||
* `/docs/easyrtc_server_ssl.md`
|
||||
* [Serving next to IIS or Apache](./docs/easyrtc_with_other_servers.md)
|
||||
* `/docs/easyrtc_with_other_servers.md`
|
||||
* [Upcoming features](./docs/easyrtc_upcoming_features.md)
|
||||
* `/docs/easyrtc_upcoming_features.md`
|
||||
* [Changelog](./docs/easyrtc_changelog.md)
|
||||
* `/docs/easyrtc_changelog.md`
|
||||
|
||||
|
||||
Folder Structure
|
||||
----------------
|
||||
|
||||
* / (root)
|
||||
* Licenses and package information
|
||||
* /api/
|
||||
* Client API files including easyrtc.js
|
||||
* /demos/
|
||||
* EasyRTC live demos and example code
|
||||
* /docs/
|
||||
* Documentation for using the API and running the server
|
||||
* /lib/
|
||||
* Required libraries
|
||||
* /node_modules/
|
||||
* Required node.js modules
|
||||
* This folder will be created during the install
|
||||
* /server_example/
|
||||
* A simple server example
|
||||
|
||||
|
||||
Included Demos
|
||||
--------------
|
||||
|
||||
EasyRTC comes with a number of demo's which work immediately after installation.
|
||||
|
||||
* Video and/or Audio connections
|
||||
* Multi-party video chat
|
||||
* Text Messaging with or without Data Channels
|
||||
* Screen and tab sharing
|
||||
* File transfer
|
||||
|
||||
|
||||
Links for help and information
|
||||
------------------------------
|
||||
|
||||
* The EasyRTC website is at:
|
||||
* [http://www.easyrtc.com/](http://www.easyrtc.com/)
|
||||
* Use our support forum is at:
|
||||
* [https://groups.google.com/forum/#!forum/easyrtc](https://groups.google.com/forum/#!forum/easyrtc)
|
||||
* Live demo site:
|
||||
* [http://demo.easyrtc.com/](http://demo.easyrtc.com/)
|
||||
* Bugs and requests can be filed on our github page or on the forum:
|
||||
* [https://github.com/priologic/easyrtc/issues](https://github.com/priologic/easyrtc/issues)
|
||||
* Our YouTube channel has live demo's:
|
||||
* [http://www.youtube.com/user/priologic](http://www.youtube.com/user/priologic)
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright (c) 2014, Priologic Software Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
184
messenger/js/easyrtc/node_modules/easyrtc/api/adapter.js
generated
vendored
@ -1,184 +0,0 @@
|
||||
//
|
||||
// the below code is a copy of the standard polyfill adapter.js
|
||||
//
|
||||
var getUserMedia = null;
|
||||
var attachMediaStream = null;
|
||||
var reattachMediaStream = null;
|
||||
var webrtcDetectedBrowser = null;
|
||||
var webrtcDetectedVersion = null;
|
||||
if (navigator.mozGetUserMedia) {
|
||||
// console.log("This appears to be Firefox");
|
||||
|
||||
webrtcDetectedBrowser = "firefox";
|
||||
|
||||
//
|
||||
// better version detection for gecko based browsers provided by
|
||||
// Kévin Poulet.
|
||||
//
|
||||
var matches = navigator.userAgent.match(/\srv:([0-9]+)\./);
|
||||
if (matches !== null && matches.length > 1) {
|
||||
webrtcDetectedVersion = parseInt(matches[1]);
|
||||
}
|
||||
|
||||
// The RTCPeerConnection object.
|
||||
window.RTCPeerConnection = mozRTCPeerConnection;
|
||||
// The RTCSessionDescription object.
|
||||
window.RTCSessionDescription = mozRTCSessionDescription;
|
||||
// The RTCIceCandidate object.
|
||||
window.RTCIceCandidate = mozRTCIceCandidate;
|
||||
// Get UserMedia (only difference is the prefix).
|
||||
// Code from Adam Barth.
|
||||
window.getUserMedia = navigator.mozGetUserMedia.bind(navigator);
|
||||
// Creates iceServer from the url for FF.
|
||||
window.createIceServer = function(url, username, password) {
|
||||
var iceServer = null;
|
||||
var url_parts = url.split(':');
|
||||
var turn_url_parts;
|
||||
if (url_parts[0].indexOf('stun') === 0) {
|
||||
// Create iceServer with stun url.
|
||||
iceServer = {'url': url};
|
||||
} else if (url_parts[0].indexOf('turn') === 0 &&
|
||||
(url.indexOf('transport=udp') !== -1 ||
|
||||
url.indexOf('?transport') === -1)) {
|
||||
// Create iceServer with turn url.
|
||||
// Ignore the transport parameter from TURN url.
|
||||
turn_url_parts = url.split("?");
|
||||
iceServer = {'url': turn_url_parts[0],
|
||||
'credential': password,
|
||||
'username': username};
|
||||
}
|
||||
return iceServer;
|
||||
};
|
||||
// Attach a media stream to an element.
|
||||
attachMediaStream = function(element, stream) {
|
||||
// console.log("Attaching media stream");
|
||||
element.mozSrcObject = stream;
|
||||
element.play();
|
||||
};
|
||||
reattachMediaStream = function(to, from) {
|
||||
// console.log("Reattaching media stream");
|
||||
to.mozSrcObject = from.mozSrcObject;
|
||||
to.play();
|
||||
};
|
||||
if (webrtcDetectedVersion < 23) {
|
||||
// Fake get{Video,Audio}Tracks
|
||||
MediaStream.prototype.getVideoTracks = function() {
|
||||
return [];
|
||||
};
|
||||
MediaStream.prototype.getAudioTracks = function() {
|
||||
return [];
|
||||
};
|
||||
}
|
||||
} else if (navigator.webkitGetUserMedia) {
|
||||
// console.log("This appears to be Chrome");
|
||||
|
||||
webrtcDetectedBrowser = "chrome";
|
||||
webrtcDetectedVersion =
|
||||
parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]);
|
||||
// Creates iceServer from the url for Chrome.
|
||||
window.createIceServer = function(url, username, password) {
|
||||
var iceServer = null;
|
||||
var url_turn_parts;
|
||||
var url_parts = url.split(':');
|
||||
if (url_parts[0].indexOf('stun') === 0) {
|
||||
// Create iceServer with stun url.
|
||||
iceServer = {'url': url};
|
||||
} else if (url_parts[0].indexOf('turn') === 0) {
|
||||
if (webrtcDetectedVersion < 28) {
|
||||
// For pre-M28 chrome versions use old TURN format.
|
||||
url_turn_parts = url.split("turn:");
|
||||
iceServer = {'url': 'turn:' + username + '@' + url_turn_parts[1],
|
||||
'credential': password};
|
||||
} else {
|
||||
// For Chrome M28 & above use new TURN format.
|
||||
iceServer = {'url': url,
|
||||
'credential': password,
|
||||
'username': username};
|
||||
}
|
||||
}
|
||||
return iceServer;
|
||||
};
|
||||
// The RTCPeerConnection object.
|
||||
window.RTCPeerConnection = webkitRTCPeerConnection;
|
||||
// Get UserMedia (only difference is the prefix).
|
||||
// Code from Adam Barth.
|
||||
window.getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
|
||||
// Attach a media stream to an element.
|
||||
attachMediaStream = function(element, stream) {
|
||||
if (typeof element.srcObject !== 'undefined') {
|
||||
element.srcObject = stream;
|
||||
} else if (typeof element.mozSrcObject !== 'undefined') {
|
||||
element.mozSrcObject = stream;
|
||||
} else if (typeof element.src !== 'undefined') {
|
||||
element.src = URL.createObjectURL(stream);
|
||||
} else {
|
||||
console.log('Error attaching stream to element.');
|
||||
}
|
||||
};
|
||||
reattachMediaStream = function(to, from) {
|
||||
to.src = from.src;
|
||||
};
|
||||
// The representation of tracks in a stream is changed in M26.
|
||||
// Unify them for earlier Chrome versions in the coexisting period.
|
||||
if (!webkitMediaStream.prototype.getVideoTracks) {
|
||||
webkitMediaStream.prototype.getVideoTracks = function() {
|
||||
return this.videoTracks;
|
||||
};
|
||||
webkitMediaStream.prototype.getAudioTracks = function() {
|
||||
return this.audioTracks;
|
||||
};
|
||||
}
|
||||
|
||||
// New syntax of getXXXStreams method in M26.
|
||||
if (!webkitRTCPeerConnection.prototype.getLocalStreams) {
|
||||
webkitRTCPeerConnection.prototype.getLocalStreams = function() {
|
||||
return this.localStreams;
|
||||
};
|
||||
webkitRTCPeerConnection.prototype.getRemoteStreams = function() {
|
||||
return this.remoteStreams;
|
||||
};
|
||||
}
|
||||
//} else if( window.ActiveXObject ){ // appears to IE so check for the wrapper.
|
||||
// var head = document.getElementsByTagName('head')[0];
|
||||
// var i;
|
||||
// var adapterAddress;
|
||||
// var wrapperPresent = false;
|
||||
//
|
||||
// //
|
||||
// // we look for the adapter as well as the wrapper because if we don't find the
|
||||
// // wrapper, we'll look for it in the same directory as the adapter was found.
|
||||
// //
|
||||
// for( i = 0; i < head.childNodes.length; i++) {
|
||||
// var child = head.childNodes[i];
|
||||
// if( /\/adapter.js$/.test(child.src)) {
|
||||
// adapterAddress = child.src;
|
||||
// }
|
||||
// else if( /\/rtcplugin.js$/.test(child.src)) {
|
||||
// wrapperPresent = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if( wrapperPresent) {
|
||||
// addIEDeclarations();
|
||||
// }
|
||||
// else if( adapterAddress) {
|
||||
// var script = document.createElement('script');
|
||||
// script.type = 'text/javascript';
|
||||
// script.src = adapterAddress.replace(/\/adapter.js$/, "/rtcplugin.js");
|
||||
// src.onload = addIEDeclarations;
|
||||
// src.onerror = function () {
|
||||
// alert("Developer error: this page requires the Priologic IE Webrtc plugin wrapper (rtcplugin.js) to run when using Internet Explorer, which the developer has not supplied.");
|
||||
// throw new Error("No rtcplugin.js found. It should be in the same folder as your adapter.js or you can include it yourself before the adapter.js");
|
||||
// }
|
||||
// head.appendChild(script);
|
||||
// }
|
||||
} else {
|
||||
console.log("Browser does not appear to be WebRTC-capable");
|
||||
}
|
||||
|
||||
if (!window.createIceServer) {
|
||||
window.createIceServer = function(url, username, credential) {
|
||||
return {'url': url, 'credential': credential, 'username': username};
|
||||
};
|
||||
}
|
1
messenger/js/easyrtc/node_modules/easyrtc/api/buildEnglishVersions.bat
generated
vendored
@ -1 +0,0 @@
|
||||
type adapter.js easyrtc_int.js easyrtc_lang_en.js > easyrtc.js
|
2
messenger/js/easyrtc/node_modules/easyrtc/api/buildEnglishVersions.sh
generated
vendored
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
cat adapter.js easyrtc_int.js easyrtc_lang_en.js > easyrtc.js
|
74
messenger/js/easyrtc/node_modules/easyrtc/api/easyrtc.css
generated
vendored
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* These styles define the appearance of the default error dialog box.
|
||||
*/
|
||||
#easyrtcErrorDialog {
|
||||
background-color: #ffe0e0;
|
||||
|
||||
position:fixed;
|
||||
right: 10px;
|
||||
top:20px;
|
||||
z-index: 30;
|
||||
opacity: 0.95;
|
||||
padding: 0.5em;
|
||||
border-radius:10px;
|
||||
border-color: red;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
-webkit-box-shadow: 2px 2px 8px 1px rgba(0,0,0,0.9);
|
||||
box-shadow: 2px 2px 8px 1px rgba(0,0,0,0.9);
|
||||
}
|
||||
|
||||
.easyrtcErrorDialog_title {
|
||||
position:static;
|
||||
text-align:center;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5em;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#easyrtcErrorDialog_body{
|
||||
position:static;
|
||||
height:150px;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
.easyrtcErrorDialog_element {
|
||||
position:static;
|
||||
font-style: italic;
|
||||
font-size: 12px;
|
||||
width:300px;
|
||||
margin-bottom: 0.5em;
|
||||
clear: both;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.easyrtcErrorDialog_okayButton {
|
||||
position:static;
|
||||
clear:both;
|
||||
float:right;
|
||||
}
|
||||
|
||||
.easyrtcMirror {
|
||||
-webkit-transform: scaleX(-1);
|
||||
-moz-transform: scaleX(-1);
|
||||
-ms-transform: scaleX(-1);
|
||||
-o-transform: scaleX(-1);
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
.easyrtc_closeButton {
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
height:40px;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><g stroke="#b0b0b0" stroke-width="7" ><g> <path d="M76.03,79.854c-0.979,0-1.958-0.373-2.704-1.12L21.184,26.592c-1.494-1.494-1.494-3.915,0-5.409c1.494-1.493,3.915-1.493,5.409,0l52.143,52.142c1.494,1.494,1.494,3.915,0,5.409C77.988,79.481,77.01,79.854,76.03,79.854z"/></g><g><path d="M23.888,79.854c-0.979,0-1.958-0.373-2.704-1.12c-1.494-1.494-1.494-3.915,0-5.409l52.142-52.142c1.493-1.493,3.915-1.493,5.409,0c1.494,1.494,1.494,3.915,0,5.409L26.593,78.734C25.846,79.481,24.867,79.854,23.888,79.854z"/></g></g><g fill="#000000"><g><path d="M76.03,79.854c-0.979,0-1.958-0.373-2.704-1.12L21.184,26.592c-1.494-1.494-1.494-3.915,0-5.409c1.494-1.493,3.915-1.493,5.409,0l52.143,52.142c1.494,1.494,1.494,3.915,0,5.409C77.988,79.481,77.01,79.854,76.03,79.854z"/></g><g><path d="M23.888,79.854c-0.979,0-1.958-0.373-2.704-1.12c-1.494-1.494-1.494-3.915,0-5.409l52.142-52.142c1.493-1.493,3.915-1.493,5.409,0c1.494,1.494,1.494,3.915,0,5.409L26.593,78.734C25.846,79.481,24.867,79.854,23.888,79.854z"/></g></g></svg>');
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.easyrtc_closeButton:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
5468
messenger/js/easyrtc/node_modules/easyrtc/api/easyrtc.js
generated
vendored
748
messenger/js/easyrtc/node_modules/easyrtc/api/easyrtc_ft.js
generated
vendored
@ -1,748 +0,0 @@
|
||||
/** @class
|
||||
*@version 1.0.13
|
||||
*<p>
|
||||
* Provides support file and data transfer support to easyrtc.
|
||||
* </p>
|
||||
*<p>
|
||||
*copyright Copyright (c) 2014, Priologic Software Inc.
|
||||
*All rights reserved.</p>
|
||||
*
|
||||
*<p>
|
||||
*Redistribution and use in source and binary forms, with or without
|
||||
*modification, are permitted provided that the following conditions are met:
|
||||
*</p>
|
||||
* <ul>
|
||||
* <li> Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. </li>
|
||||
* <li> Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution. </li>
|
||||
*</ul>
|
||||
*<p>
|
||||
*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
*AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
*IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
*ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
*LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
*CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
*SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
*INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
*CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
*POSSIBILITY OF SUCH DAMAGE.
|
||||
*</p>
|
||||
*/
|
||||
|
||||
|
||||
var easyrtc_ft = {};
|
||||
|
||||
/**
|
||||
* Establish an area as a drag-n-drop drop site for files.
|
||||
* @param {DOMString} droptargetName - the id of the drag-and-drop site or the actual DOM object.
|
||||
* @param {Function} filesHandler - function that accepts an array of File's.
|
||||
*/
|
||||
easyrtc_ft.buildDragNDropRegion = function(droptargetName, filesHandler) {
|
||||
var droptarget;
|
||||
if (typeof droptargetName === 'string') {
|
||||
droptarget = document.getElementById(droptargetName);
|
||||
if (!droptarget) {
|
||||
alert("Developer error: attempt to call BuildFileSender on unknown object " + droptargetName);
|
||||
throw("unknown object " + droptargetName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
droptarget = droptargetName;
|
||||
}
|
||||
|
||||
|
||||
function ignore(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function drageventcancel(e) {
|
||||
if (e.preventDefault)
|
||||
e.preventDefault(); // required by FF + Safari
|
||||
e.dataTransfer.dropEffect = 'copy'; // tells the browser what drop effect is allowed here
|
||||
return false; // required by IE
|
||||
}
|
||||
|
||||
function dropHandler(e) {
|
||||
removeClass(droptarget, dropCueClass);
|
||||
var dt = e.dataTransfer;
|
||||
var files = dt.files;
|
||||
if (dt.files.length > 0) {
|
||||
try {
|
||||
filesHandler(files);
|
||||
} catch (errorEvent) {
|
||||
console.log("dragndrop errorEvent", errorEvent);
|
||||
}
|
||||
}
|
||||
return ignore(e);
|
||||
}
|
||||
|
||||
|
||||
var dropCueClass = "easyrtcfiledrop";
|
||||
|
||||
function dragEnterHandler(e) {
|
||||
addClass(droptarget, dropCueClass);
|
||||
return drageventcancel(e);
|
||||
}
|
||||
|
||||
|
||||
function dragLeaveHandler(e) {
|
||||
removeClass(droptarget, dropCueClass);
|
||||
return drageventcancel(e);
|
||||
}
|
||||
|
||||
var addEvent = (function() {
|
||||
if (document.addEventListener) {
|
||||
return function(el, type, fn) {
|
||||
if (el && el.nodeName || el === window) {
|
||||
el.addEventListener(type, fn, false);
|
||||
} else if (el && el.length) {
|
||||
for (var i = 0; i < el.length; i++) {
|
||||
addEvent(el[i], type, fn);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return function(el, type, fn) {
|
||||
if (el && el.nodeName || el === window) {
|
||||
el.attachEvent('on' + type, function() {
|
||||
return fn.call(el, window.event);
|
||||
});
|
||||
} else if (el && el.length) {
|
||||
for (var i = 0; i < el.length; i++) {
|
||||
addEvent(el[i], type, fn);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
droptarget.ondrop = dropHandler;
|
||||
droptarget.ondragenter = dragEnterHandler;
|
||||
droptarget.ondragleave = dragLeaveHandler;
|
||||
droptarget.ondragover = drageventcancel;
|
||||
|
||||
function addClass(target, classname) {
|
||||
if (target.className) {
|
||||
if (target.className.indexOf(classname, 0) >= 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
target.className = target.className + " " + classname;
|
||||
}
|
||||
}
|
||||
else {
|
||||
target.className = classname;
|
||||
}
|
||||
target.className = target.className.replace(" ", " ");
|
||||
}
|
||||
|
||||
function removeClass(target, classname) {
|
||||
if (!target.className) {
|
||||
return;
|
||||
}
|
||||
target.className = target.className.replace(classname, "").replace(" ", " ");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a function that can be used to send a group of files to a peer.
|
||||
* @param {String} destUser easyrtcid of the person being sent to.
|
||||
* @param {Function} progressListener - if provided, is called with the following objects:
|
||||
* {status:"waiting"} // once a file offer has been sent but not accepted or rejected yet
|
||||
* {status:"started_file", name: filename}
|
||||
* {status:"working", name:filename, position:position_in_file, size:size_of_current_file, numFiles:number_of_files_left}
|
||||
* {status:"cancelled"} // if the remote user cancels the sending
|
||||
* {status:"done"} // when the file is done
|
||||
* the progressListener should always return true for normal operation, false to cancel a filetransfer.
|
||||
* @return {Function} an object that accepts an array of File (the Files to be sent), and a boolean
|
||||
* argument that is true if the files are binary, false if they are text.
|
||||
* It is safe to treat all files as binary, it will just require more bandwidth.
|
||||
*/
|
||||
easyrtc_ft.buildFileSender = function(destUser, progressListener) {
|
||||
var droptarget;
|
||||
var seq = 0;
|
||||
var positionAcked = 0;
|
||||
var filePosition = 0;
|
||||
var filesOffered = [];
|
||||
var filesBeingSent = [];
|
||||
var sendStarted = false;
|
||||
var curFile = null;
|
||||
var curFileSize;
|
||||
var filesAreBinary;
|
||||
var maxChunkSize = 10 * 1024;
|
||||
var waitingForAck = false;
|
||||
var ackThreshold = 100 * 1024; // send is allowed to be 150KB ahead of receiver
|
||||
var filesWaiting = [];
|
||||
var haveFilesWaiting = false;
|
||||
|
||||
if (!progressListener) {
|
||||
progressListener = function() {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
var roomOccupantListener = function(eventType, eventData) {
|
||||
var roomName;
|
||||
var foundUser = false;
|
||||
for (roomName in eventData) {
|
||||
if (eventData[roomName][destUser]) {
|
||||
foundUser = true;
|
||||
}
|
||||
}
|
||||
if (!foundUser) {
|
||||
easyrtc.removeEventListener("roomOccupant", roomOccupantListener);
|
||||
if (filesBeingSent.length > 0 || filesOffered.length > 0) {
|
||||
progressListener({status: "cancelled"});
|
||||
}
|
||||
}
|
||||
};
|
||||
easyrtc.addEventListener("roomOccupant", roomOccupantListener);
|
||||
//
|
||||
// if a file offer is rejected, we delete references to it.
|
||||
//
|
||||
function fileOfferRejected(sender, msgType, msgData, targeting) {
|
||||
if (!msgData.seq)
|
||||
return;
|
||||
delete filesOffered[msgData.seq];
|
||||
progressListener({status: "rejected"});
|
||||
filesOffered.length = 0;
|
||||
sendFilesWaiting();
|
||||
}
|
||||
//
|
||||
// if a file offer is accepted, initiate sending of files.
|
||||
//
|
||||
function fileOfferAccepted(sender, msgType, msgData, targeting) {
|
||||
if (!msgData.seq || !filesOffered[msgData.seq])
|
||||
return;
|
||||
var alreadySending = filesBeingSent.length > 0;
|
||||
for (var i = 0; i < filesOffered[msgData.seq].length; i++) {
|
||||
filesBeingSent.push(filesOffered[msgData.seq][i]);
|
||||
}
|
||||
delete filesOffered[msgData.seq];
|
||||
if (!alreadySending) {
|
||||
filePosition = 0;
|
||||
sendChunk(); // this starts the file reading
|
||||
}
|
||||
}
|
||||
|
||||
function fileCancelReceived(sender, msgType, msgData, targeting) {
|
||||
filesBeingSent.empty();
|
||||
progressListener({status: "cancelled"});
|
||||
filesOffered.length = 0;
|
||||
filesBeingSent.length = 0;
|
||||
sendStarted = false;
|
||||
sendFilesWaiting();
|
||||
}
|
||||
|
||||
function packageAckReceived(sender, msgType, msgData) {
|
||||
positionAcked = msgData.positionAck;
|
||||
if (waitingForAck && filePosition < positionAcked + ackThreshold) {
|
||||
waitingForAck = false;
|
||||
sendChunk();
|
||||
}
|
||||
}
|
||||
|
||||
easyrtc.setPeerListener(fileOfferRejected, "filesReject", destUser);
|
||||
easyrtc.setPeerListener(fileOfferAccepted, "filesAccept", destUser);
|
||||
easyrtc.setPeerListener(fileCancelReceived, "filesCancel", destUser);
|
||||
easyrtc.setPeerListener(packageAckReceived, "filesAck", destUser);
|
||||
|
||||
|
||||
var outseq = 0;
|
||||
|
||||
function sendChunk() {
|
||||
if (!curFile) {
|
||||
if (filesBeingSent.length === 0) {
|
||||
outseq = 0;
|
||||
easyrtc.sendData(destUser, "filesChunk", {done: "all"});
|
||||
filesOffered.length = 0;
|
||||
progressListener({status: "done"});
|
||||
sendFilesWaiting();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
curFile = filesBeingSent.shift();
|
||||
progressListener({status: "started_file", name: curFile.name});
|
||||
curFileSize = curFile.size;
|
||||
positionAcked = 0;
|
||||
waitingForAck = false;
|
||||
easyrtc.sendData(destUser, "filesChunk", {name: curFile.name, type: curFile.type, outseq: outseq, size: curFile.size});
|
||||
outseq++;
|
||||
}
|
||||
}
|
||||
|
||||
var amountToRead = Math.min(maxChunkSize, curFileSize - filePosition);
|
||||
if (!progressListener({status: "working", name: curFile.name, position: filePosition, size: curFileSize, numFiles: filesBeingSent.length + 1})) {
|
||||
filesOffered.length = 0;
|
||||
filePosition = 0;
|
||||
easyrtc.sendData(destUser, "filesChunk", {done: "cancelled"});
|
||||
sendFilesWaiting();
|
||||
return;
|
||||
}
|
||||
|
||||
var nextLocation = filePosition + amountToRead;
|
||||
var blobSlice = curFile.slice(filePosition, nextLocation);
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function(evt) {
|
||||
if (evt.target.readyState === FileReader.DONE) { // DONE == 2
|
||||
var binaryString = evt.target.result;
|
||||
var maxchar = 32, minchar = 32;
|
||||
for (var pp = 0; pp < binaryString.length; pp++) {
|
||||
var oneChar = binaryString.charCodeAt(pp);
|
||||
maxchar = Math.max(maxchar, oneChar);
|
||||
minchar = Math.min(minchar, oneChar);
|
||||
}
|
||||
var maxPacketSize = 400; // size in bytes
|
||||
for (var pos = 0; pos < binaryString.length; pos += maxPacketSize) {
|
||||
var packetLen = Math.min(maxPacketSize, amountToRead - pos);
|
||||
var packetData = binaryString.substring(pos, pos + packetLen);
|
||||
var packetObject = {outseq: outseq};
|
||||
if (filesAreBinary) {
|
||||
packetObject.data64 = btoa(packetData);
|
||||
}
|
||||
else {
|
||||
packetObject.datatxt = packetData;
|
||||
}
|
||||
easyrtc.sendData(destUser, "filesChunk", packetObject);
|
||||
outseq++;
|
||||
}
|
||||
if (nextLocation >= curFileSize) {
|
||||
easyrtc.sendData(destUser, "filesChunk", {done: "file"});
|
||||
}
|
||||
if (filePosition < positionAcked + ackThreshold) {
|
||||
sendChunk();
|
||||
}
|
||||
else {
|
||||
waitingForAck = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsBinaryString(blobSlice);
|
||||
filePosition = nextLocation;
|
||||
|
||||
// advance to the next file if we've read all of this file
|
||||
if (nextLocation >= curFileSize) {
|
||||
curFile = null;
|
||||
filePosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function sendFilesWaiting() {
|
||||
haveFilesWaiting = false;
|
||||
if (filesWaiting.length > 0) {
|
||||
setTimeout(function() {
|
||||
var fileset = filesWaiting.shift();
|
||||
sendFilesOffer(fileset.files, fileset.areBinary);
|
||||
}, 240);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendFilesOffer(files, areBinary) {
|
||||
if (haveFilesWaiting) {
|
||||
filesWaiting.push({files: files, areBinary: areBinary});
|
||||
}
|
||||
else {
|
||||
haveFilesWaiting = true;
|
||||
filesAreBinary = areBinary;
|
||||
progressListener({status: "waiting"});
|
||||
var fileNameList = [];
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
fileNameList[i] = {name: files[i].name, size: files[i].size};
|
||||
}
|
||||
seq++;
|
||||
filesOffered[seq] = files;
|
||||
easyrtc.sendDataWS(destUser, "filesOffer", {seq: seq, fileNameList: fileNameList});
|
||||
}
|
||||
}
|
||||
return sendFilesOffer;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enable datachannel based file receiving. The received blobs get passed to the statusCB in the 'eof' typed message.
|
||||
* @param {Function(otherGuy,fileNameList, wasAccepted} acceptRejectCB - this function is called when another peer
|
||||
* (otherGuy) offers to send you a list of files. this function should call it's wasAccepted function with true to
|
||||
* allow those files to be sent, or false to disallow them.
|
||||
* @param {Function} blobAcceptor - this function is called three arguments arguments: the suppliers easyrtcid, a blob and a filename. It is responsible for
|
||||
* saving the blob to the file, usually using easyrtc_ft.saveAs.
|
||||
* @param {type} statusCB - this function is called with the current state of file receiving. It is passed two arguments:
|
||||
* otherGuy - the easyrtcid of the person sending the files. *
|
||||
* msg - one of the following structures:
|
||||
* {status:"done", reason:"accept_failed"}
|
||||
* {status:"done", reason:"success"}
|
||||
* {status:"done", reason:"cancelled"}
|
||||
* {status:"eof"},
|
||||
* {status:"started_file, name:"filename"}
|
||||
* {status:"progress", name:filename,
|
||||
* received:received_size_in_bytes,
|
||||
* size:file_size_in_bytes }
|
||||
* @example
|
||||
*
|
||||
* easyrtc_ft(
|
||||
* function(otherGuy, filenamelist, wasAccepted) { wasAccepted(true);},
|
||||
* function(otherGuy, blob, filename) { easyrtc_ft(blob, filename);},
|
||||
* function(otherGuy, status) { console.log("status:" + JSON.stringify(status))}
|
||||
* );
|
||||
*/
|
||||
easyrtc_ft.buildFileReceiver = function(acceptRejectCB, blobAcceptor, statusCB) {
|
||||
var userStreams = {};
|
||||
var ackThreshold = 10000; // receiver is allowed to be 10KB behind of sender
|
||||
var positionAcked = 0;
|
||||
|
||||
var roomOccupantListener = function(eventType, eventData) {
|
||||
var user;
|
||||
var foundUser;
|
||||
var roomName;
|
||||
for (destUser in userStreams) {
|
||||
foundUser = false;
|
||||
for (roomName in eventData) {
|
||||
if (eventData[roomName][destUser]) {
|
||||
foundUser = true;
|
||||
}
|
||||
}
|
||||
if (!foundUser) {
|
||||
easyrtc.removeEventListener("roomOccupant", roomOccupantListener);
|
||||
statusCB(destUser, {status: "done", reason: "cancelled"});
|
||||
delete userStreams[destUser];
|
||||
}
|
||||
}
|
||||
};
|
||||
easyrtc.addEventListener("roomOccupant", roomOccupantListener);
|
||||
|
||||
function fileOfferHandler(otherGuy, msgType, msgData) {
|
||||
if (!userStreams[otherGuy]) {
|
||||
userStreams[otherGuy] = {};
|
||||
}
|
||||
acceptRejectCB(otherGuy, msgData.fileNameList, function(wasAccepted) {
|
||||
var ackHandler = function(ackMesg) {
|
||||
|
||||
if (ackMesg.msgType === "error") {
|
||||
statusCB(otherGuy, {status: "done", reason: "accept_failed"});
|
||||
delete userStreams[otherGuy];
|
||||
}
|
||||
else {
|
||||
statusCB(otherGuy, {status: "started"});
|
||||
}
|
||||
};
|
||||
if (wasAccepted) {
|
||||
userStreams[otherGuy] = {
|
||||
groupSeq: msgData.seq,
|
||||
nextPacketSeq: 0
|
||||
};
|
||||
easyrtc.sendDataWS(otherGuy, "filesAccept", {seq: msgData.seq}, ackHandler);
|
||||
}
|
||||
else {
|
||||
easyrtc.sendDataWS(otherGuy, "filesReject", {seq: msgData.seq});
|
||||
delete userStreams[otherGuy];
|
||||
statusCB(otherGuy, {status: "rejected"});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function fileChunkHandler(otherGuy, msgType, msgData) {
|
||||
var i;
|
||||
var userStream = userStreams[otherGuy];
|
||||
if (!userStream) {
|
||||
return;
|
||||
}
|
||||
if (msgData.done) {
|
||||
switch (msgData.done) {
|
||||
case "file":
|
||||
var blob = new Blob(userStream.currentData, {type: userStream.currentFileType});
|
||||
blobAcceptor(otherGuy, blob, userStream.currentFileName);
|
||||
statusCB(otherGuy, {status: "eof", name: userStream.currentFileName});
|
||||
blob = null;
|
||||
positionAcked = 0;
|
||||
userStream.currentData = [];
|
||||
break;
|
||||
case "all":
|
||||
statusCB(otherGuy, {status: "done", reason: "success"});
|
||||
break;
|
||||
case "cancelled":
|
||||
delete userStreams[otherGuy];
|
||||
statusCB(otherGuy, {status: "done", reason: "cancelled"});
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (msgData.name) {
|
||||
statusCB(otherGuy, {status: "started_file", name: msgData.name});
|
||||
userStream.currentFileName = msgData.name;
|
||||
userStream.currentFileType = msgData.type;
|
||||
userStream.lengthReceived = 0;
|
||||
userStream.lengthExpected = msgData.size;
|
||||
userStream.currentData = [];
|
||||
}
|
||||
else if (msgData.data64 || msgData.datatxt) {
|
||||
var binData;
|
||||
if (msgData.data64) {
|
||||
binData = atob(msgData.data64);
|
||||
}
|
||||
else {
|
||||
binData = msgData.datatxt;
|
||||
}
|
||||
var n = binData.length;
|
||||
var binheap = new Uint8Array(n);
|
||||
for (i = 0; i < n; i += 1) {
|
||||
binheap[i] = binData.charCodeAt(i);
|
||||
}
|
||||
userStream.lengthReceived += n;
|
||||
if (!userStream.currentData) {
|
||||
console.log("Lost my currentData!!!");
|
||||
}
|
||||
userStream.currentData.push(binheap);
|
||||
|
||||
statusCB(otherGuy, {
|
||||
status: "progress",
|
||||
name: userStream.currentFileName,
|
||||
received: userStream.lengthReceived,
|
||||
size: userStream.lengthExpected});
|
||||
if (userStream.lengthReceived > positionAcked + ackThreshold) {
|
||||
positionAcked = userStream.lengthReceived;
|
||||
easyrtc.sendData(otherGuy, "filesAck", {positionAck: positionAcked});
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log("Unexpected data structure in filesChunk=", msgData);
|
||||
}
|
||||
}
|
||||
|
||||
easyrtc.setPeerListener(fileOfferHandler, "filesOffer");
|
||||
easyrtc.setPeerListener(fileChunkHandler, "filesChunk");
|
||||
};
|
||||
|
||||
/** This is a wrapper around Eli Grey's saveAs function. This saves to the browser's downloads directory.
|
||||
* @param {Blob} Blob - the data to be saved.
|
||||
* @param {String} filename - the name of the file the blob should be written to.
|
||||
*/
|
||||
easyrtc_ft.saveAs = (function() {
|
||||
/* FileSaver.js
|
||||
* A saveAs() FileSaver implementation.
|
||||
* 2013-01-23
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* License: X11/MIT
|
||||
* See LICENSE.md
|
||||
*/
|
||||
|
||||
/*global self */
|
||||
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
|
||||
plusplus: true */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
var saveAs = window.saveAs
|
||||
|| (navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
|
||||
|| (function(view) {
|
||||
|
||||
var
|
||||
doc = view.document
|
||||
// only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
|
||||
, get_URL = function() {
|
||||
return view.URL || view.webkitURL || view;
|
||||
}
|
||||
, URL = view.URL || view.webkitURL || view
|
||||
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
||||
, can_use_save_link = !view.externalHost && "download" in save_link
|
||||
, click = function(node) {
|
||||
var event = doc.createEvent("MouseEvents");
|
||||
event.initMouseEvent(
|
||||
"click", true, false, view, 0, 0, 0, 0, 0
|
||||
, false, false, false, false, 0, null
|
||||
);
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
, webkit_req_fs = view.webkitRequestFileSystem
|
||||
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
|
||||
, throw_outside = function(ex) {
|
||||
(view.setImmediate || view.setTimeout)(function() {
|
||||
throw ex;
|
||||
}, 0);
|
||||
}
|
||||
, force_saveable_type = "application/octet-stream"
|
||||
, fs_min_size = 0
|
||||
, deletion_queue = []
|
||||
, process_deletion_queue = function() {
|
||||
var i = deletion_queue.length;
|
||||
while (i--) {
|
||||
var file = deletion_queue[i];
|
||||
if (typeof file === "string") { // file is an object URL
|
||||
URL.revokeObjectURL(file);
|
||||
} else { // file is a File
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
deletion_queue.length = 0; // clear queue
|
||||
}
|
||||
, dispatch = function(filesaver, event_types, event) {
|
||||
event_types = [].concat(event_types);
|
||||
var i = event_types.length;
|
||||
while (i--) {
|
||||
var listener = filesaver["on" + event_types[i]];
|
||||
if (typeof listener === "function") {
|
||||
try {
|
||||
listener.call(filesaver, event || filesaver);
|
||||
} catch (ex) {
|
||||
throw_outside(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, FileSaver = function(blob, name) {
|
||||
// First try a.download, then web filesystem, then object URLs
|
||||
var
|
||||
filesaver = this
|
||||
, type = blob.type
|
||||
, blob_changed = false
|
||||
, object_url
|
||||
, target_view
|
||||
, get_object_url = function() {
|
||||
var object_url = get_URL().createObjectURL(blob);
|
||||
deletion_queue.push(object_url);
|
||||
return object_url;
|
||||
}
|
||||
, dispatch_all = function() {
|
||||
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
||||
}
|
||||
// on any filesys errors revert to saving with object URLs
|
||||
, fs_error = function() {
|
||||
// don't create more object URLs than needed
|
||||
if (blob_changed || !object_url) {
|
||||
object_url = get_object_url(blob);
|
||||
}
|
||||
if (target_view) {
|
||||
target_view.location.href = object_url;
|
||||
} else {
|
||||
window.open(object_url, "_blank");
|
||||
}
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
}
|
||||
, abortable = function(func) {
|
||||
return function() {
|
||||
if (filesaver.readyState !== filesaver.DONE) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
, create_if_not_found = {create: true, exclusive: false}
|
||||
, slice
|
||||
;
|
||||
filesaver.readyState = filesaver.INIT;
|
||||
if (!name) {
|
||||
name = "download";
|
||||
}
|
||||
if (can_use_save_link) {
|
||||
object_url = get_object_url(blob);
|
||||
save_link.href = object_url;
|
||||
save_link.download = name;
|
||||
click(save_link);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
return;
|
||||
}
|
||||
// Object and web filesystem URLs have a problem saving in Google Chrome when
|
||||
// viewed in a tab, so I force save with application/octet-stream
|
||||
// http://code.google.com/p/chromium/issues/detail?id=91158
|
||||
if (view.chrome && type && type !== force_saveable_type) {
|
||||
slice = blob.slice || blob.webkitSlice;
|
||||
blob = slice.call(blob, 0, blob.size, force_saveable_type);
|
||||
blob_changed = true;
|
||||
}
|
||||
// Since I can't be sure that the guessed media type will trigger a download
|
||||
// in WebKit, I append .download to the filename.
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=65440
|
||||
if (webkit_req_fs && name !== "download") {
|
||||
name += ".download";
|
||||
}
|
||||
if (type === force_saveable_type || webkit_req_fs) {
|
||||
target_view = view;
|
||||
}
|
||||
if (!req_fs) {
|
||||
fs_error();
|
||||
return;
|
||||
}
|
||||
fs_min_size += blob.size;
|
||||
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
|
||||
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
|
||||
var save = function() {
|
||||
dir.getFile(name, create_if_not_found, abortable(function(file) {
|
||||
file.createWriter(abortable(function(writer) {
|
||||
writer.onwriteend = function(event) {
|
||||
target_view.location.href = file.toURL();
|
||||
deletion_queue.push(file);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "writeend", event);
|
||||
};
|
||||
writer.onerror = function() {
|
||||
var error = writer.error;
|
||||
if (error.code !== error.ABORT_ERR) {
|
||||
fs_error();
|
||||
}
|
||||
};
|
||||
"writestart progress write abort".split(" ").forEach(function(event) {
|
||||
writer["on" + event] = filesaver["on" + event];
|
||||
});
|
||||
writer.write(blob);
|
||||
filesaver.abort = function() {
|
||||
writer.abort();
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
};
|
||||
filesaver.readyState = filesaver.WRITING;
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
};
|
||||
dir.getFile(name, {create: false}, abortable(function(file) {
|
||||
// delete file if it already exists
|
||||
file.remove();
|
||||
save();
|
||||
}), abortable(function(ex) {
|
||||
if (ex.code === ex.NOT_FOUND_ERR) {
|
||||
save();
|
||||
} else {
|
||||
fs_error();
|
||||
}
|
||||
}));
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
}
|
||||
, FS_proto = FileSaver.prototype
|
||||
, saveAs = function(blob, name) {
|
||||
return new FileSaver(blob, name);
|
||||
}
|
||||
;
|
||||
FS_proto.abort = function() {
|
||||
var filesaver = this;
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "abort");
|
||||
};
|
||||
FS_proto.readyState = FS_proto.INIT = 0;
|
||||
FS_proto.WRITING = 1;
|
||||
FS_proto.DONE = 2;
|
||||
|
||||
FS_proto.error =
|
||||
FS_proto.onwritestart =
|
||||
FS_proto.onprogress =
|
||||
FS_proto.onwrite =
|
||||
FS_proto.onabort =
|
||||
FS_proto.onerror =
|
||||
FS_proto.onwriteend =
|
||||
null;
|
||||
|
||||
view.addEventListener("unload", process_deletion_queue, false);
|
||||
return saveAs;
|
||||
}(self));
|
||||
|
||||
return saveAs;
|
||||
})();
|
5270
messenger/js/easyrtc/node_modules/easyrtc/api/easyrtc_int.js
generated
vendored
15
messenger/js/easyrtc/node_modules/easyrtc/api/easyrtc_lang_en.js
generated
vendored
@ -1,15 +0,0 @@
|
||||
|
||||
var easyrtc_constantStrings = {
|
||||
"unableToEnterRoom":"Unable to enter room {0} because {1}" ,
|
||||
"resolutionWarning": "Requested video size of {0}x{1} but got size of {2}x{3}",
|
||||
"badUserName": "Illegal username {0}",
|
||||
"localMediaError": "Error getting local media stream: {0}",
|
||||
"miscSignalError": "Miscellaneous error from signalling server. It may be ignorable.",
|
||||
"noServer": "Unable to reach the EasyRTC signalling server.",
|
||||
"badsocket": "Socket.io connect event fired with bad websocket.",
|
||||
"icf": "Internal communications failure",
|
||||
"statsNotSupported":"call statistics not supported by this browser, try Chrome.",
|
||||
"noWebrtcSupport":"Your browser doesn't appear to support WebRTC.",
|
||||
"gumFailed":"Failed to get access to local media. Error code was {0}.",
|
||||
"requireAudioOrVideo":"At least one of audio and video must be provided"
|
||||
};
|
6
messenger/js/easyrtc/node_modules/easyrtc/api/img/LICENSE
generated
vendored
@ -1,6 +0,0 @@
|
||||
Licenses for images In img folder
|
||||
----------------------------------
|
||||
|
||||
Logos for Priologic Software Inc, and EasyRTC are owned by Priologic Software Inc.
|
||||
|
||||
Permission is granted to use powered_by_easyrtc.png within your own application as long as it is not altered in any way.
|
BIN
messenger/js/easyrtc/node_modules/easyrtc/api/img/easyrtc.png
generated
vendored
Before Width: | Height: | Size: 3.4 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/api/img/powered_by_easyrtc.png
generated
vendored
Before Width: | Height: | Size: 4.1 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/api/img/priologic_logo_white.png
generated
vendored
Before Width: | Height: | Size: 2.7 KiB |
27
messenger/js/easyrtc/node_modules/easyrtc/api/img/x.svg
generated
vendored
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="40px" height="40px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
|
||||
|
||||
<g stroke="#b0b0b0" stroke-width="7" >
|
||||
<g>
|
||||
<path d="M76.03,79.854c-0.979,0-1.958-0.373-2.704-1.12L21.184,26.592c-1.494-1.494-1.494-3.915,0-5.409
|
||||
c1.494-1.493,3.915-1.493,5.409,0l52.143,52.142c1.494,1.494,1.494,3.915,0,5.409C77.988,79.481,77.01,79.854,76.03,79.854z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M23.888,79.854c-0.979,0-1.958-0.373-2.704-1.12c-1.494-1.494-1.494-3.915,0-5.409l52.142-52.142
|
||||
c1.493-1.493,3.915-1.493,5.409,0c1.494,1.494,1.494,3.915,0,5.409L26.593,78.734C25.846,79.481,24.867,79.854,23.888,79.854z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g fill="#000000">
|
||||
<g>
|
||||
<path d="M76.03,79.854c-0.979,0-1.958-0.373-2.704-1.12L21.184,26.592c-1.494-1.494-1.494-3.915,0-5.409
|
||||
c1.494-1.493,3.915-1.493,5.409,0l52.143,52.142c1.494,1.494,1.494,3.915,0,5.409C77.988,79.481,77.01,79.854,76.03,79.854z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M23.888,79.854c-0.979,0-1.958-0.373-2.704-1.12c-1.494-1.494-1.494-3.915,0-5.409l52.142-52.142
|
||||
c1.493-1.493,3.915-1.493,5.409,0c1.494,1.494,1.494,3.915,0,5.409L26.593,78.734C25.846,79.481,24.867,79.854,23.888,79.854z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.5 KiB |
3
messenger/js/easyrtc/node_modules/easyrtc/api/labs/README.md
generated
vendored
@ -1,3 +0,0 @@
|
||||
Labs Folder
|
||||
===========
|
||||
The code in the labs folder is experimental. It may change, it hasn't been throughly tested, use at your own risk.
|
BIN
messenger/js/easyrtc/node_modules/easyrtc/api/labs/desktopCapture.zip
generated
vendored
122
messenger/js/easyrtc/node_modules/easyrtc/api/labs/desktop_capture_iframe_version.js
generated
vendored
@ -1,122 +0,0 @@
|
||||
|
||||
// This file is a modification of Muaz Khan's getScreenId.js. It uses loads an iframe
|
||||
// pointed at Muaz Khan's page, and then communicates with that Iframe. You can also point
|
||||
// it at other urls.
|
||||
//
|
||||
// Technically, it is possible to desktop capture without iframes and for a production system.
|
||||
// However, this solution get will get you running with the minimal effort on your side.
|
||||
//
|
||||
// //
|
||||
//
|
||||
// // Last time updated at July 29, 2014, 08:32:23
|
||||
// Latest file can be found here: https://cdn.webrtc-experiment.com/getScreenId.js
|
||||
|
||||
// Muaz Khan - www.MuazKhan.com
|
||||
// MIT License - www.WebRTC-Experiment.com/licence
|
||||
// Documentation - https://github.com/muaz-khan/WebRTC-Experiment/tree/master/getScreenId.js
|
||||
// Modified by Eric Davies Sept 1/ 2014.
|
||||
//
|
||||
// ______________
|
||||
// getScreenId.js
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
/** Create a local media stream for desktop capture.
|
||||
* This will fail if a desktop capture extension is not installed.
|
||||
* not granting permission.
|
||||
* @param {function(Object)} successCallback - will be called with localmedia stream on success.
|
||||
* @param {function(String,String)} errorCallback - is called with an error code and error description.
|
||||
* @param {String} streamName - an optional name for the media source so you can use multiple cameras and screen share simultaneously.
|
||||
* @param {String} iframeUrl - an optional url for the iframe. The default is to use Muaz Khan's.
|
||||
* @example
|
||||
* easyrtc.initMediaSource(
|
||||
* function(mediastream){
|
||||
* easyrtc.setVideoObjectSrc( document.getElementById("mirrorVideo"), mediastream);
|
||||
* },
|
||||
* function(errorCode, errorText){
|
||||
* easyrtc.showError(errorCode, errorText);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
var iframeUrl = 'https://www.webrtc-experiment.com/getSourceId/';
|
||||
|
||||
easyrtc.initDesktopStream= function(successCallback, failureCallback, streamName) {
|
||||
// for Firefox:
|
||||
// sourceId == 'firefox'
|
||||
// screen_constraints = {...}
|
||||
|
||||
|
||||
|
||||
if (!!navigator.mozGetUserMedia) {
|
||||
easyrtc._presetMediaConstraints = {
|
||||
video: {
|
||||
mozMediaSource: 'window',
|
||||
mediaSource: 'window',
|
||||
maxWidth: 1920,
|
||||
maxHeight: 1080,
|
||||
minAspectRatio: 1.77
|
||||
},
|
||||
audio: false
|
||||
};
|
||||
easyrtc.initMediaSource(successCallback, failureCallback, streamName);
|
||||
return;
|
||||
}
|
||||
|
||||
postMessage();
|
||||
|
||||
var cb = function(event) {
|
||||
if (!event.data) return;
|
||||
|
||||
if (event.data.chromeMediaSourceId) {
|
||||
window.removeEventListener("message", cb);
|
||||
if (event.data.chromeMediaSourceId === 'PermissionDeniedError') {
|
||||
failureCallback(easyrtc.errCodes.MEDIA_ERR, 'permission-denied');
|
||||
} else {
|
||||
easyrtc._presetMediaConstraints = {
|
||||
video: {
|
||||
mandatory: {
|
||||
chromeMediaSource:'desktop',
|
||||
chromeMediaSourceId: event.data.chromeMediaSourceId,
|
||||
maxWidth: 1920,
|
||||
maxHeight: 1080,
|
||||
minAspectRatio: 1.77
|
||||
}
|
||||
},
|
||||
audio: false
|
||||
}
|
||||
easyrtc.initMediaSource(successCallback, failureCallback, streamName);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.data.chromeExtensionStatus) {
|
||||
console.log("extension status is ", event.data.chromeExtensionStatus);
|
||||
}
|
||||
};
|
||||
easyrtc.desktopCaptureInstalled = null;
|
||||
window.addEventListener('message', cb);
|
||||
};
|
||||
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
|
||||
function postMessage() {
|
||||
if (!iframe.isLoaded) {
|
||||
setTimeout(postMessage, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
iframe.contentWindow.postMessage({
|
||||
captureSourceId: true
|
||||
}, '*');
|
||||
}
|
||||
|
||||
iframe.onload = function() {
|
||||
iframe.isLoaded = true;
|
||||
};
|
||||
|
||||
iframe.src = iframeUrl;
|
||||
|
||||
iframe.style.display = 'none';
|
||||
(document.body || document.documentElement).appendChild(iframe);
|
||||
})();
|
166
messenger/js/easyrtc/node_modules/easyrtc/api/labs/desktop_capture_no_iframe_version.js
generated
vendored
@ -1,166 +0,0 @@
|
||||
//
|
||||
// This code was taken from: https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Pluginfree-Screen-Sharing
|
||||
// and modified to fit with EasyRTC.
|
||||
//
|
||||
|
||||
// todo: need to check exact chrome browser because opera/node-webkit also uses chromium framework
|
||||
var isChrome = !!navigator.webkitGetUserMedia;
|
||||
|
||||
// DetectRTC.js - github.com/muaz-khan/WebRTC-Experiment/tree/master/DetectRTC
|
||||
// Below code is taken from RTCMultiConnection-v1.8.js (http://www.rtcmulticonnection.org/changes-log/#v1.8)
|
||||
// and modified.
|
||||
var DetectRTC = {};
|
||||
|
||||
(function() {
|
||||
var screenCallback;
|
||||
|
||||
DetectRTC.screen = {
|
||||
supported: false,
|
||||
getSourceId: function(callback) {
|
||||
if (!callback)
|
||||
throw '"callback" parameter is mandatory.';
|
||||
screenCallback = callback;
|
||||
window.postMessage('desktopcapture-get-sourceId', '*');
|
||||
},
|
||||
isChromeExtensionAvailable: function(callback) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DetectRTC.screen.supported) {
|
||||
callback(true);
|
||||
}
|
||||
|
||||
// ask extension if it is available
|
||||
window.postMessage('desktopcapture-are-you-there', '*');
|
||||
|
||||
setTimeout(function() {
|
||||
callback(DetectRTC.screen.supported);
|
||||
}, 2000);
|
||||
},
|
||||
onMessageCallback: function(data) {
|
||||
// "cancel" button is clicked
|
||||
if (data == 'PermissionDeniedError') {
|
||||
DetectRTC.screen.chromeMediaSource = 'PermissionDeniedError';
|
||||
if (screenCallback) {
|
||||
return screenCallback('PermissionDeniedError');
|
||||
}
|
||||
else {
|
||||
throw new Error('PermissionDeniedError');
|
||||
}
|
||||
}
|
||||
|
||||
// extension notified his presence
|
||||
if (data == 'desktopcapture-loaded') {
|
||||
DetectRTC.screen.supported = true;
|
||||
}
|
||||
|
||||
// extension shared temp sourceId
|
||||
if (data.sourceId) {
|
||||
DetectRTC.screen.sourceId = data.sourceId;
|
||||
if (screenCallback) {
|
||||
screenCallback(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// check if desktop-capture extension installed.
|
||||
if (window.postMessage && isChrome) {
|
||||
DetectRTC.screen.isChromeExtensionAvailable(function(){});
|
||||
}
|
||||
})();
|
||||
|
||||
window.addEventListener('message', function(event) {
|
||||
if (event.origin != window.location.origin) {
|
||||
return;
|
||||
}
|
||||
|
||||
DetectRTC.screen.onMessageCallback(event.data);
|
||||
});
|
||||
|
||||
easyrtc.isDesktopCaptureInstalled = function() {
|
||||
return DetectRTC.screen.supported;
|
||||
}
|
||||
|
||||
easyrtc.initDesktopStream = function(successCallback, failureCallback, streamName) {
|
||||
if (!easyrtc.isDesktopCaptureInstalled()) {
|
||||
failureCallback(easyrtc.errCodes.DEVELOPER_ERR, "Desktop capture plugin not installed").
|
||||
return;
|
||||
}
|
||||
|
||||
DetectRTC.screen.getSourceId(function(error) {
|
||||
if( error) {
|
||||
failureCallback(easyrtc.errCodes.MEDIA_ERR, error);
|
||||
}
|
||||
else if (DetectRTC.screen.sourceId) {
|
||||
easyrtc._presetMediaConstraints = {
|
||||
video: {
|
||||
mandatory: {
|
||||
chromeMediaSource: 'desktop',
|
||||
chromeMediaSourceId: DetectRTC.screen.sourceId,
|
||||
maxWidth: 1920,
|
||||
maxHeight: 1080,
|
||||
minAspectRatio: 1.77
|
||||
}
|
||||
},
|
||||
audio: false
|
||||
}
|
||||
easyrtc.initMediaSource(successCallback, failureCallback, streamName);
|
||||
}
|
||||
else {
|
||||
failureCallback(easyrtc.errCodes.MEDIA_CANCELLED, "Desktop capture plugin not installed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method builds a function that can be attached to a button to install an extension.
|
||||
* The install will only work on a {@link https://support.google.com/webmasters/answer/34592?hl=en|Google Verified Website}
|
||||
* with a `link` tag pointing to the extension, which is required by chrome for
|
||||
* {@link https://developer.chrome.com/webstore/inline_installation|Inline Installations}.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/bemabaogbdfpbkkganibcmhbgjogabfj" id="custom-app-id" />
|
||||
*
|
||||
* easyrtc.chromeInstall("custom-app_id", function() {
|
||||
* // success
|
||||
* },
|
||||
* function(errorCode, errorText) {
|
||||
* // failure
|
||||
* });
|
||||
*
|
||||
* @param {String} extensionId The id of the `link` tag pointing to your extension.
|
||||
* @param {Function} successCallback Function to call on success.
|
||||
* @param {Function} failureCallback Function to call on failure. Will pass argument `errorCode` and `errorMessage`.
|
||||
*/
|
||||
easyrtc.chromeInstaller = function(extensionId, successCallback, failureCallback) {
|
||||
return function() {
|
||||
var el, url;
|
||||
if( !navigator.webkitGetUserMedia ||
|
||||
!window.chrome ||
|
||||
!chrome.webstore ||
|
||||
!chrome.webstore.install ) {
|
||||
failureCallback(easyrtc.errCodes.DEVELOPER_ERR, "Can't install plugin on non-chrome browsers");
|
||||
}
|
||||
else {
|
||||
try {
|
||||
var el = document.querySelector('head link#' + extensionId);
|
||||
|
||||
if ( ! el) throw new Error("Can't find a `link` element in `head` with id `"+extensionId+"`");
|
||||
|
||||
// get the chrome extension url from the link's href attribute
|
||||
var url = el.attributes.href.value;
|
||||
|
||||
chrome.webstore.install(url, successCallback, function(error) {
|
||||
failureCallback(easyrtc.errCodes.DEVELOPER_ERR, error);
|
||||
});
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
failureCallback(easyrtc.errCodes.DEVELOPER_ERR, error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
245
messenger/js/easyrtc/node_modules/easyrtc/api/labs/easyrtc_rates.js
generated
vendored
@ -1,245 +0,0 @@
|
||||
//
|
||||
// This code builds sdp filter functions
|
||||
(function () {
|
||||
|
||||
function buildSdpFilter(options, isLocal) {
|
||||
|
||||
var audioSendBitrate = options.audioSendBitrate;
|
||||
var audioRecvBitrate = options.audioRecvBitrate;
|
||||
var videoSendBitrate = options.videoSendBitrate;
|
||||
var videoRecvBitrate = options.videoRecvBitrate;
|
||||
var videoSendBitrate = options.videoSendBitrate;
|
||||
var videoSendInitialBitrate = options.videoSendInitialBitrate;
|
||||
var audioSendCodec = options.audioSendCodec || '';
|
||||
var audioRecvCodec = options.audioRecvCodec || '';
|
||||
var stereo = options.stereo;
|
||||
function trace(arg) {
|
||||
console.log("trace:" + arg);
|
||||
}
|
||||
// these functions were cribbed from the google apprtc.appspot.com demo.
|
||||
|
||||
function maybeSetAudioSendBitRate(sdp) {
|
||||
if (!audioSendBitrate) {
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer audio send bitrate: ' + audioSendBitrate);
|
||||
return preferBitRate(sdp, audioSendBitrate, 'audio');
|
||||
}
|
||||
|
||||
function maybeSetAudioReceiveBitRate(sdp) {
|
||||
if (!audioRecvBitrate) {
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer audio receive bitrate: ' + audioRecvBitrate);
|
||||
return preferBitRate(sdp, audioRecvBitrate, 'audio');
|
||||
}
|
||||
|
||||
function maybeSetVideoSendBitRate(sdp) {
|
||||
if (!videoSendBitrate) {
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer video send bitrate: ' + videoSendBitrate);
|
||||
return preferBitRate(sdp, videoSendBitrate, 'video');
|
||||
}
|
||||
|
||||
function maybeSetVideoReceiveBitRate(sdp) {
|
||||
if (!videoRecvBitrate) {
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer video receive bitrate: ' + videoRecvBitrate);
|
||||
return preferBitRate(sdp, videoRecvBitrate, 'video');
|
||||
}
|
||||
|
||||
function preferBitRate(sdp, bitrate, mediaType) {
|
||||
var sdpLines = sdp.split('\r\n');
|
||||
var mLineIndex = findLine(sdpLines, 'm=', mediaType);
|
||||
if (mLineIndex === null) {
|
||||
messageError('Failed to add bandwidth line to sdp, as no m-line found');
|
||||
return sdp;
|
||||
}
|
||||
var nextMLineIndex = findLineInRange(sdpLines, mLineIndex + 1, -1, 'm=');
|
||||
if (nextMLineIndex === null) {
|
||||
nextMLineIndex = sdpLines.length;
|
||||
}
|
||||
var cLineIndex = findLineInRange(sdpLines, mLineIndex + 1, nextMLineIndex, 'c=');
|
||||
if (cLineIndex === null) {
|
||||
messageError('Failed to add bandwidth line to sdp, as no c-line found');
|
||||
return sdp;
|
||||
}
|
||||
var bLineIndex = findLineInRange(sdpLines, cLineIndex + 1, nextMLineIndex, 'b=AS');
|
||||
if (bLineIndex) {
|
||||
sdpLines.splice(bLineIndex, 1);
|
||||
}
|
||||
var bwLine = 'b=AS:' + bitrate;
|
||||
sdpLines.splice(cLineIndex + 1, 0, bwLine);
|
||||
sdp = sdpLines.join('\r\n');
|
||||
return sdp;
|
||||
}
|
||||
|
||||
function maybeSetVideoSendInitialBitRate(sdp) {
|
||||
if (!videoSendInitialBitrate) {
|
||||
return sdp;
|
||||
}
|
||||
var maxBitrate = videoSendInitialBitrate;
|
||||
if (videoSendBitrate) {
|
||||
if (videoSendInitialBitrate > videoSendBitrate) {
|
||||
messageError('Clamping initial bitrate to max bitrate of ' + videoSendBitrate + ' kbps.');
|
||||
videoSendInitialBitrate = videoSendBitrate;
|
||||
}
|
||||
maxBitrate = videoSendBitrate;
|
||||
}
|
||||
var sdpLines = sdp.split('\r\n');
|
||||
var mLineIndex = findLine(sdpLines, 'm=', 'video');
|
||||
if (mLineIndex === null) {
|
||||
messageError('Failed to find video m-line');
|
||||
return sdp;
|
||||
}
|
||||
var vp8RtpmapIndex = findLine(sdpLines, 'a=rtpmap', 'VP8/90000');
|
||||
var vp8Payload = getCodecPayloadType(sdpLines[vp8RtpmapIndex]);
|
||||
var vp8Fmtp = 'a=fmtp:' + vp8Payload + ' x-google-min-bitrate=' + videoSendInitialBitrate.toString() + '; x-google-max-bitrate=' + maxBitrate.toString();
|
||||
sdpLines.splice(vp8RtpmapIndex + 1, 0, vp8Fmtp);
|
||||
return sdpLines.join('\r\n');
|
||||
}
|
||||
|
||||
function maybePreferAudioSendCodec(sdp) {
|
||||
if (audioSendCodec === '') {
|
||||
trace('No preference on audio send codec.');
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer audio send codec: ' + audioSendCodec);
|
||||
return preferAudioCodec(sdp, audioSendCodec);
|
||||
}
|
||||
|
||||
function maybePreferAudioReceiveCodec(sdp) {
|
||||
if (audioRecvCodec === '') {
|
||||
trace('No preference on audio receive codec.');
|
||||
return sdp;
|
||||
}
|
||||
trace('Prefer audio receive codec: ' + audioRecvCodec);
|
||||
return preferAudioCodec(sdp, audioRecvCodec);
|
||||
}
|
||||
|
||||
function preferAudioCodec(sdp, codec) {
|
||||
var sdpLines = sdp.split('\r\n');
|
||||
var mLineIndex = findLine(sdpLines, 'm=', 'audio');
|
||||
if (mLineIndex === null) {
|
||||
return sdp;
|
||||
}
|
||||
var codecIndex = findLine(sdpLines, 'a=rtpmap', codec);
|
||||
if (codecIndex) {
|
||||
var payload = getCodecPayloadType(sdpLines[codecIndex]);
|
||||
if (payload) {
|
||||
sdpLines[mLineIndex] = setDefaultCodec(sdpLines[mLineIndex], payload);
|
||||
}
|
||||
}
|
||||
sdp = sdpLines.join('\r\n');
|
||||
return sdp;
|
||||
}
|
||||
|
||||
function addStereo(sdp) {
|
||||
var sdpLines = sdp.split('\r\n');
|
||||
var opusIndex = findLine(sdpLines, 'a=rtpmap', 'opus/48000');
|
||||
var opusPayload;
|
||||
if (opusIndex) {
|
||||
opusPayload = getCodecPayloadType(sdpLines[opusIndex]);
|
||||
}
|
||||
var fmtpLineIndex = findLine(sdpLines, 'a=fmtp:' + opusPayload.toString());
|
||||
if (fmtpLineIndex === null) {
|
||||
return sdp;
|
||||
}
|
||||
sdpLines[fmtpLineIndex] = sdpLines[fmtpLineIndex].concat('; stereo=1');
|
||||
sdp = sdpLines.join('\r\n');
|
||||
return sdp;
|
||||
}
|
||||
|
||||
function findLine(sdpLines, prefix, substr) {
|
||||
return findLineInRange(sdpLines, 0, -1, prefix, substr);
|
||||
}
|
||||
|
||||
function findLineInRange(sdpLines, startLine, endLine, prefix, substr) {
|
||||
var realEndLine = endLine !== -1 ? endLine : sdpLines.length;
|
||||
for (var i = startLine; i < realEndLine; ++i) {
|
||||
if (sdpLines[i].indexOf(prefix) === 0) {
|
||||
if (!substr || sdpLines[i].toLowerCase().indexOf(substr.toLowerCase()) !== -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getCodecPayloadType(sdpLine) {
|
||||
var pattern = new RegExp('a=rtpmap:(\\d+) \\w+\\/\\d+');
|
||||
var result = sdpLine.match(pattern);
|
||||
return (result && result.length === 2) ? result[1] : null;
|
||||
}
|
||||
|
||||
function setDefaultCodec(mLine, payload) {
|
||||
var elements = mLine.split(' ');
|
||||
var newLine = [];
|
||||
var index = 0;
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
if (index === 3) {
|
||||
newLine[index++] = payload;
|
||||
}
|
||||
if (elements[i] !== payload) {
|
||||
newLine[index++] = elements[i];
|
||||
}
|
||||
}
|
||||
return newLine.join(' ');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( isLocal ) {
|
||||
return function(insdp) {
|
||||
console.log("modifying local sdp");
|
||||
var sdp;
|
||||
sdp = maybePreferAudioReceiveCodec(insdp);
|
||||
sdp = maybeSetAudioReceiveBitRate(sdp);
|
||||
sdp = maybeSetVideoReceiveBitRate(sdp);
|
||||
if( sdp != insdp ) {
|
||||
console.log("changed the sdp from \n" + insdp + "\nto\n" + sdp);
|
||||
}
|
||||
return sdp;
|
||||
};
|
||||
}
|
||||
else {
|
||||
return function(insdp) {
|
||||
console.log("modifying remote sdp");
|
||||
if (stereo) {
|
||||
sdp = addStereo(sdp);
|
||||
}
|
||||
var sdp = maybePreferAudioSendCodec(insdp);
|
||||
sdp = maybeSetAudioSendBitRate(sdp);
|
||||
sdp = maybeSetVideoSendBitRate(sdp);
|
||||
sdp = maybeSetVideoSendInitialBitRate(sdp);
|
||||
if( sdp != insdp ) {
|
||||
console.log("changed the sdp from \n" + insdp + "\nto\n" + sdp);
|
||||
}
|
||||
return sdp;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns an sdp filter function.
|
||||
* @param options A map that optionally includes values for the following keys: audioRecvCodec, audioRecvBitrate, videoRecvBitrate
|
||||
* @returns {Function} which takes an SDP string and returns a modified SDP string.
|
||||
*/
|
||||
easyrtc.buildLocalSdpFilter = function (options) {
|
||||
return buildSdpFilter(options, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns an sdp filter function.
|
||||
* @param options A map that optionally includes values for the following keys: stereo, audioSendCodec, audioSendBitrate, videoSendBitrate, videoSendInitialBitRate
|
||||
* @returns {Function} which takes an SDP string and returns a modified SDP string.
|
||||
*/
|
||||
easyrtc.buildRemoteSdpFilter = function(options) {
|
||||
return buildSdpFilter(options, false);
|
||||
}
|
||||
})();
|
||||
|
||||
|
36
messenger/js/easyrtc/node_modules/easyrtc/api/labs/inline-installcode.html
generated
vendored
@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!-- this code taken from https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/desktopCapture -->
|
||||
<head>
|
||||
<!-- head; this <link> tag MUST be in <head> section -->
|
||||
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/your-chrome-extension-id">
|
||||
</head>
|
||||
<body>
|
||||
<!-- body; the button element that is used to invoke inline installation -->
|
||||
<button onclick="" id="install-button" style="padding: 0;background: none;height: 61px;vertical-align: middle;cursor:pointer;">
|
||||
<img src="https://www.webrtc-experiment.com/images/btn-install-chrome-extension.png" alt="Add to Chrome">
|
||||
</button>
|
||||
|
||||
<script>
|
||||
document.querySelector('#inline-install').onclick = function() {
|
||||
!!navigator.webkitGetUserMedia
|
||||
&& !!window.chrome
|
||||
&& !!chrome.webstore
|
||||
&& !!chrome.webstore.install &&
|
||||
chrome.webstore.install(
|
||||
'https://chrome.google.com/webstore/detail/your-chrome-extension-id',
|
||||
successCallback,
|
||||
failureCallback
|
||||
);
|
||||
};
|
||||
|
||||
function successCallback() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function failureCallback(error) {
|
||||
alert(error);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
47
messenger/js/easyrtc/node_modules/easyrtc/demos/css/demo4.css
generated
vendored
@ -1,47 +0,0 @@
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
.callerVideoBox {
|
||||
position:relative;
|
||||
}
|
||||
.callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
.easyrtc_closeButton {
|
||||
position:absolute;
|
||||
right:2px;
|
||||
background-color: transparent;
|
||||
background-image: url('../images/button_close.png');
|
||||
border:none;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
top:0px;
|
||||
width:56px;
|
||||
height:56px;
|
||||
z-index: 2;
|
||||
opacity:0.4;
|
||||
}
|
||||
.easyrtc_closeButton:hover {
|
||||
cursor: pointer;
|
||||
opacity:1;
|
||||
}
|
27
messenger/js/easyrtc/node_modules/easyrtc/demos/css/demo_audio_video_simple.css
generated
vendored
@ -1,27 +0,0 @@
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
51
messenger/js/easyrtc/node_modules/easyrtc/demos/css/demo_audio_video_simple_hd.css
generated
vendored
@ -1,51 +0,0 @@
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#container {
|
||||
width:1330px;
|
||||
}
|
||||
.callButton {
|
||||
float:left;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
}
|
||||
#otherClients {
|
||||
height:50px;
|
||||
}
|
||||
#selfVideo {
|
||||
volume: 0;
|
||||
position:absolute;
|
||||
left: 10px;
|
||||
top:10px;
|
||||
z-index: 2;
|
||||
opacity: 0.8;
|
||||
height:120px;
|
||||
width:160px;
|
||||
}
|
||||
#callerVideoBox {
|
||||
position:relative;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
#callerVideo {
|
||||
height:720px;
|
||||
width:1280px;
|
||||
}
|
||||
.closeButton {
|
||||
position:absolute;
|
||||
right:2px;
|
||||
background-color: transparent;
|
||||
background-image: url('../images/button_close.png');
|
||||
border:none;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
top:0px;
|
||||
width:56px;
|
||||
height:56px;
|
||||
z-index: 2;
|
||||
opacity:0.4;
|
||||
}
|
||||
.closeButton:hover {
|
||||
cursor: pointer;
|
||||
opacity:1;
|
||||
}
|
27
messenger/js/easyrtc/node_modules/easyrtc/demos/css/demo_lowbandwidth.css
generated
vendored
@ -1,27 +0,0 @@
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
74
messenger/js/easyrtc/node_modules/easyrtc/demos/css/demo_room.css
generated
vendored
@ -1,74 +0,0 @@
|
||||
|
||||
.transit {
|
||||
transition: left 1s, top 1s, right 1s, bottom 1s, width 1s, height 1s, transform 1s;
|
||||
-moz-transition: left 1s, top 1s, right 1s, bottom 1s, width 1s, height 1s, -moz-transform 1s;
|
||||
-webkit-transition: left 1s, top 1s, right 1s, bottom 1s, width 1s, height 1s, -webkit-transform 1s;
|
||||
-o-transition: left 1s, top 1s, right 1s, bottom 1s, width 1s, height 1s,-o-transform 1s;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
background-color: transparent;
|
||||
border-color: 2px solid blue;
|
||||
}
|
||||
|
||||
.boxCommon {
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
.closeButton {
|
||||
display: none; /* hide the easyApp's close button because we have our own */
|
||||
}
|
||||
|
||||
.thumbCommon {
|
||||
z-index:2;
|
||||
box-shadow: 5px 5px 5px #000000;
|
||||
}
|
||||
|
||||
#controlArea {
|
||||
background-color: #ff8000;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color:#ffd0d0;
|
||||
margin-left:0px;
|
||||
margin-top:0px;
|
||||
}
|
||||
|
||||
#killButton {
|
||||
opacity:0.7;
|
||||
}
|
||||
|
||||
#killButton:hover {
|
||||
opacity:1.0;
|
||||
}
|
||||
|
||||
#muteButton {
|
||||
opacity:0.7;
|
||||
}
|
||||
|
||||
#muteButton:hover {
|
||||
opacity:1.0;
|
||||
}
|
||||
|
||||
#textentryBox {
|
||||
border:2px solid #a0ffa0;
|
||||
border-radius:10px;
|
||||
z-index:5;
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 5px 5px 5px #000000;
|
||||
font-family: 'Courier New',Courier,monospace;
|
||||
}
|
||||
|
||||
#textentryField {
|
||||
font-size:x-large;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
#textentrySubmit {
|
||||
font-size:larger;
|
||||
}
|
||||
|
||||
#textentryCancel {
|
||||
font-size:larger;
|
||||
}
|
125
messenger/js/easyrtc/node_modules/easyrtc/demos/css/landing.css
generated
vendored
@ -1,125 +0,0 @@
|
||||
/*
|
||||
General CSS for easyrtc local landing site.
|
||||
Only general layout is here.
|
||||
Any CSS related directly to the operation of a demo is kept in another file.
|
||||
*/
|
||||
|
||||
body {
|
||||
background-image:url("../images/bg_light.png");
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#container {
|
||||
width:960px;
|
||||
margin-left: auto;
|
||||
margin-right:auto;
|
||||
|
||||
background-image:url("../images/bg_dark.png");
|
||||
background-color:black;
|
||||
|
||||
border-color: #FF6600;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
#logo_easyrtc {
|
||||
margin-top:5px;
|
||||
margin-left:5px;
|
||||
}
|
||||
#logo_priologic {
|
||||
margin-top:5px;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
#menu {
|
||||
text-align: right;
|
||||
clear: both;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.menu_item {
|
||||
display: inline;
|
||||
text-decoration: none;
|
||||
border-color: gray;
|
||||
border-width: 2px;
|
||||
border-style: outset;
|
||||
color: white;
|
||||
padding: 0px 3px 0px 3px;
|
||||
background-color: rgba(0,0,0,.4);
|
||||
}
|
||||
.menu_item:hover {
|
||||
border-style:inset;
|
||||
background-color: rgba(100,100,100,0);
|
||||
}
|
||||
.menu_link {
|
||||
text-decoration:none;
|
||||
}
|
||||
.menu_link:focus {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#main {
|
||||
background-color:white;
|
||||
overflow:hidden;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
font-size: small;
|
||||
padding: 5px;
|
||||
color:white;
|
||||
min-height:60px;
|
||||
}
|
||||
#footer p {
|
||||
margin: 0px;
|
||||
color:white;
|
||||
text-align:center;
|
||||
}
|
||||
#footer a {
|
||||
color:white;
|
||||
}
|
||||
#license {
|
||||
font-size: x-small;
|
||||
}
|
||||
#logo_priologic {
|
||||
float:left;
|
||||
padding-top: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
#logo_pb_easyrtc {
|
||||
float:right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
|
||||
.demo_table {
|
||||
border-collapse:collapse;
|
||||
border:1px solid gray;
|
||||
}
|
||||
.demo_table th{
|
||||
padding:3px;
|
||||
text-align:left;
|
||||
}
|
||||
.demo_table td{
|
||||
border-top:1px solid gray;
|
||||
padding:3px;
|
||||
}
|
||||
.demo_table #browser_note{
|
||||
text-align:center;
|
||||
font-size: smaller;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
hr {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.prettyprint {
|
||||
white-space: pre-wrap;
|
||||
max-height:400px;
|
||||
overflow-y:scroll;
|
||||
}
|
118
messenger/js/easyrtc/node_modules/easyrtc/demos/demo4.html
generated
vendored
@ -1,118 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Simple 4-Way Video Chat</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo4.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/demo4.css" />
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
|
||||
<body onload="connect();">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="easyrtc" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">easyrtc.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Simple 4-Way Video Chat</h1>
|
||||
|
||||
<p>The application provides a 4-way video chat using the easyrtc.easyApp method. It is a variation on the Simple Audio Video Chat demo.
|
||||
</p>
|
||||
|
||||
<p>Connection is handled using an onload statement in the body. Requests are automatically accepted.<p>
|
||||
|
||||
<p>To hang-up on a call, hover your mouse over the upper right of the video, and click on the red handset which appears.</p>
|
||||
|
||||
<p style="font-weight:bold;color:red">
|
||||
Important note: 3 way and 4 way chats require much more network
|
||||
bandwidth and CPU resources; they may crash your browser.
|
||||
We recommend using a video conferencing server for production environments.
|
||||
</p>
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" id="selfVideo" class="easyrtcMirror"></video>
|
||||
<!-- each caller video needs to be in it's own div so
|
||||
it's close button can be positioned correctly
|
||||
-->
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo" class="callerVideo"></video>
|
||||
</div> <br>
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo2" class="callerVideo"></video>
|
||||
</div>
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo3" class="callerVideo"></video>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>CSS</h3>
|
||||
<p>In order to show the 'X' in the upper right corner, the callerVideo video tag must be in a div with relative positioning.</p>
|
||||
<pre id="prettyCSS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video_simple.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML", 2);
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
loadAndFilter(getHelperPath("css"), "prettyCSS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 Lcense. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
128
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_audio_only.html
generated
vendored
@ -1,128 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Audio Only</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_audio_only.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#callerAudio {
|
||||
/* display:none; */
|
||||
height:10em;
|
||||
width:10em;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<!--hide-->
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="easyrtc" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Audio Only</h1>
|
||||
|
||||
<p>The application provides an audio only chat by disabling video
|
||||
before initializing the local media stream.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing other people using this demo.
|
||||
Click one of those buttons to initiate a chat.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<!-- Note... this demo should be updated to remove video references -->
|
||||
<div id="videos">
|
||||
<video id="callerAudio"></video>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_only.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
146
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_audio_video.html
generated
vendored
@ -1,146 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Audio and Video</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_audio_video.js"></script>
|
||||
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!--hide-->
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Audio and Video</h1>
|
||||
|
||||
<p>The application provides an audio-video chat where sharing of audio and video can be controlled individually before connection.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing other people using this demo.
|
||||
Click one of those buttons to initiate a chat.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<input type="checkbox" checked="checked" id="shareAudio" />Share audio
|
||||
<input type="checkbox" checked="checked" id="shareVideo" />Share video<br />
|
||||
<input type="checkbox" checked="checked" id="expectAudio" />Expect audio
|
||||
<input type="checkbox" checked="checked" id="expectVideo" />Expect video<br />
|
||||
|
||||
<input type="checkbox" id="useFreshIce" onclick="easyrtc.setUseFreshIceEachPeerConnection(this.value);"/>Fresh Ice<br />
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button onclick="disconnect()">Disconnect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" id="selfVideo" class="easyrtcMirror" muted="muted" volume="0"></video>
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
98
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_audio_video_simple.html
generated
vendored
@ -1,98 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Simple Video+Audio</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_audio_video_simple.css" />
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_audio_video_simple.js"></script>
|
||||
|
||||
</head>
|
||||
<body onload="connect();">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Simple Video+Audio</h1>
|
||||
|
||||
<p>The application provides a simple audio-video chat using the easyrtc.easyApp method.</p>
|
||||
|
||||
<p>Connection is handled using an onload statement in the body. Requests are automatically accepted.<p>
|
||||
|
||||
<p>To hang-up on a call, hover your mouse over the upper right of the video, and click on the 'X' which appears at the top right of other person's video object.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" class="easyrtcMirror" id="selfVideo" muted="muted" volume="0" ></video>
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
</div>
|
||||
<!-- each caller video needs to be in it's own div so it's close button can be positioned correctly -->
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
|
||||
<h3>CSS</h3>
|
||||
<p>In order to show the 'X' in the upper right corner, the callerVideo video tag must be in a div with relative positioning.:</p>
|
||||
<pre id="prettyCSS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video_simple.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
loadAndFilter(getHelperPath("css"), "prettyCSS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
95
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_audio_video_simple_hd.html
generated
vendored
@ -1,95 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo:EasyRTC Demo: Video+Audio HD 720</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_audio_video_simple_hd.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show--> <!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_audio_video_simple_hd.js"></script>
|
||||
|
||||
</head>
|
||||
<body onload="connect();">
|
||||
<!--hide-->
|
||||
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<!--show-->
|
||||
<h1>EasyRTC Demo: Video+Audio HD 720p</h1>
|
||||
<div id="demoContainer">
|
||||
<div>
|
||||
Note: your own image will show up postage stamp sized, while the other party's video will be shown in high-definition (1280x720). Note: not all webcams are seen by WebRTC as providing high-definition video; the fallback is to use standard definition (640x480).
|
||||
</div>
|
||||
<div id="connectControls">
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="videos">
|
||||
|
||||
<div style="position:relative;float:left;" width="1282" height="722">
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
<video class="easyrtcMirror" autoplay="autoplay" id="selfVideo" muted="true" volume="0" ></video>
|
||||
</div>
|
||||
<!-- each caller video needs to be in it's own div so it's close button can be positioned correctly -->
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
|
||||
<h3>CSS</h3>
|
||||
<p>In order to show the 'X' in the upper right corner, the callerVideo video tag must be in a div with relative positioning.:</p>
|
||||
<pre id="prettyCSS" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video_simple_hd.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
loadAndFilter(getHelperPath("css"), "prettyCSS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
141
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_data_channel_filesharing.html
generated
vendored
@ -1,141 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Data Channel File-sharing</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
<!--hide-->
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery-1.9.1.min.js"></script>
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc_ft.js"></script>
|
||||
<script type="text/javascript" src="js/demo_data_channel_filesharing.js"></script>
|
||||
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
.alert img {
|
||||
float:left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.peerblock {
|
||||
width: 800px;
|
||||
border-radius:2px;
|
||||
border:1px solid gray;
|
||||
}
|
||||
|
||||
.receiveBlock {
|
||||
width: 500px;
|
||||
margin:10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.dragndrop {
|
||||
display: inline-block;
|
||||
padding:2em;
|
||||
margin: 2px;
|
||||
border:2px solid black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.dragndropStatus {
|
||||
display: inline-block;
|
||||
}
|
||||
.connecting {
|
||||
background-color: yellow;
|
||||
}
|
||||
.usesSockets {
|
||||
background-color: pink;
|
||||
}
|
||||
.notConnected {
|
||||
visibility:hidden;
|
||||
}
|
||||
.connected {
|
||||
background-color: #e0ffe0;
|
||||
}
|
||||
.notConnected:hover {
|
||||
margin: 1px;
|
||||
border-width: 3px;
|
||||
}
|
||||
.connected:hover {
|
||||
margin: 1px;
|
||||
border-width:3px;
|
||||
}
|
||||
.connectButton {
|
||||
padding:2em;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="connect()">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="easyrtc" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Data Channel File-sharing</h1>
|
||||
<p>This application demonstrates file sharing using the easyrtc.sendData method.
|
||||
It should connect to the server upon start up, and display drag-and-drop areas for other peers.</p>
|
||||
|
||||
<p>To use it, connect to a peer then drop a file into the drag-and-drop area for that peer. The peer should receive it.
|
||||
</p>
|
||||
|
||||
<p class="alert"><img alt="Warn" height="32" width="32" src="images/br_status_warn.png" />
|
||||
This demo requires reliable data channels which means it needs Firefox or Chrome (version 32+).
|
||||
In the absence of reliable data channels it will fallback to using websockets to transfer a file.
|
||||
Notice that it uses easyrtc_ft.js as well as easyrtc.js.
|
||||
</p>
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="iam">Obtaining ID...</div><BR />
|
||||
<div id="peerZone">
|
||||
</div>
|
||||
|
||||
<!--hide-->
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_instant_messaging.js:</p>
|
||||
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
105
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_data_channel_messaging.html
generated
vendored
@ -1,105 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Data Channel Messaging</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_data_channel_messaging.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
.alert img {
|
||||
float:left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
#sendMessageArea{
|
||||
float:left;
|
||||
width:400px;
|
||||
padding-right:20px;
|
||||
}
|
||||
#sendMessageText{
|
||||
width:100%;
|
||||
}
|
||||
#conversation {
|
||||
height:300px;
|
||||
border:solid 1px gray;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="connect()">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Data Channel Messaging</h1>
|
||||
<p>This application demonstrates text messaging using data channels via the easyrtc.sendDataP2P method.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="sendMessageArea">
|
||||
<div id="iam">Obtaining ID...</div>
|
||||
<textarea id="sendMessageText"></textarea>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="receiveMessageArea">
|
||||
Received Messages:
|
||||
<div id="conversation"></div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_instant_messaging.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 Lcense. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
95
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_ice_filter.html
generated
vendored
@ -1,95 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Ice Filter</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_audio_video_simple.css" />
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_ice_filter.js"></script>
|
||||
|
||||
</head>
|
||||
<body onload="connect();">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Ice Filter</h1>
|
||||
|
||||
<p>Client side filtering of ICE configuration.</p>
|
||||
|
||||
<p>Client-side ice filtering is meant as a experimenting tool, not something you should need to do in a
|
||||
production environment.
|
||||
<p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer" >
|
||||
<div id="connectControls">
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<div id="iceEntries" style="clear:both;width:100%;overflow-x:hidden">
|
||||
</div>
|
||||
<h3>Connected users:</h3>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" class="easyrtcMirror" id="selfVideo" muted="muted" volume="0" ></video>
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
</div>
|
||||
<!-- each caller video needs to be in it's own div so it's close button can be positioned correctly -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video_simple.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
104
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_instant_messaging.html
generated
vendored
@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Instant Messaging</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_instant_messaging.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#stuffToSend {width:300px;}
|
||||
#sendMessageArea{
|
||||
float:left;
|
||||
width:400px;
|
||||
padding-right:20px;
|
||||
}
|
||||
#sendMessageText{
|
||||
width:100%;
|
||||
}
|
||||
#conversation {
|
||||
height:300px;
|
||||
border:solid 1px gray;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="connect()">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Instant Messaging</h1>
|
||||
<p>This application demonstrates text messaging using the easyrtc.sendDataWS method.
|
||||
It should connect to the server upon start up, and display buttons for the other
|
||||
peers running the same application.</p>
|
||||
|
||||
<p>To use it, enter a message into the text box on the left side of the page.
|
||||
Then press one of the buttons for another peer to send the message to that peer.
|
||||
The message should appear on the text box to the right on both this page, and that of the peer.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="sendMessageArea">
|
||||
<div id="iam">Obtaining ID...</div>
|
||||
<textarea id="sendMessageText"></textarea>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="receiveMessageArea">
|
||||
Received Messages:
|
||||
<div id="conversation"></div>
|
||||
</div>
|
||||
|
||||
<!--hide-->
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_instant_messaging.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<!--hide-->
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
194
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_instant_messaging_rooms.html
generated
vendored
@ -1,194 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Instant Messaging + Rooms </title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_instant_messaging_rooms.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#stuffToSend {
|
||||
width:300px;
|
||||
}
|
||||
#sendMessageArea{
|
||||
float:left;
|
||||
width:400px;
|
||||
padding-right:20px;
|
||||
}
|
||||
#sendMessageText{
|
||||
width:100%;
|
||||
}
|
||||
#conversation {
|
||||
height:150px;
|
||||
border:solid 1px gray;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
.roomDiv {
|
||||
margin-bottom: 15px;
|
||||
background-color: antiquewhite;
|
||||
}
|
||||
.roomOccupants{
|
||||
margin-left: 20px;
|
||||
}
|
||||
#main.connected>.preconnection{
|
||||
display:none;
|
||||
}
|
||||
#main.notconnected>.postconnection{
|
||||
display:none;
|
||||
}
|
||||
.quickJoin {
|
||||
display: inline-block;
|
||||
}
|
||||
#quickJoinBlock {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="initApp();" >
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Instant Messaging + Rooms</h1>
|
||||
<p><strong>Note:</strong> This is primarily an application
|
||||
developed to test new features going into EasyRTC Modular (v1.0.x). It's currently not written to be a tutorial,
|
||||
but it does demonstrate how to use various features like presence and room targeted messaging.</p>
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div class="preconnection">
|
||||
Username: <input type="text" id="userNameField" />
|
||||
Password: <input type="text" id="credentialField" />
|
||||
<div >
|
||||
<button id="connectButton" onclick="connect();">Connect</button>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="postconnection">
|
||||
<button onclick="disconnect();">Disconnect from server.</button>
|
||||
</div>
|
||||
<div>
|
||||
Presence:
|
||||
<input type="radio" name="presence" onclick="setPresence('away');"/>away
|
||||
<input type="radio" name="presence" checked onclick="setPresence('chat');"/>chat
|
||||
<input type="radio" name="presence" onclick="setPresence('dnd');"/>dnd
|
||||
<input type="radio" name="presence" onclick="setPresence('xa');"/>xa
|
||||
<input type="text" onkeyup="updatePresenceStatus(this.value);" />
|
||||
</div>
|
||||
<hr>
|
||||
<div >
|
||||
Quick Join -
|
||||
|
||||
<div id="quickJoinBlock"></div> <button onclick="refreshRoomList();"> Refresh</button>
|
||||
<button onclick="addRoom(null, null, true);">or join </button>
|
||||
<input id="roomToAdd" type="text" size="20" />
|
||||
<br>
|
||||
Optional room parameters<input id="optRoomParms" type="text" size="20"/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="postconnection">
|
||||
<hr>
|
||||
<div id="sendMessageArea">
|
||||
|
||||
<div id="iam">Not connected yet</div>
|
||||
<textarea id="sendMessageText" placeholder="Enter your message here"></textarea>
|
||||
|
||||
Rooms:
|
||||
<div id="rooms"></div>
|
||||
</div>
|
||||
<div id="receiveMessageArea">
|
||||
Received Messages:
|
||||
<div id="conversation"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div>
|
||||
|
||||
<h3> Adding api fields</h3>
|
||||
<input type="text" id="apiroomname" placeholder="room name">
|
||||
<input type="text" id="apifieldname" placeholder="field name"><br>
|
||||
<input size="50" type="text" id="apifieldvalue" placeholder="field value"><br>
|
||||
<button onclick="addApiField()">Add the api field</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Getting the list of room occupants</h3>
|
||||
<input type="text" id="queryRoom" placeholder="room name">
|
||||
<button onclick="queryRoomNames();">Dump occupant names to console</button>
|
||||
</div>
|
||||
|
||||
<div class="postconnection">
|
||||
<hr>
|
||||
<h3>Fields from server</h3>
|
||||
<div id="fields">
|
||||
</div>
|
||||
<hr>
|
||||
<button onclick="easyrtc.getFreshIceConfig();" class="postconnection"> Get Fresh ICE configuration</button>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3> Name To Id</h3>
|
||||
<div >
|
||||
<input id="targetName" type="text" />
|
||||
<button onclick="getIdsOfName();">Fetch ids</button>
|
||||
<div id="foundIds"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--hide-->
|
||||
<hr />
|
||||
<h2>Testing the following EasyRTC Features:</h2>
|
||||
<ul>
|
||||
<li><strong>Authentication</strong> - If username is provided, it will be available to others to see.</li>
|
||||
<li><strong>Define Rooms during Authentication</strong> - You can join rooms before you press 'Connect'.</li>
|
||||
<li><strong>Default Rooms</strong> - If you join no rooms before you connect, you will join the default room.</li>
|
||||
<li><strong>Messages to All In Room (targetRoom)</strong> - Type a message, then click on a room name to send it to everyone in the same room. When received, the other client will know it was sent to the room at large.</li>
|
||||
<li><strong>Message to Individual In Room (targetRoom + targetEasyrtcid)</strong> - Type a message, then click on another client in a room to send it to just that person. That person will know it was sent directly to them, and that it was sent via a specific room.</li>
|
||||
<li><strong>Presence</strong> - Your presence gets sent to all clients in rooms you share. DND=Do not disturb. XE=Extended Away. The status field can be any string.</li>
|
||||
<li><strong>Delta Lists</strong> - After initial login, the client should only receive changes to who is online.</li>
|
||||
</ul>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<!--hide-->
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
addQuickJoinButtons({
|
||||
room1: {roomName: "room1", numberClients: " "},
|
||||
room2: {roomName: "room2", numberClients: " "},
|
||||
room3: {roomName: "room3", numberClients: " "}
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
106
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_instant_messaging_selfconnect.html
generated
vendored
@ -1,106 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: User Supplied Socket.io</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_instant_messaging_selfconnect.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#stuffToSend {width:300px;}
|
||||
#sendMessageArea{
|
||||
float:left;
|
||||
width:400px;
|
||||
padding-right:20px;
|
||||
}
|
||||
#sendMessageText{
|
||||
width:100%;
|
||||
}
|
||||
#conversation {
|
||||
height:300px;
|
||||
border:solid 1px gray;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body >
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: User Supplied Socket.io</h1>
|
||||
<p>This variation on instant messaging uses a socket.io connection
|
||||
allocated by the application rather than internally. This can be useful if you have more advanced
|
||||
socket.io requirements.</p>
|
||||
|
||||
<p>It supports two options, connecting immediately after creating a websocket,
|
||||
connecting 10 seconds after creating the websocket. <command></p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<button id="buttonImmediate" onclick="connect(true);">Easyrtc Connect Immediately</button>
|
||||
<button id="buttonDelayed" onclick="connect(false);">Easyrtc connect after 10 seconds</button><br>
|
||||
|
||||
<div id="sendMessageArea">
|
||||
<div id="iam">Obtaining ID...</div>
|
||||
<textarea id="sendMessageText"></textarea>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="receiveMessageArea">
|
||||
Received Messages:
|
||||
<div id="conversation"></div>
|
||||
</div>
|
||||
|
||||
<!--hide-->
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_instant_messaging.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<!--hide-->
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
100
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_lowbandwidth.html
generated
vendored
@ -1,100 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Low-bandwidth Chat</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_audio_video_simple.css" />
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/labs/easyrtc_rates.js"></script>
|
||||
<script type="text/javascript" src="js/demo_lowbandwidth.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body onload="connect();">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Low-bandwidth Chat</h1>
|
||||
|
||||
<p>The application provides a simple audio-video chat using experimental SDP filters to reduce the bandwidth used.</p>
|
||||
|
||||
<p>Connection is handled using an onload statement in the body. Requests are automatically accepted.<p>
|
||||
|
||||
<p>To hang-up on a call, hover your mouse over the upper right of the video, and click on the 'X' which appears at the top right of other person's video object.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" class="easyrtcMirror" id="selfVideo" muted="muted" volume="0" ></video>
|
||||
<div style="position:relative;float:left;">
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
</div>
|
||||
<!-- each caller video needs to be in it's own div so it's close button can be positioned correctly -->
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
|
||||
<h3>CSS</h3>
|
||||
<p>In order to show the 'X' in the upper right corner, the callerVideo video tag must be in a div with relative positioning.:</p>
|
||||
<pre id="prettyCSS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video_simple.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
loadAndFilter(getHelperPath("css"), "prettyCSS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
32
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_multiparty.html
generated
vendored
@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Multiparty Chatroom</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_room.css" />
|
||||
<script type="text/javascript" src="js/demo_multiparty.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="appInit()">
|
||||
<div id="fullpage" class="boxCommon" style="background-image:url(images/irongrip.png)">
|
||||
<video id="box0" class="transit boxCommon thumbCommon easyRTCMirror" muted="muted" volume="0" ></video>
|
||||
<video id="box1" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<video id="box2" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<video id="box3" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<div id="textentryBox" onsubmit="sendText()" style="display:none" >
|
||||
<input type="text" id="textentryField" class="transit boxcommon" /><br>
|
||||
<button id="textentrySubmit" style="float:right;margin-right:1em" onclick="sendText()">Send</button>
|
||||
<button id="textentryCancel" style="float:left;margin-left:1em" onclick="cancelText()">Cancel</button>
|
||||
</div>
|
||||
|
||||
<img id="killButton" class="transit boxCommon" onclick="killActiveBox()" src="images/button_close.png" style="display:none;z-index:3" alt="close button" />
|
||||
<img id="muteButton" class="transit boxCommon" onclick ="muteActiveBox()" src="images/button_mute.png" style="display:none;z-index:3" alt="mute button" />
|
||||
<img id="textEntryButton" class="transit boxCommon" onclick ="showTextEntry()" src="images/textEntry.png" style="z-index:3;display:none" alt="text button" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
147
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_multistream.html
generated
vendored
@ -1,147 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Multistream calls</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_multistream.js"></script>
|
||||
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!--hide-->
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Multistream calls</h1>
|
||||
|
||||
<p>This application demonstrates sending multiple video streams from one caller to another.
|
||||
You can open up the media streams before or after establishing the call to the other peer.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing the video sources and a list of buttons representing other people using this demo.
|
||||
Click one of those buttons to initiate a chat. Note: this demo looks much better when hosted on an https site.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<H3> Video sources</h3>
|
||||
<div id="videoSrcBlk">
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<h3>Local media streams</h3>
|
||||
<div autoplay="autoplay" id="localVideos"></div>
|
||||
<h3>Remote media streams</h3>
|
||||
<div autoplay="autoplay" id="remoteVideos"></div>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
148
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_multistream_iframe.html
generated
vendored
@ -1,148 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Multistream calls</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/labs/desktop_capture_iframe_version.js"></script>
|
||||
<script type="text/javascript" src="js/demo_multistream_iframe.js"></script>
|
||||
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!--hide-->
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Multistream calls</h1>
|
||||
|
||||
<p>This application demonstrates sending multiple video streams from one caller to another.
|
||||
You can open up the media streams before or after establishing the call to the other peer.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing the video sources and a list of buttons representing other people using this demo.
|
||||
Click one of those buttons to initiate a chat. Note: this demo looks much better when hosted on an https site.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<H3> Video sources</h3>
|
||||
<div id="videoSrcBlk">
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<h3>Local media streams</h3>
|
||||
<div autoplay="autoplay" id="localVideos"></div>
|
||||
<h3>Remote media streams</h3>
|
||||
<div autoplay="autoplay" id="remoteVideos"></div>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
153
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_multistream_no_iframe.html
generated
vendored
@ -1,153 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Multistream calls</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/labs/desktop_capture_no_iframe_version.js"></script>
|
||||
|
||||
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/tawk-desktop-capture/bemabaogbdfpbkkganibcmhbgjogabfj">
|
||||
|
||||
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!--hide-->
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Multistream calls</h1>
|
||||
|
||||
<p>This application demonstrates sending multiple video streams from one caller to another.
|
||||
You can open up the media streams before or after establishing the call to the other peer.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing the video sources and a list of buttons representing other people using this demo.
|
||||
Click one of those buttons to initiate a chat. Note: this demo looks much better when hosted on an https site.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
|
||||
<div id="connectControls">
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
|
||||
<button id="installPluginButton">Install plugin</button>
|
||||
<div id="pluginstatus"></div>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<H3> Video sources</h3>
|
||||
<div id="videoSrcBlk"></div>
|
||||
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<h3>Local media streams</h3>
|
||||
<div autoplay="autoplay" id="localVideos"></div>
|
||||
<h3>Remote media streams</h3>
|
||||
<div autoplay="autoplay" id="remoteVideos"></div>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
<script type="text/javascript" src="js/demo_multistream_no_iframe.js"></script>
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
20
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_reconnect.html
generated
vendored
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Reconnect</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_reconnect.js"></script>
|
||||
</head>
|
||||
<body onload="initApp()">
|
||||
State = <div id="stateLabel">Unconnected</div>
|
||||
<button onclick="sendDummy()">verify connected</button>
|
||||
<button onclick="disconnect()">manually disconnect</button>
|
||||
<button onclick="connect()">manually connect</button>
|
||||
</body>
|
||||
</html>
|
32
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_room.html
generated
vendored
@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title> EasyRTC Room</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/demo_room.css" />
|
||||
<script type="text/javascript" src="js/demo_room.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="appInit()">
|
||||
<div id="fullpage" class="boxCommon" style="background-image:url(images/irongrip.png)">
|
||||
<video id="box0" class="transit boxCommon thumbCommon easyrtcMirror" muted="muted" volume="0" ></video>
|
||||
<video id="box1" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<video id="box2" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<video id="box3" class="transit boxCommon thumbCommon" style="visibility:hidden"></video>
|
||||
<div id="textentryBox" onsubmit="sendText()" style="display:none" >
|
||||
<input type="text" id="textentryField" class="transit boxcommon" /><br>
|
||||
<button id="textentrySubmit" style="float:right;margin-right:1em" onclick="sendText()">Send</button>
|
||||
<button id="textentryCancel" style="float:left;margin-left:1em" onclick="cancelText()">Cancel</button>
|
||||
</div>
|
||||
|
||||
<image id="killButton" class="transit boxCommon" onclick="killActiveBox()" src="images/button_close.png" style="display:none;z-index:3" alt="close button">
|
||||
<image id="muteButton" class="transit boxCommon" onclick ="muteActiveBox()" src="images/button_mute.png" style="display:none;z-index:3" alt="mute button">
|
||||
<image id="textEntryButton" class="transit boxCommon" onclick ="showTextEntry()" src="images/textEntry.png" style="z-index:3;display:none" alt="text button">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
168
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_screen_receive.html
generated
vendored
@ -1,168 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Screen Sharing Receiver</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_screen_receive.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:360px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:auto;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
.smallBox{
|
||||
width:500px;
|
||||
height:400px;
|
||||
overflow:scroll;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.bigBox{
|
||||
position:fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
top:0px;
|
||||
z-index:2;
|
||||
overflow:scroll;
|
||||
}
|
||||
|
||||
.noShrink {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.yesShrink {
|
||||
position:fixed;
|
||||
right: 20px;
|
||||
top : 20px;
|
||||
z-index:3;
|
||||
padding:1em;
|
||||
border-radius: 10px;
|
||||
border-color: red;
|
||||
border-style: solid;
|
||||
background-color: black;
|
||||
color: white;
|
||||
opacity: 0.70;
|
||||
}
|
||||
|
||||
.yesShrink:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="initApp">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Screen Sharing Receiver</h1>
|
||||
|
||||
<p>The application receives a video screen capture from a complementary sending program.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing other people using this demo.
|
||||
Click one of those buttons to see (with their permission) their live screen.</p>
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
|
||||
<span style="float:left">
|
||||
Your name: <input type="text" id="userName" />
|
||||
<input type="checkbox" id="shareAudio" /><label for="shareAudio"> Share audio</label><br>
|
||||
</span>
|
||||
<span style="float:left;clear:both">
|
||||
<button id="connectButton" onclick="connect()">Connect to server</button>
|
||||
<button id="disconnectButton" disabled="disabled" onclick="disconnect()">Disconnect</button>
|
||||
</span>
|
||||
<div style="float:left;clear:both" id="iam">Not yet connected...</div>
|
||||
<div style="float:left;clear:both" id="otherClients"></div>
|
||||
<button style="float:left;clear:both" id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<button style="float:right" onclick="requestFullScreen()">Use full screen</button>
|
||||
|
||||
</div>
|
||||
<div id="videos" class="smallBox">
|
||||
<div id ="shrinkBox" class="noShrink">
|
||||
<p>
|
||||
Click here to exit<br>
|
||||
full screen.
|
||||
</p>
|
||||
</div>
|
||||
<video autoplay="autoplay" id="callerVideo" ></video>
|
||||
</div><br>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<p><em>Browser Note: Until there is better interoperability among browsers, both clients may need to be using the same browser type.</em></p>
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
121
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_screen_send.html
generated
vendored
@ -1,121 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Screen Sharing Sender</title>
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<!--show-->
|
||||
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_screen_send.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#demoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:450px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body onload="initApp()">
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="/easyrtc/img/easyrtc.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Screen share - Sender</h1>
|
||||
|
||||
<p>This application shares the screen(s) of it's host.</p>
|
||||
<p style='color:red'> Currently this demo only runs in
|
||||
Chrome. It must be hosted on an https server.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="demoContainer">
|
||||
<div id="connectControls">
|
||||
<span style="float:left">
|
||||
Your name: <input type="text" id="userName" />
|
||||
<input type="checkbox" id="shareAudio" /><label for="shareAudio"> Share audio</label><br>
|
||||
</span>
|
||||
<span style="float:left;clear:both">
|
||||
<button id="connectButton" onclick="connect()">Connect to server</button>
|
||||
<button id="disconnectButton" disabled="disabled" onclick="disconnect()">Disconnect from server</button><br>
|
||||
</span>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()" style="float:left;clear:both">Hangup</button><br>
|
||||
<div id="iam" style="clear:both">Not yet connected...</div>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<audio id="callerAudio"></audio>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<p><em>Browser Note: Until there is better interoperability among browsers, both clients may need to be using the same browser type.</em></p>
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHTML" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_audio_video.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHTML",2 );
|
||||
loadAndFilter(window.location.href.replace("/demos/", "/demos/js/").replace(/.html$/, ".js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="/easyrtc/img/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 Lcense. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
135
messenger/js/easyrtc/node_modules/easyrtc/demos/demo_video_only.html
generated
vendored
@ -1,135 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--skip-->
|
||||
<title>EasyRTC Demo: Video Only</title>
|
||||
<link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />
|
||||
|
||||
<!--hide-->
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
|
||||
|
||||
<!-- Prettify Code -->
|
||||
<script type="text/javascript" src="js/prettify/prettify.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/loadAndFilter.js"></script>
|
||||
<script type="text/javascript" src="js/prettify/jquery.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="js/prettify/prettify.css" />
|
||||
<!--show-->
|
||||
<!-- Assumes global locations for socket.io.js and easyrtc.js -->
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="/easyrtc/easyrtc.js"></script>
|
||||
<script type="text/javascript" src="js/demo_video_only.js"></script>
|
||||
<!--hide-->
|
||||
<!-- Styles used within the demo -->
|
||||
<style type="text/css">
|
||||
#videoDemoContainer {
|
||||
position:relative;
|
||||
}
|
||||
#connectControls {
|
||||
float:left;
|
||||
width:250px;
|
||||
text-align:center;
|
||||
border: 2px solid black;
|
||||
}
|
||||
#otherClients {
|
||||
height:200px;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
#selfVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
float:left;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#callerVideo {
|
||||
height:225px;
|
||||
width:300px;
|
||||
border:1px solid gray;
|
||||
margin-left:10px;
|
||||
}
|
||||
#acceptCallBox {
|
||||
display:none;
|
||||
z-index:2;
|
||||
position:absolute;
|
||||
top:100px;
|
||||
left:400px;
|
||||
border:red solid 2px;
|
||||
background-color:pink;
|
||||
padding:15px;
|
||||
}
|
||||
</style>
|
||||
<!--show-->
|
||||
</head>
|
||||
<body>
|
||||
<!--hide-->
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">EasyRTC.com</div></a></div>
|
||||
<div id="main">
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Demo: Video Only</h1>
|
||||
|
||||
<p>The application provides a video-only chat by disabling audio before initializing the local media stream.</p>
|
||||
|
||||
<p>To use it, press the Connect button.
|
||||
You should see buttons representing other people using the video-only chat page.
|
||||
Click one of those buttons to initiate a chat.</p>
|
||||
|
||||
<hr />
|
||||
<h2>The Demo</h2>
|
||||
<!--show-->
|
||||
<div id="videoDemoContainer">
|
||||
<div id="connectControls">
|
||||
<button id="connectButton" onclick="connect()">Connect</button>
|
||||
<button id="hangupButton" disabled="disabled" onclick="hangup()">Hangup</button>
|
||||
<div id="iam">Not yet connected...</div>
|
||||
<br />
|
||||
<strong>Connected users:</strong>
|
||||
<div id="otherClients"></div>
|
||||
</div>
|
||||
|
||||
<div id="videos">
|
||||
<video autoplay="autoplay" id="selfVideo" class="easyrtcMirror"></video>
|
||||
<video autoplay="autoplay" id="callerVideo"></video>
|
||||
<div id="acceptCallBox"> <!-- Should be initially hidden using CSS -->
|
||||
<div id="acceptCallLabel"></div>
|
||||
<button id="callAcceptButton" >Accept</button> <button id="callRejectButton">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--hide-->
|
||||
<br style="clear:both;" />
|
||||
<hr />
|
||||
|
||||
<h2>The Code</h2>
|
||||
<h3>HTML</h3>
|
||||
<pre id="prettyHtml" class="prettyprint linenums:1">
|
||||
</pre>
|
||||
<h3>JavaScript</h3>
|
||||
<p>The contents of demo_video_only.js:</p>
|
||||
<pre id="prettyJS" class="prettyprint linenums:1" style="white-space: pre-wrap;">
|
||||
</pre>
|
||||
|
||||
|
||||
<!-- Runs the SyntaxHighlighter -->
|
||||
<script type="text/javascript">
|
||||
loadAndFilter(window.location.href, "prettyHtml",2 );
|
||||
loadAndFilter(getHelperPath("js"), "prettyJS", 2);
|
||||
</script>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--show-->
|
||||
</body>
|
||||
</html>
|
8
messenger/js/easyrtc/node_modules/easyrtc/demos/images/LICENSE
generated
vendored
@ -1,8 +0,0 @@
|
||||
Licenses for images In demo folder
|
||||
----------------------------------
|
||||
|
||||
Browser logos are copyright by their respective owner.
|
||||
|
||||
Logos for Priologic Software Inc, and EasyRTC are owned by Priologic Software Inc.
|
||||
|
||||
Permission is granted to use powered_by_easyrtc.png within your own application as long as it is not altered in any way.
|
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/bg_dark.png
generated
vendored
Before Width: | Height: | Size: 9.0 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/bg_light.png
generated
vendored
Before Width: | Height: | Size: 8.4 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/blank.gif
generated
vendored
Before Width: | Height: | Size: 43 B |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_chrome.png
generated
vendored
Before Width: | Height: | Size: 1.8 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_chrome_canary.png
generated
vendored
Before Width: | Height: | Size: 1.5 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_ff.png
generated
vendored
Before Width: | Height: | Size: 2.8 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_ff_aurora.png
generated
vendored
Before Width: | Height: | Size: 2.6 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_ff_nightly.png
generated
vendored
Before Width: | Height: | Size: 2.6 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_ie.png
generated
vendored
Before Width: | Height: | Size: 2.3 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_opera.png
generated
vendored
Before Width: | Height: | Size: 1.9 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_safari.png
generated
vendored
Before Width: | Height: | Size: 2.4 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_status_fail.png
generated
vendored
Before Width: | Height: | Size: 507 B |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_status_pass.png
generated
vendored
Before Width: | Height: | Size: 390 B |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/br_status_warn.png
generated
vendored
Before Width: | Height: | Size: 819 B |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/button_close.png
generated
vendored
Before Width: | Height: | Size: 4.2 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/button_mute.png
generated
vendored
Before Width: | Height: | Size: 5.9 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/button_refresh.png
generated
vendored
Before Width: | Height: | Size: 1.6 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/button_unmute.png
generated
vendored
Before Width: | Height: | Size: 7.7 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/by_priologic_logo.png
generated
vendored
Before Width: | Height: | Size: 2.4 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/cloud.png
generated
vendored
Before Width: | Height: | Size: 9.5 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/easyrtc_logo.png
generated
vendored
Before Width: | Height: | Size: 3.4 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/irongrip.png
generated
vendored
Before Width: | Height: | Size: 55 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/powered_by_easyrtc.png
generated
vendored
Before Width: | Height: | Size: 4.1 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/priologic_logo_white.png
generated
vendored
Before Width: | Height: | Size: 2.7 KiB |
BIN
messenger/js/easyrtc/node_modules/easyrtc/demos/images/textEntry.png
generated
vendored
Before Width: | Height: | Size: 3.2 KiB |
265
messenger/js/easyrtc/node_modules/easyrtc/demos/index.html
generated
vendored
@ -1,265 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>EasyRTC - Landing Page</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/landing.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<a href="index.html"><img id="logo_easyrtc" src="images/easyrtc_logo.png" alt="EasyRTC" style="" /></a>
|
||||
</div>
|
||||
<div id="menu"><a class="menu_link" href="index.html"><div class="menu_item">Local Demos</div></a><a class="menu_link" href="https://github.com/priologic/easyrtc/tree/master/docs"><div class="menu_item">Documentation</div></a><a class="menu_link" href="https://groups.google.com/forum/#!forum/easyrtc"><div class="menu_item">Support: Discussion Group</div></a><a class="menu_link" href="http://www.easyrtc.com/"><div class="menu_item">easyrtc.com</div></a></div>
|
||||
<div id="main">
|
||||
|
||||
<!-- Main Content -->
|
||||
<h1>EasyRTC Landing Page</h1>
|
||||
<p>Congratulations! With EasyRTC installed you are on the road to creating your own WebRTC enabled applications.</p>
|
||||
<p>The easiest way to run these demos to create two browser windows and open an instance of a particular demo
|
||||
in each window. Please make sure that Skype or other programs aren't using your webcam before
|
||||
starting the video chat demos.
|
||||
</p>
|
||||
<h2>Local EasyRTC Demos</h2>
|
||||
|
||||
<h3> These are the easy very basic demos.</h3>
|
||||
<table class="demo_table">
|
||||
<tr>
|
||||
<th>Demo</th>
|
||||
<th><a href="http://www.google.com/chrome"><img title="Chrome" alt="Chrome" height="32" width="32" src="images/br_chrome.png" /></a></th>
|
||||
<th><a href="http://www.chromium.org/getting-involved/dev-channel"><img title="Chrome Canary" alt="Chrome Canary" height="32" width="32" src="images/br_chrome_canary.png" /></a></th>
|
||||
<th><a href="http://www.mozilla.org/en-US/firefox/"><img title="Firefox" alt="Firefox" height="32" width="32" src="images/br_ff.png" /></a></th>
|
||||
<th><a href="http://www.mozilla.org/en-US/firefox/aurora/"><img title="Firefox Aurora" alt="Firefox Aurora" height="32" width="32" src="images/br_ff_aurora.png" /></a></th>
|
||||
<th><a href="http://nightly.mozilla.org/"><img title="Firefox Nightly" alt="Firefox Nightly" height="32" width="32" src="images/br_ff_nightly.png" /></a></th>
|
||||
<th><a href="http://www.opera.com/"><img title="Opera" alt="Opera" height="32" width="32" src="images/br_opera.png" /></a></th>
|
||||
<th><a href="http://windows.microsoft.com/en-US/internet-explorer/download-ie"><img title="Internet Explorer" alt="Internet Explorer" height="32" width="32" src="images/br_ie.png" /></a></th>
|
||||
<th><a href="http://www.apple.com/safari/"><img title="Safari" alt="Safari" height="32" width="32" src="images/br_safari.png" /></a></th>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="demo_instant_messaging.html">Instant Messaging</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_data_channel_messaging.html">Data Channel Messaging</a></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Warn" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_audio_video_simple.html">Simple Video+Audio</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_multiparty.html">Multiparty Chatroom</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3> More technical demos that illustrate particular capabilities.</h3>
|
||||
<table class="demo_table">
|
||||
<tr>
|
||||
<th>Demo</th>
|
||||
<th><a href="http://www.google.com/chrome"><img title="Chrome" alt="Chrome" height="32" width="32" src="images/br_chrome.png" /></a></th>
|
||||
<th><a href="http://www.chromium.org/getting-involved/dev-channel"><img title="Chrome Canary" alt="Chrome Canary" height="32" width="32" src="images/br_chrome_canary.png" /></a></th>
|
||||
<th><a href="http://www.mozilla.org/en-US/firefox/"><img title="Firefox" alt="Firefox" height="32" width="32" src="images/br_ff.png" /></a></th>
|
||||
<th><a href="http://www.mozilla.org/en-US/firefox/aurora/"><img title="Firefox Aurora" alt="Firefox Aurora" height="32" width="32" src="images/br_ff_aurora.png" /></a></th>
|
||||
<th><a href="http://nightly.mozilla.org/"><img title="Firefox Nightly" alt="Firefox Nightly" height="32" width="32" src="images/br_ff_nightly.png" /></a></th>
|
||||
<th><a href="http://www.opera.com/"><img title="Opera" alt="Opera" height="32" width="32" src="images/br_opera.png" /></a></th>
|
||||
<th><a href="http://windows.microsoft.com/en-US/internet-explorer/download-ie"><img title="Internet Explorer" alt="Internet Explorer" height="32" width="32" src="images/br_ie.png" /></a></th>
|
||||
<th><a href="http://www.apple.com/safari/"><img title="Safari" alt="Safari" height="32" width="32" src="images/br_safari.png" /></a></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_instant_messaging_rooms.html">Instant Messaging + Rooms </a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="demo_instant_messaging_selfconnect.html">User Supplied Socket.io</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="demo_audio_video_simple_hd.html">Video+Audio HD 720p</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_video_only.html">Video Only</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="demo_audio_only.html">Audio Only</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="demo_audio_video.html">Video+Audio</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_multistream.html">Multistream calls</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_multistream_iframe.html">Desktop capture with iframe</a><br>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_multistream_no_iframe.html">Desktop capture without iframe</a><br>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_data_channel_filesharing.html">Data Channel File-sharing</a></td>
|
||||
<td><img alt="Pail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="demo_lowbandwidth.html">Low-bandwidth Chat</a></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Pass" height="32" width="32" src="images/br_status_pass.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
<td><img alt="Fail" height="32" width="32" src="images/br_status_fail.png" /></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="9" id="browser_note"><em>Note: Browser compatability subject to change.</em></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>EasyRTC Links</h2>
|
||||
<ul>
|
||||
<li><a href="http://easyrtc.com">easyrtc.com</a> - Our project homepage</li>
|
||||
<li><a href="https://groups.google.com/forum/#!forum/easyrtc">Support Forums</a></li>
|
||||
<li><a href="https://github.com/priologic/easyrtc/issues">Issue tracker</a></li>
|
||||
<li><a href="http://www.youtube.com/user/priologic">EasyRTC YouTube channel</a> - with live demos</li>
|
||||
</ul>
|
||||
|
||||
<h2>Other WebRTC Resources</h2>
|
||||
<ul>
|
||||
<li><a href="http://dev.w3.org/2011/webrtc/editor/webrtc.html">W3C - WebRTC Specification Document</a></li>
|
||||
<li><a href="http://tools.ietf.org/wg/rtcweb/">IETF Working Group</a></li>
|
||||
<li><a href="http://www.webrtc.org/">Google's WebRTC Project Home</a></li>
|
||||
<li><a href="https://wiki.mozilla.org/Platform/Features/WebRTC">Mozilla WebRTC Wiki</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- End Main Content -->
|
||||
</div>
|
||||
<div id="footer">
|
||||
<a href="http://www.priologic.com/?from=landing"><img id="logo_priologic" src="images/priologic_logo_white.png" height="40" width="150" alt="Created By Priologic Software Inc." /></a>
|
||||
<a href="http://www.easyrtc.com/?from=landing"><img id="logo_pb_easyrtc" src="/easyrtc/img/powered_by_easyrtc.png" height="60" width="200" alt="Powered By EasyRTC" /></a>
|
||||
<p><em>© 2014 - Priologic Software Inc., All Rights Reserved.</em></p>
|
||||
<p id="license">EasyRTC source code released under a BSD2 License. <a href="https://github.com/priologic/easyrtc/blob/master/LICENSE">See LICENSE file in project folder</a> for details.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
89
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo4.js
generated
vendored
@ -1,89 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.enableDebug(false);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.easyApp("easyrtc.demo4", "selfVideo",
|
||||
["callerVideo", "callerVideo2", "callerVideo3"], loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode(easyrtcid);
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if( !accepted ) {
|
||||
alert("Sorry, your call to " + easyrtcid + " was rejected");
|
||||
}
|
||||
};
|
||||
var successCB = function() {};
|
||||
var failureCB = function() {};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB, acceptedCB);
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
// Sets calls so they are automatically accepted (this is default behaviour)
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
callback(true);
|
||||
} );
|
169
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_audio_only.js
generated
vendored
@ -1,169 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
function disable(domId) {
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function connect() {
|
||||
console.log("Initializing.");
|
||||
easyrtc.enableVideo(false);
|
||||
easyrtc.enableVideoReceive(false);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.initMediaSource(
|
||||
function(){ // success callback
|
||||
easyrtc.connect("easyrtc.audioOnly", loginSuccess, loginFailure);
|
||||
},
|
||||
function(errorCode, errmesg){
|
||||
easyrtc.showError(errorCode, errmesg);
|
||||
} // failure callback
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function terminatePage() {
|
||||
easyrtc.disconnect();
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createElement('text');
|
||||
label.innerHTML = easyrtc.idToName(easyrtcid);
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
var acceptedCB = function(accepted, caller) {
|
||||
if( !accepted ) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(caller) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
};
|
||||
var successCB = function() {
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB, acceptedCB);
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
// enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
easyrtc.disconnect();
|
||||
console.log("disconnecting from server");
|
||||
enable("connectButton");
|
||||
// disable("disconnectButton");
|
||||
clearConnectList();
|
||||
}
|
||||
|
||||
|
||||
easyrtc.setStreamAcceptor( function(easyrtcid, stream) {
|
||||
var audio = document.getElementById('callerAudio');
|
||||
easyrtc.setVideoObjectSrc(audio,stream);
|
||||
enable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed( function (easyrtcid) {
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('callerAudio'), "");
|
||||
disable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
document.getElementById('acceptCallBox').style.display = "block";
|
||||
if( easyrtc.getConnectionCount() > 0 ) {
|
||||
document.getElementById('acceptCallLabel').textContent = "Drop current call and accept new from " + easyrtcid + " ?";
|
||||
}
|
||||
else {
|
||||
document.getElementById('acceptCallLabel').textContent = "Accept incoming call from " + easyrtcid + " ?";
|
||||
}
|
||||
var acceptTheCall = function(wasAccepted) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
if( wasAccepted && easyrtc.getConnectionCount() > 0 ) {
|
||||
easyrtc.hangupAll();
|
||||
}
|
||||
callback(wasAccepted);
|
||||
};
|
||||
document.getElementById("callAcceptButton").onclick = function() {
|
||||
acceptTheCall(true);
|
||||
};
|
||||
document.getElementById("callRejectButton").onclick =function() {
|
||||
acceptTheCall(false);
|
||||
};
|
||||
} );
|
193
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_audio_video.js
generated
vendored
@ -1,193 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var haveSelfVideo = false;
|
||||
|
||||
function disable(domId) {
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.enableAudio(document.getElementById("shareAudio").checked);
|
||||
easyrtc.enableVideo(document.getElementById("shareVideo").checked);
|
||||
easyrtc.enableDataChannels(true);
|
||||
easyrtc.setRoomOccupantListener( convertListToButtons);
|
||||
easyrtc.initMediaSource(
|
||||
function(){ // success callback
|
||||
var selfVideo = document.getElementById("selfVideo");
|
||||
easyrtc.setVideoObjectSrc(selfVideo, easyrtc.getLocalStream());
|
||||
easyrtc.connect("easyrtc.audioVideo", loginSuccess, loginFailure);
|
||||
},
|
||||
loginFailure
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode("Call " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setUpMirror() {
|
||||
if( !haveSelfVideo) {
|
||||
var selfVideo = document.getElementById("selfVideo");
|
||||
easyrtc.setVideoObjectSrc(selfVideo, easyrtc.getLocalStream());
|
||||
selfVideo.muted = true;
|
||||
haveSelfVideo = true;
|
||||
}
|
||||
}
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if( !accepted ) {
|
||||
easyrtc.showError("CALL-REJECTEd", "Sorry, your call to " + easyrtc.idToName(easyrtcid) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
};
|
||||
|
||||
var successCB = function() {
|
||||
setUpMirror();
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB, acceptedCB);
|
||||
enable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
// enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
easyrtc.showError("noerror", "logged in");
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
easyrtc.disconnect();
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
enable("connectButton");
|
||||
disable("disconnectButton");
|
||||
easyrtc.clearMediaStream( document.getElementById('selfVideo'));
|
||||
easyrtc.setVideoObjectSrc(document.getElementById("selfVideo"),"");
|
||||
easyrtc.closeLocalMediaStream();
|
||||
easyrtc.setRoomOccupantListener( function(){});
|
||||
clearConnectList();
|
||||
}
|
||||
|
||||
|
||||
easyrtc.setStreamAcceptor( function(easyrtcid, stream) {
|
||||
setUpMirror();
|
||||
var video = document.getElementById('callerVideo');
|
||||
easyrtc.setVideoObjectSrc(video,stream);
|
||||
enable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed( function (easyrtcid) {
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('callerVideo'), "");
|
||||
disable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
var callerPending = null;
|
||||
|
||||
easyrtc.setCallCancelled( function(easyrtcid){
|
||||
if( easyrtcid === callerPending) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
callerPending = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
document.getElementById('acceptCallBox').style.display = "block";
|
||||
callerPending = easyrtcid;
|
||||
if( easyrtc.getConnectionCount() > 0 ) {
|
||||
document.getElementById('acceptCallLabel').innerHTML = "Drop current call and accept new from " + easyrtc.idToName(easyrtcid) + " ?";
|
||||
}
|
||||
else {
|
||||
document.getElementById('acceptCallLabel').innerHTML = "Accept incoming call from " + easyrtc.idToName(easyrtcid) + " ?";
|
||||
}
|
||||
var acceptTheCall = function(wasAccepted) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
if( wasAccepted && easyrtc.getConnectionCount() > 0 ) {
|
||||
easyrtc.hangupAll();
|
||||
}
|
||||
callback(wasAccepted);
|
||||
callerPending = null;
|
||||
};
|
||||
document.getElementById("callAcceptButton").onclick = function() {
|
||||
acceptTheCall(true);
|
||||
};
|
||||
document.getElementById("callRejectButton").onclick =function() {
|
||||
acceptTheCall(false);
|
||||
};
|
||||
} );
|
54
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_audio_video_simple.js
generated
vendored
@ -1,54 +0,0 @@
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.setVideoDims(640,480);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.easyApp("easyrtc.audioVideoSimple", "selfVideo", ["callerVideo"], loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, data, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in data) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode(easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
|
||||
var successCB = function() {};
|
||||
var failureCB = function() {};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB);
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
91
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_audio_video_simple_hd.js
generated
vendored
@ -1,91 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.setVideoDims(1280,720);
|
||||
easyrtc.enableDebug(false);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.easyApp("easyrtc.videoChatHd", "selfVideo", ["callerVideo"], loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, data, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in data) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode(easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
button.className = "callbutton";
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
var acceptedCB = function(accepted, caller) {
|
||||
if( !accepted ) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(caller) + " was rejected");
|
||||
}
|
||||
};
|
||||
var successCB = function() {};
|
||||
var failureCB = function() {};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB, acceptedCB);
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
// Sets calls so they are automatically accepted (this is default behaviour)
|
||||
easyrtc.setAcceptChecker(function(caller, cb) {
|
||||
cb(true);
|
||||
} );
|
292
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_data_channel_filesharing.js
generated
vendored
@ -1,292 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var peers = {};
|
||||
|
||||
function buildPeerBlockName(easyrtcid) {
|
||||
return "peerzone_" + easyrtcid;
|
||||
}
|
||||
|
||||
function buildDragNDropName(easyrtcid) {
|
||||
return "dragndrop_" + easyrtcid;
|
||||
}
|
||||
|
||||
function buildReceiveAreaName(easyrtcid) {
|
||||
return "receivearea_" + easyrtcid;
|
||||
}
|
||||
|
||||
|
||||
function connect() {
|
||||
var otherClientsDiv = document.getElementById('otherClients');
|
||||
|
||||
easyrtc.enableDataChannels(true);
|
||||
easyrtc.enableVideo(false);
|
||||
easyrtc.enableAudio(false);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, responsefn) {
|
||||
responsefn(true);
|
||||
document.getElementById("connectbutton_" + easyrtcid).style.visibility = "hidden";
|
||||
});
|
||||
|
||||
easyrtc.setDataChannelOpenListener(function(easyrtcid, usesPeer) {
|
||||
var obj = document.getElementById(buildDragNDropName(easyrtcid));
|
||||
if (!obj) {
|
||||
console.log("no such object ");
|
||||
}
|
||||
jQuery(obj).addClass("connected");
|
||||
jQuery(obj).removeClass("notConnected");
|
||||
});
|
||||
|
||||
easyrtc.setDataChannelCloseListener(function(easyrtcid) {
|
||||
jQuery(buildDragNDropName(easyrtcid)).addClass("notConnected");
|
||||
jQuery(buildDragNDropName(easyrtcid)).removeClass("connected");
|
||||
});
|
||||
|
||||
easyrtc.connect("easyrtc.dataFileTransfer", loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function removeIfPresent(parent, childname) {
|
||||
var item = document.getElementById(childname);
|
||||
if (item) {
|
||||
parent.removeChild(item);
|
||||
}
|
||||
else {
|
||||
console.log("didn't see item " + childname + " for delete eh");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function convertListToButtons(roomName, occupants, isPrimary) {
|
||||
var peerZone = document.getElementById('peerZone');
|
||||
for (var oldPeer in peers) {
|
||||
if (!occupants[oldPeer]) {
|
||||
removeIfPresent(peerZone, buildPeerBlockName(oldPeer));
|
||||
delete peers[oldPeer];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function buildDropDiv(easyrtcid) {
|
||||
var statusDiv = document.createElement("div");
|
||||
statusDiv.className = "dragndropStatus";
|
||||
|
||||
var dropArea = document.createElement("div");
|
||||
var connectButton = document.createElement("button");
|
||||
connectButton.appendChild(document.createTextNode("Connect"));
|
||||
connectButton.className = "connectButton";
|
||||
connectButton.id = "connectbutton_" + easyrtcid;
|
||||
connectButton.onclick = function() {
|
||||
statusDiv.innerHTML = "Waiting for connection to be established";
|
||||
easyrtc.call(easyrtcid,
|
||||
function(caller, mediatype) {
|
||||
statusDiv.innerHTML = "Connection established";
|
||||
dropArea.className = "dragndrop connected";
|
||||
connectButton.style.visibility = "hidden";
|
||||
},
|
||||
function(errorCode, errorText) {
|
||||
dropArea.className = "dragndrop connected";
|
||||
statusDiv.innerHTML = "Connection failed";
|
||||
connectButton.style.visibility = "hidden";
|
||||
noDCs[easyrtcid] = true;
|
||||
},
|
||||
function wasAccepted(yup) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
dropArea.id = buildDragNDropName(easyrtcid);
|
||||
dropArea.className = "dragndrop notConnected";
|
||||
dropArea.innerHTML = "File drop area";
|
||||
|
||||
|
||||
function updateStatusDiv(state) {
|
||||
switch (state.status) {
|
||||
case "waiting":
|
||||
statusDiv.innerHTML = "waiting for other party<br\>to accept transmission";
|
||||
break;
|
||||
case "started_file":
|
||||
statusDiv.innerHTML = "started file: " + state.name;
|
||||
case "working":
|
||||
statusDiv.innerHTML = state.name + ":" + state.position + "/" + state.size + "(" + state.numFiles + " files)";
|
||||
break;
|
||||
case "rejected":
|
||||
statusDiv.innerHTML = "cancelled";
|
||||
setTimeout(function() {
|
||||
statusDiv.innerHTML = "";
|
||||
}, 2000);
|
||||
break;
|
||||
case "done":
|
||||
statusDiv.innerHTML = "done";
|
||||
setTimeout(function() {
|
||||
statusDiv.innerHTML = "";
|
||||
}, 3000);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
var noDCs = {}; // which users don't support data channels
|
||||
|
||||
var fileSender = null;
|
||||
function filesHandler(files) {
|
||||
// if we haven't eastablished a connection to the other party yet, do so now,
|
||||
// and on completion, send the files. Otherwise send the files now.
|
||||
var timer = null;
|
||||
if (easyrtc.getConnectStatus(easyrtcid) === easyrtc.NOT_CONNECTED && noDCs[easyrtcid] === undefined) {
|
||||
//
|
||||
// calls between firefrox and chrome ( version 30) have problems one way if you
|
||||
// use data channels.
|
||||
//
|
||||
|
||||
}
|
||||
else if (easyrtc.getConnectStatus(easyrtcid) === easyrtc.IS_CONNECTED || noDCs[easyrtcid]) {
|
||||
if (!fileSender) {
|
||||
fileSender = easyrtc_ft.buildFileSender(easyrtcid, updateStatusDiv);
|
||||
}
|
||||
fileSender(files, true /* assume binary */);
|
||||
}
|
||||
else {
|
||||
easyrtc.showError("user-error", "Wait for the connection to complete before adding more files!");
|
||||
}
|
||||
}
|
||||
easyrtc_ft.buildDragNDropRegion(dropArea, filesHandler);
|
||||
var container = document.createElement("div");
|
||||
container.appendChild(connectButton);
|
||||
container.appendChild(dropArea);
|
||||
container.appendChild(statusDiv);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
function buildReceiveDiv(i) {
|
||||
var div = document.createElement("div");
|
||||
div.id = buildReceiveAreaName(i);
|
||||
div.className = "receiveBlock";
|
||||
div.style.display = "none";
|
||||
return div;
|
||||
}
|
||||
|
||||
|
||||
for (var easyrtcid in occupants) {
|
||||
if (!peers[easyrtcid]) {
|
||||
var peerBlock = document.createElement("div");
|
||||
peerBlock.id = buildPeerBlockName(easyrtcid);
|
||||
peerBlock.className = "peerblock";
|
||||
peerBlock.appendChild(document.createTextNode(" For peer " + easyrtcid));
|
||||
peerBlock.appendChild(document.createElement("br"));
|
||||
peerBlock.appendChild(buildDropDiv(easyrtcid));
|
||||
peerBlock.appendChild(buildReceiveDiv(easyrtcid));
|
||||
peerZone.appendChild(peerBlock);
|
||||
peers[easyrtcid] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function acceptRejectCB(otherGuy, fileNameList, wasAccepted) {
|
||||
|
||||
var receiveBlock = document.getElementById(buildReceiveAreaName(otherGuy));
|
||||
jQuery(receiveBlock).empty();
|
||||
receiveBlock.style.display = "inline-block";
|
||||
|
||||
//
|
||||
// list the files being offered
|
||||
//
|
||||
receiveBlock.appendChild(document.createTextNode("Files offered"));
|
||||
receiveBlock.appendChild(document.createElement("br"));
|
||||
for (var i = 0; i < fileNameList.length; i++) {
|
||||
receiveBlock.appendChild(
|
||||
document.createTextNode(" " + fileNameList[i].name + "(" + fileNameList[i].size + " bytes)"));
|
||||
receiveBlock.appendChild(document.createElement("br"));
|
||||
}
|
||||
//
|
||||
// provide accept/reject buttons
|
||||
//
|
||||
var button = document.createElement("button");
|
||||
button.appendChild(document.createTextNode("Accept"));
|
||||
button.onclick = function() {
|
||||
jQuery(receiveBlock).empty();
|
||||
wasAccepted(true);
|
||||
};
|
||||
receiveBlock.appendChild(button);
|
||||
|
||||
button = document.createElement("button");
|
||||
button.appendChild(document.createTextNode("Reject"));
|
||||
button.onclick = function() {
|
||||
wasAccepted(false);
|
||||
receiveBlock.style.display = "none";
|
||||
};
|
||||
receiveBlock.appendChild(button);
|
||||
}
|
||||
|
||||
|
||||
function receiveStatusCB(otherGuy, msg) {
|
||||
var receiveBlock = document.getElementById(buildReceiveAreaName(otherGuy));
|
||||
if( !receiveBlock) return;
|
||||
|
||||
switch (msg.status) {
|
||||
case "started":
|
||||
break;
|
||||
case "eof":
|
||||
receiveBlock.innerHTML = "Finished file";
|
||||
break;
|
||||
case "done":
|
||||
receiveBlock.innerHTML = "Stopped because " +msg.reason;
|
||||
setTimeout(function() {
|
||||
receiveBlock.style.display = "none";
|
||||
}, 1000);
|
||||
break;
|
||||
case "started_file":
|
||||
receiveBlock.innerHTML = "Beginning receive of " + msg.name;
|
||||
break;
|
||||
case "progress":
|
||||
receiveBlock.innerHTML = msg.name + " " + msg.received + "/" + msg.size;
|
||||
break;
|
||||
default:
|
||||
console.log("strange file receive cb message = ", JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function blobAcceptor(otherGuy, blob, filename) {
|
||||
easyrtc_ft.saveAs(blob, filename);
|
||||
}
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
easyrtc_ft.buildFileReceiver(acceptRejectCB, blobAcceptor, receiveStatusCB);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
172
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_data_channel_messaging.js
generated
vendored
@ -1,172 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var connectList = {};
|
||||
var channelIsActive = {}; // tracks which channels are active
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.enableDebug(false);
|
||||
easyrtc.enableDataChannels(true);
|
||||
easyrtc.enableVideo(false);
|
||||
easyrtc.enableAudio(false);
|
||||
easyrtc.enableVideoReceive(false);
|
||||
easyrtc.enableAudioReceive(false);
|
||||
easyrtc.setDataChannelOpenListener(openListener);
|
||||
easyrtc.setDataChannelCloseListener(closeListener);
|
||||
easyrtc.setPeerListener(addToConversation);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.dataMessaging", loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function addToConversation(who, msgType, content) {
|
||||
// Escape html special characters, then add linefeeds.
|
||||
content = content.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
document.getElementById('conversation').innerHTML +=
|
||||
"<b>" + who + ":</b> " + content + "<br />";
|
||||
}
|
||||
|
||||
|
||||
function openListener(otherParty) {
|
||||
channelIsActive[otherParty] = true;
|
||||
updateButtonState(otherParty);
|
||||
}
|
||||
|
||||
|
||||
function closeListener(otherParty) {
|
||||
channelIsActive[otherParty] = false;
|
||||
updateButtonState(otherParty);
|
||||
}
|
||||
|
||||
function convertListToButtons(roomName, occupantList, isPrimary) {
|
||||
connectList = occupantList;
|
||||
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
|
||||
var label, button;
|
||||
for (var easyrtcid in connectList) {
|
||||
var rowGroup = document.createElement("span");
|
||||
var rowLabel = document.createTextNode(easyrtc.idToName(easyrtcid));
|
||||
rowGroup.appendChild(rowLabel);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.id = "connect_" + easyrtcid;
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
startCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
label = document.createTextNode("Connect");
|
||||
button.appendChild(label);
|
||||
rowGroup.appendChild(button);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.id = "send_" + easyrtcid;
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
sendStuffP2P(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
label = document.createTextNode("Send Message");
|
||||
button.appendChild(label);
|
||||
rowGroup.appendChild(button);
|
||||
otherClientDiv.appendChild(rowGroup);
|
||||
updateButtonState(easyrtcid);
|
||||
}
|
||||
if (!otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.innerHTML = "<em>Nobody else logged in to talk to...</em>";
|
||||
}
|
||||
}
|
||||
|
||||
function updateButtonState(otherEasyrtcid) {
|
||||
var isConnected = channelIsActive[otherEasyrtcid];
|
||||
if(document.getElementById('connect_' + otherEasyrtcid)) {
|
||||
document.getElementById('connect_' + otherEasyrtcid).disabled = isConnected;
|
||||
}
|
||||
if( document.getElementById('send_' + otherEasyrtcid)) {
|
||||
document.getElementById('send_' + otherEasyrtcid).disabled = !isConnected;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function startCall(otherEasyrtcid) {
|
||||
if (easyrtc.getConnectStatus(otherEasyrtcid) === easyrtc.NOT_CONNECTED) {
|
||||
try {
|
||||
easyrtc.call(otherEasyrtcid,
|
||||
function(caller, media) { // success callback
|
||||
if (media === 'datachannel') {
|
||||
// console.log("made call succesfully");
|
||||
connectList[otherEasyrtcid] = true;
|
||||
}
|
||||
},
|
||||
function(errorCode, errorText) {
|
||||
connectList[otherEasyrtcid] = false;
|
||||
easyrtc.showError(errorCode, errorText);
|
||||
},
|
||||
function(wasAccepted) {
|
||||
// console.log("was accepted=" + wasAccepted);
|
||||
}
|
||||
);
|
||||
}catch( callerror) {
|
||||
console.log("saw call error ", callerror);
|
||||
}
|
||||
}
|
||||
else {
|
||||
easyrtc.showError("ALREADY-CONNECTED", "already connected to " + easyrtc.idToName(otherEasyrtcid));
|
||||
}
|
||||
}
|
||||
|
||||
function sendStuffP2P(otherEasyrtcid) {
|
||||
var text = document.getElementById('sendMessageText').value;
|
||||
if (text.replace(/\s/g, "").length === 0) { // Don't send just whitespace
|
||||
return;
|
||||
}
|
||||
if (easyrtc.getConnectStatus(otherEasyrtcid) === easyrtc.IS_CONNECTED) {
|
||||
easyrtc.sendDataP2P(otherEasyrtcid, 'msg', text);
|
||||
}
|
||||
else {
|
||||
easyrtc.showError("NOT-CONNECTED", "not connected to " + easyrtc.idToName(otherEasyrtcid) + " yet.");
|
||||
}
|
||||
|
||||
addToConversation("Me", "msgtype", text);
|
||||
document.getElementById('sendMessageText').value = "";
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, "failure to login");
|
||||
}
|
84
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_ice_filter.js
generated
vendored
@ -1,84 +0,0 @@
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.easyApp("easyrtc.iceFilter", "selfVideo", ["callerVideo"], loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, data, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in data) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode(easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
easyrtc.setIceUsedInCalls( getModifiedIceList());
|
||||
var successCB = function() {};
|
||||
var failureCB = function() {};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var iceMap = [];
|
||||
|
||||
function getModifiedIceList(){
|
||||
var iceList = [];
|
||||
var i;
|
||||
|
||||
for( i = 0; i < iceMap.length; i++ ) {
|
||||
if( document.getElementById("iscb" + i).checked ) {
|
||||
iceList.push( iceMap[i]);
|
||||
}
|
||||
}
|
||||
return {iceServers: iceList};
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
var i;
|
||||
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
var blockentries = "<h3>Ice Entries</h3>";
|
||||
var iceServers = easyrtc.getServerIce();
|
||||
for(i = 0; i < iceServers.iceServers.length; i++ ) {
|
||||
iceMap[i] = iceServers.iceServers[i];
|
||||
var label = "iscb" + i;
|
||||
blockentries += '<div style="width:100%;overflow:hidden;text-align:left"><input type="checkbox" id="' + label + '" + checked="checked" style="float:left>' +
|
||||
'<label for="' + label + '" style="float:left">' + iceServers.iceServers[i].url + '></div>';
|
||||
|
||||
}
|
||||
document.getElementById("iceEntries").innerHTML = blockentries;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
87
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_instant_messaging.js
generated
vendored
@ -1,87 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
function addToConversation(who, msgType, content) {
|
||||
// Escape html special characters, then add linefeeds.
|
||||
content = content.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
document.getElementById('conversation').innerHTML +=
|
||||
"<b>" + who + ":</b> " + content + "<br />";
|
||||
}
|
||||
|
||||
|
||||
function connect() {
|
||||
easyrtc.setPeerListener(addToConversation);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.instantMessaging", loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, occupants, isPrimary) {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
|
||||
for(var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
sendStuffWS(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
var label = document.createTextNode("Send to " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
if( !otherClientDiv.hasChildNodes() ) {
|
||||
otherClientDiv.innerHTML = "<em>Nobody else logged in to talk to...</em>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendStuffWS(otherEasyrtcid) {
|
||||
var text = document.getElementById('sendMessageText').value;
|
||||
if(text.replace(/\s/g, "").length === 0) { // Don't send just whitespace
|
||||
return;
|
||||
}
|
||||
|
||||
easyrtc.sendDataWS(otherEasyrtcid, "message", text);
|
||||
addToConversation("Me", "message", text);
|
||||
document.getElementById('sendMessageText').value = "";
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
418
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_instant_messaging_rooms.js
generated
vendored
@ -1,418 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var waitingForRoomList = true;
|
||||
var isConnected = false;
|
||||
|
||||
function initApp() {
|
||||
document.getElementById("main").className = "notconnected";
|
||||
}
|
||||
|
||||
function addToConversation(who, msgType, content, targeting) {
|
||||
// Escape html special characters, then add linefeeds.
|
||||
if( !content) {
|
||||
content = "**no body**";
|
||||
}
|
||||
content = content.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
var targetingStr = "";
|
||||
if (targeting) {
|
||||
if (targeting.targetEasyrtcid) {
|
||||
targetingStr += "user=" + targeting.targetEasyrtcid;
|
||||
}
|
||||
if (targeting.targetRoom) {
|
||||
targetingStr += " room=" + targeting.targetRoom;
|
||||
}
|
||||
if (targeting.targetGroup) {
|
||||
targetingStr += " group=" + targeting.targetGroup;
|
||||
}
|
||||
}
|
||||
document.getElementById('conversation').innerHTML +=
|
||||
"<b>" + who + " sent " + targetingStr + ":</b> " + content + "<br />";
|
||||
}
|
||||
|
||||
function genRoomDivName(roomName) {
|
||||
return "roomblock_" + roomName;
|
||||
}
|
||||
|
||||
function genRoomOccupantName(roomName) {
|
||||
return "roomOccupant_" + roomName;
|
||||
}
|
||||
|
||||
function setCredential(event, value) {
|
||||
if (event.keyCode === 13) {
|
||||
easyrtc.setCredential(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addRoom(roomName, parmString, userAdded) {
|
||||
if (!roomName) {
|
||||
roomName = document.getElementById("roomToAdd").value;
|
||||
parmString = document.getElementById("optRoomParms").value;
|
||||
}
|
||||
var roomid = genRoomDivName(roomName);
|
||||
if (document.getElementById(roomid)) {
|
||||
return;
|
||||
}
|
||||
function addRoomButton() {
|
||||
|
||||
var roomButtonHolder = document.getElementById('rooms');
|
||||
var roomdiv = document.createElement("div");
|
||||
roomdiv.id = roomid;
|
||||
roomdiv.className = "roomDiv";
|
||||
|
||||
var roomButton = document.createElement("button");
|
||||
roomButton.onclick = function() {
|
||||
sendMessage(null, roomName);
|
||||
};
|
||||
var roomLabel = (document.createTextNode(roomName));
|
||||
roomButton.appendChild(roomLabel);
|
||||
|
||||
roomdiv.appendChild(roomButton);
|
||||
roomButtonHolder.appendChild(roomdiv);
|
||||
var roomOccupants = document.createElement("div");
|
||||
roomOccupants.id = genRoomOccupantName(roomName);
|
||||
roomOccupants.className = "roomOccupants";
|
||||
roomdiv.appendChild(roomOccupants);
|
||||
$(roomdiv).append(" -<a href=\"javascript:\leaveRoom('" + roomName + "')\">leave</a>");
|
||||
}
|
||||
|
||||
var roomParms = null;
|
||||
if (parmString && parmString !== "") {
|
||||
try {
|
||||
roomParms = JSON.parse(parmString);
|
||||
} catch (error) {
|
||||
roomParms = null;
|
||||
easyrtc.showError(easyrtc.errCodes.DEVELOPER_ERR, "Room Parameters must be an object containing key/value pairs. eg: {\"fruit\":\"banana\",\"color\":\"yellow\"}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!isConnected || !userAdded) {
|
||||
addRoomButton();
|
||||
console.log("adding gui for room " + roomName);
|
||||
}
|
||||
else {
|
||||
console.log("not adding gui for room " + roomName + " because already connected and it's a user action");
|
||||
}
|
||||
if (userAdded) {
|
||||
console.log("calling joinRoom(" + roomName + ") because it was a user action ");
|
||||
|
||||
easyrtc.joinRoom(roomName, roomParms,
|
||||
function() {
|
||||
/* we'll geta room entry event for the room we were actually added to */
|
||||
},
|
||||
function(errorCode, errorText, roomName) {
|
||||
easyrtc.showError(errorCode, errorText + ": room name was(" + roomName + ")");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function leaveRoom(roomName) {
|
||||
if (!roomName) {
|
||||
roomName = document.getElementById("roomToAdd").value;
|
||||
}
|
||||
var entry = document.getElementById(genRoomDivName(roomName));
|
||||
var roomButtonHolder = document.getElementById('rooms');
|
||||
easyrtc.leaveRoom(roomName, null);
|
||||
roomButtonHolder.removeChild(entry);
|
||||
}
|
||||
|
||||
|
||||
function roomEntryListener(entered, roomName) {
|
||||
if (entered) { // entered a room
|
||||
console.log("saw add of room " + roomName);
|
||||
addRoom(roomName, null, false);
|
||||
}
|
||||
else {
|
||||
var roomNode = document.getElementById(genRoomDivName(roomName));
|
||||
if (roomNode) {
|
||||
document.getElementById('#rooms').removeChildNode(roomNode);
|
||||
}
|
||||
}
|
||||
refreshRoomList();
|
||||
}
|
||||
|
||||
|
||||
function refreshRoomList() {
|
||||
if( isConnected) {
|
||||
easyrtc.getRoomList(addQuickJoinButtons, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function peerListener(who, msgType, content, targeting) {
|
||||
addToConversation(who, msgType, content, targeting);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
easyrtc.setPeerListener(peerListener);
|
||||
easyrtc.setRoomOccupantListener(occupantListener);
|
||||
easyrtc.setRoomEntryListener(roomEntryListener);
|
||||
easyrtc.setDisconnectListener(function() {
|
||||
jQuery('#rooms').empty();
|
||||
document.getElementById("main").className = "notconnected";
|
||||
console.log("disconnect listener fired");
|
||||
});
|
||||
updatePresence();
|
||||
var username = document.getElementById("userNameField").value;
|
||||
var password = document.getElementById("credentialField").value;
|
||||
if (username) {
|
||||
easyrtc.setUsername(username);
|
||||
}
|
||||
if (password) {
|
||||
easyrtc.setCredential({password: password});
|
||||
}
|
||||
easyrtc.connect("easyrtc.instantMessaging", loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
easyrtc.disconnect();
|
||||
}
|
||||
|
||||
function addQuickJoinButtons(roomList) {
|
||||
var quickJoinBlock = document.getElementById("quickJoinBlock");
|
||||
var n = quickJoinBlock.childNodes.length;
|
||||
for (var i = n - 1; i >= 0; i--) {
|
||||
quickJoinBlock.removeChild(quickJoinBlock.childNodes[i]);
|
||||
}
|
||||
function addQuickJoinButton(roomname, numberClients) {
|
||||
var checkid = "roomblock_" + roomname;
|
||||
if (document.getElementById(checkid)) {
|
||||
return; // already present so don't add again
|
||||
}
|
||||
var id = "quickjoin_" + roomname;
|
||||
var div = document.createElement("div");
|
||||
div.id = id;
|
||||
div.className = "quickJoin";
|
||||
var parmsField = document.getElementById("optRoomParms");
|
||||
var button = document.createElement("button");
|
||||
button.onclick = function() {
|
||||
addRoom(roomname, parmsField.value, true);
|
||||
refreshRoomList();
|
||||
};
|
||||
button.appendChild(document.createTextNode("Join " + roomname + "(" + numberClients + ")"));
|
||||
div.appendChild(button);
|
||||
quickJoinBlock.appendChild(div);
|
||||
|
||||
}
|
||||
if( !roomList["room1"]) {
|
||||
roomList["room1"] = { numberClients:0};
|
||||
}
|
||||
if( !roomList["room2"]) {
|
||||
roomList["room2"] = { numberClients:0};
|
||||
}
|
||||
if( !roomList["room3"]) {
|
||||
roomList["room3"] = { numberClients:0};
|
||||
}
|
||||
for (var roomName in roomList) {
|
||||
addQuickJoinButton(roomName, roomList[roomName].numberClients);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function occupantListener(roomName, occupants, isPrimary) {
|
||||
if (roomName === null) {
|
||||
return;
|
||||
}
|
||||
var roomId = genRoomOccupantName(roomName);
|
||||
var roomDiv = document.getElementById(roomId);
|
||||
if (!roomDiv) {
|
||||
addRoom(roomName, "", false);
|
||||
roomDiv = document.getElementById(roomId);
|
||||
}
|
||||
else {
|
||||
jQuery(roomDiv).empty();
|
||||
}
|
||||
for (var easyrtcid in occupants) {
|
||||
var button = document.createElement("button");
|
||||
button.onclick = (function(roomname, easyrtcid) {
|
||||
return function() {
|
||||
sendMessage(easyrtcid, roomName);
|
||||
};
|
||||
})(roomName, easyrtcid);
|
||||
var presenceText = "";
|
||||
if (occupants[easyrtcid].presence) {
|
||||
presenceText += "(";
|
||||
if (occupants[easyrtcid].presence.show) {
|
||||
presenceText += "show=" + occupants[easyrtcid].presence.show + " ";
|
||||
}
|
||||
if (occupants[easyrtcid].presence.status) {
|
||||
presenceText += "status=" + occupants[easyrtcid].presence.status;
|
||||
}
|
||||
presenceText += ")";
|
||||
}
|
||||
var label = document.createTextNode(easyrtc.idToName(easyrtcid) + presenceText);
|
||||
button.appendChild(label);
|
||||
roomDiv.appendChild(button);
|
||||
}
|
||||
refreshRoomList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getGroupId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function sendMessage(destTargetId, destRoom) {
|
||||
var text = document.getElementById('sendMessageText').value;
|
||||
if (text.replace(/\s/g, "").length === 0) { // Don't send just whitespace
|
||||
return;
|
||||
}
|
||||
var dest;
|
||||
var destGroup = getGroupId();
|
||||
if (destRoom || destGroup) {
|
||||
dest = {};
|
||||
if (destRoom) {
|
||||
dest.targetRoom = destRoom;
|
||||
}
|
||||
if (destGroup) {
|
||||
dest.targetGroup = destGroup;
|
||||
}
|
||||
if (destTargetId) {
|
||||
dest.targetEasyrtcid = destTargetId;
|
||||
}
|
||||
}
|
||||
else if (destTargetId) {
|
||||
dest = destTargetId;
|
||||
}
|
||||
else {
|
||||
easyrtc.showError("user error", "no destination selected");
|
||||
return;
|
||||
}
|
||||
|
||||
if( text === "empty") {
|
||||
easyrtc.sendPeerMessage(dest, "message");
|
||||
}
|
||||
else {
|
||||
easyrtc.sendDataWS(dest, "message", text, function(reply) {
|
||||
if (reply.msgType === "error") {
|
||||
easyrtc.showError(reply.msgData.errorCode, reply.msgData.errorText);
|
||||
}
|
||||
});
|
||||
}
|
||||
addToConversation("Me", "message", text);
|
||||
document.getElementById('sendMessageText').value = "";
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
refreshRoomList();
|
||||
isConnected = true;
|
||||
displayFields();
|
||||
document.getElementById("main").className = "connected";
|
||||
}
|
||||
|
||||
|
||||
function displayFields() {
|
||||
|
||||
var outstr = "Application fields<div style='margin-left:1em'>";
|
||||
outstr += JSON.stringify(easyrtc.getApplicationFields());
|
||||
outstr += "</div><br>";
|
||||
|
||||
outstr += "Session fields<div style='margin-left:1em'>";
|
||||
outstr += JSON.stringify(easyrtc.getSessionFields());
|
||||
outstr += "</div><br>";
|
||||
|
||||
outstr += "Connection fields<div style='margin-left:1em'>";
|
||||
outstr += JSON.stringify(easyrtc.getConnectionFields());
|
||||
outstr += "</div><br>";
|
||||
|
||||
var roomlist = easyrtc.getRoomsJoined();
|
||||
for (var roomname in roomlist) {
|
||||
var roomfields = easyrtc.getRoomFields(roomname);
|
||||
if (roomfields != null) {
|
||||
outstr += "Room " + roomname + " fields<div style='margin-left:1em'>";
|
||||
outstr += JSON.stringify(roomfields);
|
||||
outstr += "</div><br>";
|
||||
}
|
||||
}
|
||||
document.getElementById('fields').innerHTML = outstr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError("LOGIN-FAILURE", message);
|
||||
document.getElementById('connectButton').disabled = false;
|
||||
jQuery('#rooms').empty();
|
||||
}
|
||||
|
||||
var currentShowState = 'chat';
|
||||
var currentShowText = '';
|
||||
|
||||
function setPresence(value) {
|
||||
currentShowState = value;
|
||||
updatePresence();
|
||||
}
|
||||
|
||||
function updatePresenceStatus(value) {
|
||||
currentShowText = value;
|
||||
updatePresence();
|
||||
}
|
||||
|
||||
function updatePresence()
|
||||
{
|
||||
easyrtc.updatePresence(currentShowState, currentShowText);
|
||||
}
|
||||
|
||||
function queryRoomNames() {
|
||||
var roomName = document.getElementById("queryRoom").value;
|
||||
if( !roomName ) {
|
||||
roomName = "default";
|
||||
}
|
||||
if( roomName ) {
|
||||
console.log("getRoomOccupantsAsArray("+ roomName + ")=" + JSON.stringify(easyrtc.getRoomOccupantsAsArray(roomName)));
|
||||
console.log("getRoomOccupantsAsMap(" + roomName + ")=" + JSON.stringify(easyrtc.getRoomOccupantsAsMap(roomName)));
|
||||
}
|
||||
}
|
||||
function addApiField() {
|
||||
var roomName = document.getElementById("apiroomname").value;
|
||||
var fieldname = document.getElementById("apifieldname").value;
|
||||
var fieldvaluetext = document.getElementById("apifieldvalue").value;
|
||||
var fieldvalue;
|
||||
if(fieldvaluetext.indexOf("{") >= 0) {
|
||||
fieldvalue = JSON.parse(fieldvaluetext);
|
||||
}
|
||||
else {
|
||||
fieldvalue = fieldvaluetext;
|
||||
}
|
||||
easyrtc.setRoomApiField(roomName, fieldname, fieldvalue);
|
||||
}
|
||||
|
||||
|
||||
function getIdsOfName() {
|
||||
var name = document.getElementById("targetName").value;
|
||||
var ids = easyrtc.usernameToIds(name);
|
||||
document.getElementById("foundIds").innerHTML = JSON.stringify(ids);
|
||||
}
|
111
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_instant_messaging_selfconnect.js
generated
vendored
@ -1,111 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
function addToConversation(who, msgType, content) {
|
||||
// Escape html special characters, then add linefeeds.
|
||||
content = content.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
document.getElementById('conversation').innerHTML +=
|
||||
"<b>" + who + ":</b> " + content + "<br />";
|
||||
}
|
||||
|
||||
|
||||
|
||||
function connect(immediateMode) {
|
||||
easyrtc.setPeerListener(addToConversation);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
|
||||
var mysocket = io.connect(null, {
|
||||
'connect timeout': 10000,
|
||||
'force new connection': true
|
||||
});
|
||||
|
||||
|
||||
if (!mysocket) {
|
||||
throw "io.connect failed";
|
||||
}
|
||||
else {
|
||||
console.log("application allocated socket ", mysocket);
|
||||
easyrtc.useThisSocketConnection(mysocket);
|
||||
}
|
||||
if( immediateMode) {
|
||||
easyrtc.connect("easyrtc.reconnect", loginSuccess, loginFailure);
|
||||
}
|
||||
else {
|
||||
setTimeout(function() {
|
||||
easyrtc.connect("easyrtc.reconnect", loginSuccess, loginFailure);
|
||||
}, 10*1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, occupants, isPrimary) {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
|
||||
for(var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
sendStuffWS(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
var label = document.createTextNode("Send to " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
if( !otherClientDiv.hasChildNodes() ) {
|
||||
otherClientDiv.innerHTML = "<em>Nobody else logged in to talk to...</em>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendStuffWS(otherEasyrtcid) {
|
||||
var text = document.getElementById('sendMessageText').value;
|
||||
if(text.replace(/\s/g, "").length === 0) { // Don't send just whitespace
|
||||
return;
|
||||
}
|
||||
|
||||
easyrtc.sendDataWS(otherEasyrtcid, "message", text);
|
||||
addToConversation("Me", "message", text);
|
||||
document.getElementById('sendMessageText').value = "";
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtcid;
|
||||
document.getElementById("buttonImmediate").enabled = false;
|
||||
document.getElementById("buttonDelayed").enabled = false;
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
61
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_lowbandwidth.js
generated
vendored
@ -1,61 +0,0 @@
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function connect() {
|
||||
|
||||
var localFilter = easyrtc.buildLocalSdpFilter( {
|
||||
audioRecvBitrate:20, videoRecvBitrate:30
|
||||
});
|
||||
var remoteFilter = easyrtc.buildRemoteSdpFilter({
|
||||
audioSendBitrate: 20, videoSendBitrate:30
|
||||
});
|
||||
easyrtc.setSdpFilters(localFilter, remoteFilter);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.easyApp("easyrtc.lowbandwidth", "selfVideo", ["callerVideo"], loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons (roomName, data, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for(var easyrtcid in data) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode(easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
|
||||
var successCB = function() {};
|
||||
var failureCB = function() {};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB);
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
727
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_multiparty.js
generated
vendored
@ -1,727 +0,0 @@
|
||||
|
||||
|
||||
var activeBox = -1; // nothing selected
|
||||
var aspectRatio = 4/3; // standard definition video aspect ratio
|
||||
var maxCALLERS = 3;
|
||||
var numVideoOBJS = maxCALLERS+1;
|
||||
var layout;
|
||||
|
||||
|
||||
easyrtc.dontAddCloseButtons(true);
|
||||
|
||||
function getIdOfBox(boxNum) {
|
||||
return "box" + boxNum;
|
||||
}
|
||||
|
||||
|
||||
function reshapeFull(parentw, parenth) {
|
||||
return {
|
||||
left:0,
|
||||
top:0,
|
||||
width:parentw,
|
||||
height:parenth
|
||||
};
|
||||
}
|
||||
|
||||
function reshapeTextEntryBox(parentw, parenth) {
|
||||
return {
|
||||
left:parentw/4,
|
||||
top:parenth/4,
|
||||
width:parentw/2,
|
||||
height: parenth/4
|
||||
}
|
||||
}
|
||||
|
||||
function reshapeTextEntryField(parentw, parenth) {
|
||||
return {
|
||||
width:parentw -40
|
||||
}
|
||||
}
|
||||
|
||||
var margin = 20;
|
||||
|
||||
function reshapeToFullSize(parentw, parenth) {
|
||||
var left, top, width, height;
|
||||
var margin= 20;
|
||||
|
||||
if( parentw < parenth*aspectRatio){
|
||||
width = parentw -margin;
|
||||
height = width/aspectRatio;
|
||||
}
|
||||
else {
|
||||
height = parenth-margin;
|
||||
width = height*aspectRatio;
|
||||
}
|
||||
left = (parentw - width)/2;
|
||||
top = (parenth - height)/2;
|
||||
return {
|
||||
left:left,
|
||||
top:top,
|
||||
width:width,
|
||||
height:height
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// a negative percentLeft is interpreted as setting the right edge of the object
|
||||
// that distance from the right edge of the parent.
|
||||
// Similar for percentTop.
|
||||
//
|
||||
function setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspect) {
|
||||
|
||||
var width, height;
|
||||
if( parentw < parenth*aspectRatio){
|
||||
width = parentw * percentSize;
|
||||
height = width/aspect;
|
||||
}
|
||||
else {
|
||||
height = parenth * percentSize;
|
||||
width = height*aspect;
|
||||
}
|
||||
var left;
|
||||
if( percentLeft < 0) {
|
||||
left = parentw - width;
|
||||
}
|
||||
else {
|
||||
left = 0;
|
||||
}
|
||||
left += Math.floor(percentLeft*parentw);
|
||||
var top = 0;
|
||||
if( percentTop < 0) {
|
||||
top = parenth - height;
|
||||
}
|
||||
else {
|
||||
top = 0;
|
||||
}
|
||||
top += Math.floor(percentTop*parenth);
|
||||
return {
|
||||
left:left,
|
||||
top:top,
|
||||
width:width,
|
||||
height:height
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function setThumbSize(percentSize, percentLeft, percentTop, parentw, parenth) {
|
||||
return setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspectRatio);
|
||||
}
|
||||
|
||||
function setThumbSizeButton(percentSize, percentLeft, percentTop, parentw, parenth, imagew, imageh) {
|
||||
return setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, imagew/imageh);
|
||||
}
|
||||
|
||||
|
||||
var sharedVideoWidth = 1;
|
||||
var sharedVideoHeight = 1;
|
||||
|
||||
function reshape1of2(parentw, parenth) {
|
||||
if( layout== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3,
|
||||
top: (parenth -sharedVideoHeight)/2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function reshape2of2(parentw, parenth){
|
||||
if( layout== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3 *2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3 *2 + sharedVideoWidth,
|
||||
top: (parenth -sharedVideoHeight)/2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reshape1of3(parentw, parenth) {
|
||||
if( layout== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4 ,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reshape2of3(parentw, parenth){
|
||||
if( layout== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4*2+ sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3*2+sharedVideoWidth,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reshape3of3(parentw, parenth) {
|
||||
if( layout== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4*3+ sharedVideoHeight*2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3*1.5+sharedVideoWidth/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3*2+ sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reshape1of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3,
|
||||
top: (parenth - sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
|
||||
function reshape2of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3*2+ sharedVideoWidth,
|
||||
top: (parenth - sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
function reshape3of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3,
|
||||
top: (parenth - sharedVideoHeight*2)/3*2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
|
||||
function reshape4of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3*2 + sharedVideoWidth,
|
||||
top: (parenth - sharedVideoHeight*2)/3*2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
}
|
||||
}
|
||||
|
||||
var boxUsed = [true, false, false, false];
|
||||
var connectCount = 0;
|
||||
|
||||
|
||||
function setSharedVideoSize(parentw, parenth) {
|
||||
layout = ((parentw /aspectRatio) < parenth)?'p':'l';
|
||||
var w, h;
|
||||
|
||||
function sizeBy(fullsize, numVideos) {
|
||||
return (fullsize - margin*(numVideos+1) )/numVideos;
|
||||
}
|
||||
|
||||
switch(layout+(connectCount+1)) {
|
||||
case 'p1':
|
||||
case 'l1':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 1);
|
||||
break;
|
||||
case 'l2':
|
||||
w = sizeBy(parentw, 2);
|
||||
h = sizeBy(parenth, 1);
|
||||
break;
|
||||
case 'p2':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 2);
|
||||
break;
|
||||
case 'p4':
|
||||
case 'l4':
|
||||
case 'l3':
|
||||
w = sizeBy(parentw, 2);
|
||||
h = sizeBy(parenth, 2);
|
||||
break;
|
||||
case 'p3':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 3);
|
||||
break;
|
||||
}
|
||||
sharedVideoWidth = Math.min(w, h * aspectRatio);
|
||||
sharedVideoHeight = Math.min(h, w/aspectRatio);
|
||||
}
|
||||
|
||||
var reshapeThumbs = [
|
||||
function(parentw, parenth) {
|
||||
|
||||
if( activeBox > 0 ) {
|
||||
return setThumbSize(0.20, 0.01, 0.01, parentw, parenth);
|
||||
}
|
||||
else {
|
||||
setSharedVideoSize(parentw, parenth)
|
||||
switch(connectCount) {
|
||||
case 0:return reshapeToFullSize(parentw, parenth);
|
||||
case 1:return reshape1of2(parentw, parenth);
|
||||
case 2:return reshape1of3(parentw, parenth);
|
||||
case 3:return reshape1of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[1]) {
|
||||
return setThumbSize(0.20, 0.01, -0.01, parentw, parenth);
|
||||
}
|
||||
else{
|
||||
switch(connectCount) {
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
return reshape2of3(parentw, parenth);
|
||||
case 3:
|
||||
return reshape2of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[2] ) {
|
||||
return setThumbSize(0.20, -0.01, 0.01, parentw, parenth);
|
||||
}
|
||||
else {
|
||||
switch(connectCount){
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
if( !boxUsed[1]) {
|
||||
return reshape2of3(parentw, parenth);
|
||||
}
|
||||
else {
|
||||
return reshape3of3(parentw, parenth);
|
||||
}
|
||||
case 3:
|
||||
return reshape3of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[3]) {
|
||||
return setThumbSize(0.20, -0.01, -0.01, parentw, parenth);
|
||||
}
|
||||
else{
|
||||
switch(connectCount){
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
return reshape3of3(parentw, parenth);
|
||||
case 3:
|
||||
return reshape4of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
function killButtonReshaper(parentw, parenth) {
|
||||
var imagew = 128;
|
||||
var imageh = 128;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.1, -.51, -0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.1, -.01, -.51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function muteButtonReshaper(parentw, parenth) {
|
||||
var imagew = 32;
|
||||
var imageh = 32;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.10, -.51, 0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.10, 0.01, -.51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
function reshapeTextEntryButton(parentw, parenth) {
|
||||
var imagew = 32;
|
||||
var imageh = 32;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.10, .51, 0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.10, 0.01, .51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleWindowResize() {
|
||||
var fullpage = document.getElementById('fullpage');
|
||||
fullpage.style.width = window.innerWidth + "px";
|
||||
fullpage.style.height = window.innerHeight + "px";
|
||||
connectCount = easyrtc.getConnectionCount();
|
||||
|
||||
function applyReshape(obj, parentw, parenth) {
|
||||
var myReshape = obj.reshapeMe(parentw, parenth);
|
||||
|
||||
if(typeof myReshape.left !== 'undefined' ) {
|
||||
obj.style.left = Math.round(myReshape.left) + "px";
|
||||
}
|
||||
if(typeof myReshape.top !== 'undefined' ) {
|
||||
obj.style.top = Math.round(myReshape.top) + "px";
|
||||
}
|
||||
if(typeof myReshape.width !== 'undefined' ) {
|
||||
obj.style.width = Math.round(myReshape.width) + "px";
|
||||
}
|
||||
if(typeof myReshape.height !== 'undefined' ) {
|
||||
obj.style.height = Math.round(myReshape.height) + "px";
|
||||
}
|
||||
|
||||
var n = obj.childNodes.length;
|
||||
for(var i = 0; i < n; i++ ) {
|
||||
var childNode = obj.childNodes[i];
|
||||
if( childNode.reshapeMe) {
|
||||
applyReshape(childNode, myReshape.width, myReshape.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyReshape(fullpage, window.innerWidth, window.innerHeight);
|
||||
}
|
||||
|
||||
|
||||
function setReshaper(elementId, reshapeFn) {
|
||||
var element = document.getElementById(elementId);
|
||||
if( !element) {
|
||||
alert("Attempt to apply to reshapeFn to non-existent element " + elementId);
|
||||
}
|
||||
if( !reshapeFn) {
|
||||
alert("Attempt to apply misnamed reshapeFn to element " + elementId);
|
||||
}
|
||||
element.reshapeMe = reshapeFn;
|
||||
}
|
||||
|
||||
|
||||
function collapseToThumbHelper() {
|
||||
if( activeBox >= 0) {
|
||||
var id = getIdOfBox(activeBox);
|
||||
document.getElementById(id).style.zIndex = 2;
|
||||
setReshaper(id, reshapeThumbs[activeBox]);
|
||||
document.getElementById('muteButton').style.display = "none";
|
||||
document.getElementById('killButton').style.display = "none";
|
||||
activeBox = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function collapseToThumb() {
|
||||
collapseToThumbHelper();
|
||||
activeBox = -1;
|
||||
updateMuteImage(false);
|
||||
handleWindowResize();
|
||||
|
||||
}
|
||||
|
||||
function updateMuteImage(toggle) {
|
||||
var muteButton = document.getElementById('muteButton');
|
||||
if( activeBox > 0) { // no kill button for self video
|
||||
muteButton.style.display = "block";
|
||||
var videoObject = document.getElementById( getIdOfBox(activeBox));
|
||||
var isMuted = videoObject.muted?true:false;
|
||||
if( toggle) {
|
||||
isMuted = !isMuted;
|
||||
videoObject.muted = isMuted;
|
||||
}
|
||||
muteButton.src = isMuted?"images/button_unmute.png":"images/button_mute.png";
|
||||
}
|
||||
else {
|
||||
muteButton.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function expandThumb(whichBox) {
|
||||
var lastActiveBox = activeBox;
|
||||
if( activeBox >= 0 ) {
|
||||
collapseToThumbHelper();
|
||||
}
|
||||
if( lastActiveBox != whichBox) {
|
||||
var id = getIdOfBox(whichBox);
|
||||
activeBox = whichBox;
|
||||
setReshaper(id, reshapeToFullSize);
|
||||
document.getElementById(id).style.zIndex = 1;
|
||||
if( whichBox > 0) {
|
||||
document.getElementById('muteButton').style.display = "block";
|
||||
updateMuteImage();
|
||||
document.getElementById('killButton').style.display = "block";
|
||||
}
|
||||
}
|
||||
updateMuteImage(false);
|
||||
handleWindowResize();
|
||||
}
|
||||
|
||||
function prepVideoBox(whichBox) {
|
||||
var id = getIdOfBox(whichBox);
|
||||
setReshaper(id, reshapeThumbs[whichBox]);
|
||||
document.getElementById(id).onclick = function() {
|
||||
expandThumb(whichBox);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function killActiveBox() {
|
||||
if( activeBox > 0) {
|
||||
var easyrtcid = easyrtc.getIthCaller(activeBox-1);
|
||||
collapseToThumb();
|
||||
setTimeout( function() {
|
||||
easyrtc.hangup(easyrtcid);
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function muteActiveBox() {
|
||||
updateMuteImage(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function callEverybodyElse(roomName, otherPeople) {
|
||||
|
||||
easyrtc.setRoomOccupantListener(null); // so we're only called once.
|
||||
|
||||
var list = [];
|
||||
var connectCount = 0;
|
||||
for(var easyrtcid in otherPeople ) {
|
||||
list.push(easyrtcid);
|
||||
}
|
||||
//
|
||||
// Connect in reverse order. Latter arriving people are more likely to have
|
||||
// empty slots.
|
||||
//
|
||||
function establishConnection(position) {
|
||||
function callSuccess() {
|
||||
connectCount++;
|
||||
if( connectCount < maxCALLERS && position > 0) {
|
||||
establishConnection(position-1);
|
||||
}
|
||||
}
|
||||
function callFailure(errorCode, errorText) {
|
||||
easyrtc.showError(errorCode, errorText);
|
||||
if( connectCount < maxCALLERS && position > 0) {
|
||||
establishConnection(position-1);
|
||||
}
|
||||
}
|
||||
easyrtc.call(list[position], callSuccess, callFailure);
|
||||
|
||||
}
|
||||
if( list.length > 0) {
|
||||
establishConnection(list.length-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess() {
|
||||
expandThumb(0); // expand the mirror image initially.
|
||||
}
|
||||
|
||||
|
||||
function cancelText() {
|
||||
document.getElementById('textentryBox').style.display = "none";
|
||||
document.getElementById('textEntryButton').style.display = "block";
|
||||
}
|
||||
|
||||
|
||||
function sendText(e) {
|
||||
document.getElementById('textentryBox').style.display = "none";
|
||||
document.getElementById('textEntryButton').style.display = "block";
|
||||
var stringToSend = document.getElementById('textentryField').value;
|
||||
if( stringToSend && stringToSend != "") {
|
||||
for(var i = 0; i < maxCALLERS; i++ ) {
|
||||
var easyrtcid = easyrtc.getIthCaller(i);
|
||||
if( easyrtcid && easyrtcid != "") {
|
||||
easyrtc.sendPeerMessage(easyrtcid, "im", stringToSend);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function showTextEntry() {
|
||||
document.getElementById('textentryField').value = "";
|
||||
document.getElementById('textentryBox').style.display = "block";
|
||||
document.getElementById('textEntryButton').style.display = "none";
|
||||
document.getElementById('textentryField').focus();
|
||||
}
|
||||
|
||||
|
||||
function showMessage(startX, startY, content) {
|
||||
var fullPage = document.getElementById('fullpage');
|
||||
var fullW = parseInt(fullPage.offsetWidth);
|
||||
var fullH = parseInt(fullPage.offsetHeight);
|
||||
var centerEndX = .2*startX + .8*fullW/2;
|
||||
var centerEndY = .2*startY + .8*fullH/2;
|
||||
|
||||
|
||||
var cloudObject = document.createElement("img");
|
||||
cloudObject.src = "images/cloud.png";
|
||||
cloudObject.style.width = "1px";
|
||||
cloudObject.style.height = "1px";
|
||||
cloudObject.style.left = startX + "px";
|
||||
cloudObject.style.top = startY + "px";
|
||||
fullPage.appendChild(cloudObject);
|
||||
|
||||
cloudObject.onload = function() {
|
||||
cloudObject.style.left = startX + "px";
|
||||
cloudObject.style.top = startY + "px";
|
||||
cloudObject.style.width = "4px";
|
||||
cloudObject.style.height = "4px";
|
||||
cloudObject.style.opacity = 0.7;
|
||||
cloudObject.style.zIndex = 5;
|
||||
cloudObject.className = "transit boxCommon";
|
||||
var textObject;
|
||||
function removeCloud() {
|
||||
if( textObject) {
|
||||
fullPage.removeChild(textObject);
|
||||
fullPage.removeChild(cloudObject);
|
||||
}
|
||||
}
|
||||
setTimeout(function() {
|
||||
cloudObject.style.left = centerEndX - fullW/4 + "px";
|
||||
cloudObject.style.top = centerEndY - fullH/4+ "px";
|
||||
cloudObject.style.width = (fullW/2) + "px";
|
||||
cloudObject.style.height = (fullH/2) + "px";
|
||||
}, 10);
|
||||
setTimeout(function() {
|
||||
textObject = document.createElement('div');
|
||||
textObject.className = "boxCommon";
|
||||
textObject.style.left = Math.floor(centerEndX-fullW/8) + "px";
|
||||
textObject.style.top = Math.floor(centerEndY) + "px";
|
||||
textObject.style.fontSize = "36pt";
|
||||
textObject.style.width = (fullW*.4) + "px";
|
||||
textObject.style.height = (fullH*.4) + "px";
|
||||
textObject.style.zIndex = 6;
|
||||
textObject.appendChild( document.createTextNode(content));
|
||||
fullPage.appendChild(textObject);
|
||||
textObject.onclick = removeCloud;
|
||||
cloudObject.onclick = removeCloud;
|
||||
}, 1000);
|
||||
setTimeout(function() {
|
||||
cloudObject.style.left = startX + "px";
|
||||
cloudObject.style.top = startY + "px";
|
||||
cloudObject.style.width = "4px";
|
||||
cloudObject.style.height = "4px";
|
||||
fullPage.removeChild(textObject);
|
||||
}, 9000);
|
||||
setTimeout(function(){
|
||||
fullPage.removeChild(cloudObject);
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
function messageListener(easyrtcid, msgType, content) {
|
||||
for(var i = 0; i < maxCALLERS; i++) {
|
||||
if( easyrtc.getIthCaller(i) == easyrtcid) {
|
||||
var startArea = document.getElementById(getIdOfBox(i+1));
|
||||
var startX = parseInt(startArea.offsetLeft) + parseInt(startArea.offsetWidth)/2;
|
||||
var startY = parseInt(startArea.offsetTop) + parseInt(startArea.offsetHeight)/2;
|
||||
showMessage(startX, startY, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appInit() {
|
||||
|
||||
// Prep for the top-down layout manager
|
||||
setReshaper('fullpage', reshapeFull);
|
||||
for(var i = 0; i < numVideoOBJS; i++) {
|
||||
prepVideoBox(i);
|
||||
}
|
||||
setReshaper('killButton', killButtonReshaper);
|
||||
setReshaper('muteButton', muteButtonReshaper);
|
||||
setReshaper('textentryBox', reshapeTextEntryBox);
|
||||
setReshaper('textentryField', reshapeTextEntryField);
|
||||
setReshaper('textEntryButton', reshapeTextEntryButton);
|
||||
|
||||
updateMuteImage(false);
|
||||
window.onresize = handleWindowResize;
|
||||
handleWindowResize(); //initial call of the top-down layout manager
|
||||
|
||||
|
||||
easyrtc.setRoomOccupantListener(callEverybodyElse);
|
||||
easyrtc.easyApp("easyrtc.multiparty", "box0", ["box1", "box2", "box3"], loginSuccess);
|
||||
easyrtc.setPeerListener(messageListener);
|
||||
easyrtc.setDisconnectListener( function() {
|
||||
easyrtc.showError("LOST-CONNECTION", "Lost connection to signaling server");
|
||||
});
|
||||
easyrtc.setOnCall( function(easyrtcid, slot) {
|
||||
console.log("getConnection count=" + easyrtc.getConnectionCount() );
|
||||
boxUsed[slot+1] = true;
|
||||
if(activeBox == 0 ) { // first connection
|
||||
collapseToThumb();
|
||||
document.getElementById('textEntryButton').style.display = 'block';
|
||||
}
|
||||
document.getElementById(getIdOfBox(slot+1)).style.visibility = "visible";
|
||||
handleWindowResize();
|
||||
});
|
||||
|
||||
|
||||
easyrtc.setOnHangup(function(easyrtcid, slot) {
|
||||
boxUsed[slot+1] = false;
|
||||
if(activeBox > 0 && slot+1 == activeBox) {
|
||||
collapseToThumb();
|
||||
}
|
||||
setTimeout(function() {
|
||||
document.getElementById(getIdOfBox(slot+1)).style.visibility = "hidden";
|
||||
|
||||
if( easyrtc.getConnectionCount() == 0 ) { // no more connections
|
||||
expandThumb(0);
|
||||
document.getElementById('textEntryButton').style.display = 'none';
|
||||
document.getElementById('textentryBox').style.display = 'none';
|
||||
}
|
||||
handleWindowResize();
|
||||
},20);
|
||||
});
|
||||
}
|
||||
|
||||
|
255
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_multistream.js
generated
vendored
@ -1,255 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var haveSelfVideo = false;
|
||||
var otherEasyrtcid = null;
|
||||
|
||||
|
||||
function disable(domId) {
|
||||
console.log("about to try disabling " +domId);
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
console.log("about to try enabling " +domId);
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function createLabelledButton(buttonLabel) {
|
||||
var button = document.createElement("button");
|
||||
button.appendChild(document.createTextNode(buttonLabel));
|
||||
document.getElementById("videoSrcBlk").appendChild(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
function addMediaStreamToDiv(divId, stream, streamName)
|
||||
{
|
||||
var container = document.createElement("div");
|
||||
container.style.marginBottom = "10px";
|
||||
var formattedName = streamName.replace("(", "<br>").replace(")", "");
|
||||
var labelBlock = document.createElement("div");
|
||||
labelBlock.style.width = "220px";
|
||||
labelBlock.style.cssFloat = "left";
|
||||
labelBlock.innerHTML = "<pre>" + formattedName + "</pre><br>";
|
||||
container.appendChild(labelBlock);
|
||||
var video = document.createElement("video");
|
||||
video.width = 320;
|
||||
video.height = 240;
|
||||
video.style.verticalAlign= "middle";
|
||||
container.appendChild(video);
|
||||
document.getElementById(divId).appendChild(container);
|
||||
video.autoplay = true;
|
||||
video.muted = false;
|
||||
easyrtc.setVideoObjectSrc(video, stream);
|
||||
return labelBlock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function createLocalVideo(stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("localVideos", stream, streamName);
|
||||
var closeButton = createLabelledButton("close");
|
||||
closeButton.onclick = function() {
|
||||
easyrtc.closeLocalStream(streamName);
|
||||
labelBlock.parentNode.parentNode.removeChild(labelBlock.parentNode);
|
||||
}
|
||||
labelBlock.appendChild(closeButton);
|
||||
|
||||
console.log("created local video, stream.streamName = " + stream.streamName);
|
||||
}
|
||||
|
||||
function addSrcButton(buttonLabel, videoId) {
|
||||
var button = createLabelledButton(buttonLabel);
|
||||
button.onclick = function() {
|
||||
easyrtc.setVideoSource(videoId);
|
||||
easyrtc.initMediaSource(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, buttonLabel);
|
||||
if( otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, buttonLabel, function(easyrtcid, streamName){
|
||||
easyrtc.showError("Informational", "other party " + easyrtcid + " acknowledges receiving " + streamName);
|
||||
});
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
}, buttonLabel);
|
||||
};
|
||||
}
|
||||
|
||||
function connect() {
|
||||
console.log("Initializing.");
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.multistream", loginSuccess, loginFailure);
|
||||
easyrtc.setAutoInitUserMedia(false);
|
||||
easyrtc.getVideoSourceList(function(videoSrcList) {
|
||||
for (var i = 0; i < videoSrcList.length; i++) {
|
||||
var videoEle = videoSrcList[i];
|
||||
var videoLabel = (videoSrcList[i].label &&videoSrcList[i].label.length > 0)?
|
||||
(videoSrcList[i].label):("src_" + i);
|
||||
addSrcButton(videoLabel, videoSrcList[i].id);
|
||||
}
|
||||
//
|
||||
// add an extra button for screen sharing
|
||||
//
|
||||
var screenShareButton = createLabelledButton("Screen capture/share");
|
||||
var numScreens = 0;
|
||||
if (!chrome.desktopCapture) {
|
||||
screenShareButton.disabled = true;
|
||||
}
|
||||
else {
|
||||
screenShareButton.onclick = function() {
|
||||
numScreens++;
|
||||
var streamName = "screen" + numScreens;
|
||||
easyrtc.initScreenCapture(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, streamName);
|
||||
if( otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, "screen");
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
}, streamName);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons(roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for (var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode("Call " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(targetEasyrtcId) {
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if (!accepted) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(easyrtcid) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
else {
|
||||
otherEasyrtcid = targetEasyrtcId;
|
||||
}
|
||||
};
|
||||
|
||||
var successCB = function() {
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
var keys = easyrtc.getLocalMediaIds();
|
||||
|
||||
easyrtc.call(targetEasyrtcId, successCB, failureCB, acceptedCB, keys);
|
||||
enable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
// enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
easyrtc.disconnect();
|
||||
enable("connectButton");
|
||||
// disable("disconnectButton");
|
||||
clearConnectList();
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('selfVideo'), "");
|
||||
}
|
||||
|
||||
easyrtc.setStreamAcceptor(function(easyrtcid, stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("remoteVideos", stream, streamName);
|
||||
labelBlock.parentNode.id = "remoteBlock" + easyrtcid + streamName;
|
||||
console.log("accepted incoming stream with name " + stream.streamName);
|
||||
console.log("checking incoming " + easyrtc.getNameOfRemoteStream(easyrtcid, stream));
|
||||
});
|
||||
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed(function(easyrtcid, stream, streamName) {
|
||||
var item = document.getElementById("remoteBlock" + easyrtcid + streamName);
|
||||
item.parentNode.removeChild(item);
|
||||
});
|
||||
|
||||
|
||||
var callerPending = null;
|
||||
|
||||
easyrtc.setCallCancelled(function(easyrtcid) {
|
||||
if (easyrtcid === callerPending) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
callerPending = false;
|
||||
}
|
||||
});
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
otherEasyrtcid = easyrtcid;
|
||||
if (easyrtc.getConnectionCount() > 0) {
|
||||
easyrtc.hangupAll();
|
||||
}
|
||||
callback(true, easyrtc.getLocalMediaIds());
|
||||
});
|
249
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_multistream_iframe.js
generated
vendored
@ -1,249 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var haveSelfVideo = false;
|
||||
var otherEasyrtcid = null;
|
||||
|
||||
|
||||
function disable(domId) {
|
||||
console.log("about to try disabling " + domId);
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
console.log("about to try enabling " + domId);
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function createLabelledButton(buttonLabel) {
|
||||
var button = document.createElement("button");
|
||||
button.appendChild(document.createTextNode(buttonLabel));
|
||||
document.getElementById("videoSrcBlk").appendChild(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
function addMediaStreamToDiv(divId, stream, streamName)
|
||||
{
|
||||
var container = document.createElement("div");
|
||||
container.style.marginBottom = "10px";
|
||||
var formattedName = streamName.replace("(", "<br>").replace(")", "");
|
||||
var labelBlock = document.createElement("div");
|
||||
labelBlock.style.width = "220px";
|
||||
labelBlock.style.cssFloat = "left";
|
||||
labelBlock.innerHTML = "<pre>" + formattedName + "</pre><br>";
|
||||
container.appendChild(labelBlock);
|
||||
var video = document.createElement("video");
|
||||
video.width = 320;
|
||||
video.height = 240;
|
||||
video.style.verticalAlign = "middle";
|
||||
container.appendChild(video);
|
||||
document.getElementById(divId).appendChild(container);
|
||||
video.autoplay = true;
|
||||
video.muted = false;
|
||||
easyrtc.setVideoObjectSrc(video, stream);
|
||||
return labelBlock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function createLocalVideo(stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("localVideos", stream, streamName);
|
||||
var closeButton = createLabelledButton("close");
|
||||
closeButton.onclick = function() {
|
||||
easyrtc.closeLocalStream(streamName);
|
||||
labelBlock.parentNode.parentNode.removeChild(labelBlock.parentNode);
|
||||
}
|
||||
labelBlock.appendChild(closeButton);
|
||||
}
|
||||
|
||||
function addSrcButton(buttonLabel, videoId) {
|
||||
var button = createLabelledButton(buttonLabel);
|
||||
button.onclick = function() {
|
||||
easyrtc.setVideoSource(videoId);
|
||||
easyrtc.initMediaSource(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, buttonLabel);
|
||||
if (otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, buttonLabel);
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
}, buttonLabel);
|
||||
};
|
||||
}
|
||||
|
||||
function connect() {
|
||||
console.log("Initializing.");
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.multistream", loginSuccess, loginFailure);
|
||||
easyrtc.setAutoInitUserMedia(false);
|
||||
|
||||
easyrtc.getVideoSourceList(function(videoSrcList) {
|
||||
for (var i = 0; i < videoSrcList.length; i++) {
|
||||
var videoEle = videoSrcList[i];
|
||||
var videoLabel = (videoSrcList[i].label && videoSrcList[i].label.length > 0) ?
|
||||
(videoSrcList[i].label) : ("src_" + i);
|
||||
addSrcButton(videoLabel, videoSrcList[i].id);
|
||||
}
|
||||
});
|
||||
//
|
||||
// add an extra button for screen sharing
|
||||
//
|
||||
var screenShareButton = createLabelledButton("Desktop capture/share");
|
||||
var numScreens = 0;
|
||||
|
||||
screenShareButton.onclick = function() {
|
||||
numScreens++;
|
||||
var streamName = "screen" + numScreens;
|
||||
easyrtc.initDesktopStream(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, streamName);
|
||||
if (otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, streamName);
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
},
|
||||
streamName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons(roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for (var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode("Call " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(targetEasyrtcId) {
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if (!accepted) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(easyrtcid) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
else {
|
||||
otherEasyrtcid = targetEasyrtcId;
|
||||
}
|
||||
};
|
||||
|
||||
var successCB = function() {
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
var keys = easyrtc.getLocalMediaIds();
|
||||
|
||||
easyrtc.call(targetEasyrtcId, successCB, failureCB, acceptedCB, keys);
|
||||
enable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
// enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
easyrtc.disconnect();
|
||||
enable("connectButton");
|
||||
// disable("disconnectButton");
|
||||
clearConnectList();
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('selfVideo'), "");
|
||||
}
|
||||
|
||||
easyrtc.setStreamAcceptor(function(easyrtcid, stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("remoteVideos", stream, streamName);
|
||||
labelBlock.parentNode.id = "remoteBlock" + easyrtcid + streamName;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed(function(easyrtcid, stream, streamName) {
|
||||
var item = document.getElementById("remoteBlock" + easyrtcid + streamName);
|
||||
item.parentNode.removeChild(item);
|
||||
});
|
||||
|
||||
|
||||
var callerPending = null;
|
||||
|
||||
easyrtc.setCallCancelled(function(easyrtcid) {
|
||||
if (easyrtcid === callerPending) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
callerPending = false;
|
||||
}
|
||||
});
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
otherEasyrtcid = easyrtcid;
|
||||
if (easyrtc.getConnectionCount() > 0) {
|
||||
easyrtc.hangupAll();
|
||||
}
|
||||
callback(true, easyrtc.getLocalMediaIds());
|
||||
});
|
265
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_multistream_no_iframe.js
generated
vendored
@ -1,265 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
var haveSelfVideo = false;
|
||||
var otherEasyrtcid = null;
|
||||
|
||||
|
||||
function disable(domId) {
|
||||
console.log("about to try disabling " + domId);
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
console.log("about to try enabling " + domId);
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function createLabelledButton(buttonLabel) {
|
||||
var button = document.createElement("button");
|
||||
button.appendChild(document.createTextNode(buttonLabel));
|
||||
document.getElementById("videoSrcBlk").appendChild(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
function addMediaStreamToDiv(divId, stream, streamName)
|
||||
{
|
||||
var container = document.createElement("div");
|
||||
container.style.marginBottom = "10px";
|
||||
var formattedName = streamName.replace("(", "<br>").replace(")", "");
|
||||
var labelBlock = document.createElement("div");
|
||||
labelBlock.style.width = "220px";
|
||||
labelBlock.style.cssFloat = "left";
|
||||
labelBlock.innerHTML = "<pre>" + formattedName + "</pre><br>";
|
||||
container.appendChild(labelBlock);
|
||||
var video = document.createElement("video");
|
||||
video.width = 320;
|
||||
video.height = 240;
|
||||
video.style.verticalAlign = "middle";
|
||||
container.appendChild(video);
|
||||
document.getElementById(divId).appendChild(container);
|
||||
video.autoplay = true;
|
||||
video.muted = false;
|
||||
easyrtc.setVideoObjectSrc(video, stream);
|
||||
return labelBlock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function createLocalVideo(stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("localVideos", stream, streamName);
|
||||
var closeButton = createLabelledButton("close");
|
||||
closeButton.onclick = function() {
|
||||
easyrtc.closeLocalStream(streamName);
|
||||
labelBlock.parentNode.parentNode.removeChild(labelBlock.parentNode);
|
||||
}
|
||||
labelBlock.appendChild(closeButton);
|
||||
}
|
||||
|
||||
function addSrcButton(buttonLabel, videoId) {
|
||||
var button = createLabelledButton(buttonLabel);
|
||||
button.onclick = function() {
|
||||
easyrtc.setVideoSource(videoId);
|
||||
easyrtc.initMediaSource(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, buttonLabel);
|
||||
if (otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, buttonLabel);
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
}, buttonLabel);
|
||||
};
|
||||
}
|
||||
|
||||
function connect() {
|
||||
console.log("Initializing.");
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.multistream", loginSuccess, loginFailure);
|
||||
easyrtc.setAutoInitUserMedia(false);
|
||||
|
||||
easyrtc.getVideoSourceList(function(videoSrcList) {
|
||||
for (var i = 0; i < videoSrcList.length; i++) {
|
||||
var videoEle = videoSrcList[i];
|
||||
var videoLabel = (videoSrcList[i].label && videoSrcList[i].label.length > 0) ?
|
||||
(videoSrcList[i].label) : ("src_" + i);
|
||||
addSrcButton(videoLabel, videoSrcList[i].id);
|
||||
}
|
||||
});
|
||||
//
|
||||
// add an extra button for screen sharing
|
||||
//
|
||||
var screenShareButton = createLabelledButton("Desktop capture/share");
|
||||
var numScreens = 0;
|
||||
|
||||
screenShareButton.onclick = function() {
|
||||
numScreens++;
|
||||
var streamName = "screen" + numScreens;
|
||||
easyrtc.initDesktopStream(
|
||||
function(stream) {
|
||||
createLocalVideo(stream, streamName);
|
||||
if (otherEasyrtcid) {
|
||||
easyrtc.addStreamToCall(otherEasyrtcid, streamName);
|
||||
}
|
||||
},
|
||||
function(errCode, errText) {
|
||||
easyrtc.showError(errCode, errText);
|
||||
},
|
||||
streamName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function clearConnectList() {
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
while (otherClientDiv.hasChildNodes()) {
|
||||
otherClientDiv.removeChild(otherClientDiv.lastChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function convertListToButtons(roomName, occupants, isPrimary) {
|
||||
clearConnectList();
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
for (var easyrtcid in occupants) {
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
|
||||
var label = document.createTextNode("Call " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function performCall(targetEasyrtcId) {
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if (!accepted) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(easyrtcid) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
else {
|
||||
otherEasyrtcid = targetEasyrtcId;
|
||||
}
|
||||
};
|
||||
|
||||
var successCB = function() {
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
var keys = easyrtc.getLocalMediaIds();
|
||||
|
||||
easyrtc.call(targetEasyrtcId, successCB, failureCB, acceptedCB, keys);
|
||||
enable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
// enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
selfEasyrtcid = easyrtcid;
|
||||
document.getElementById("iam").innerHTML = "I am " + easyrtc.cleanId(easyrtcid);
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError(errorCode, message);
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
easyrtc.disconnect();
|
||||
enable("connectButton");
|
||||
// disable("disconnectButton");
|
||||
clearConnectList();
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('selfVideo'), "");
|
||||
}
|
||||
|
||||
easyrtc.setStreamAcceptor(function(easyrtcid, stream, streamName) {
|
||||
var labelBlock = addMediaStreamToDiv("remoteVideos", stream, streamName);
|
||||
labelBlock.parentNode.id = "remoteBlock" + easyrtcid + streamName;
|
||||
|
||||
console.log("accepted incoming stream with name " + stream.streamName);
|
||||
console.log("checking incoming " + easyrtc.getNameOfRemoteStream(easyrtcid, stream));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed(function(easyrtcid, stream, streamName) {
|
||||
var item = document.getElementById("remoteBlock" + easyrtcid + streamName);
|
||||
item.parentNode.removeChild(item);
|
||||
});
|
||||
|
||||
|
||||
var callerPending = null;
|
||||
|
||||
easyrtc.setCallCancelled(function(easyrtcid) {
|
||||
if (easyrtcid === callerPending) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
callerPending = false;
|
||||
}
|
||||
});
|
||||
|
||||
easyrtc.setAcceptChecker(function(easyrtcid, callback) {
|
||||
otherEasyrtcid = easyrtcid;
|
||||
if (easyrtc.getConnectionCount() > 0) {
|
||||
easyrtc.hangupAll();
|
||||
}
|
||||
callback(true, easyrtc.getLocalMediaIds());
|
||||
});
|
||||
|
||||
var mypluginId = "tawk-desktop-capture/bemabaogbdfpbkkganibcmhbgjogabfj";
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
document.getElementById("pluginstatus").innerHTML = easyrtc.isDesktopCaptureInstalled()
|
||||
?"Desktop capture ready"
|
||||
:"Desktop capture not installed";
|
||||
}, 3000);
|
||||
|
||||
document.getElementById("installPluginButton").onclick = function() {
|
||||
chrome.webstore.install();
|
||||
};
|
73
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_reconnect.js
generated
vendored
@ -1,73 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
|
||||
function initApp() {
|
||||
console.log("Initializing.");
|
||||
easyrtc.enableVideo(false);
|
||||
easyrtc.enableAudio(false);
|
||||
connect();
|
||||
}
|
||||
|
||||
function connect() {
|
||||
easyrtc.connect("easyrtc.reconnect", loginSuccess, loginFailure);
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
easyrtc.disconnect();
|
||||
}
|
||||
|
||||
easyrtc.enableDebug(true);
|
||||
|
||||
easyrtc.setDisconnectListener(function() {
|
||||
easyrtc.showError("xx", "saw disconnect");
|
||||
});
|
||||
|
||||
|
||||
function sendDummy() {
|
||||
easyrtc.getRoomList(
|
||||
function() {
|
||||
easyrtc.showError("xx", "got fresh roomlist");
|
||||
},
|
||||
function(){
|
||||
easyrtc.showError("xx", "failed on fresh roomlist");
|
||||
});
|
||||
}
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
document.getElementById("stateLabel").innerHTML = " connected as " + easyrtcid;
|
||||
easyrtc.showError("xx", "login success");
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
document.getElementById("stateLabel").innerHTML = "disconnected";
|
||||
easyrtc.showError("xx", "login failure");
|
||||
}
|
||||
|
||||
|
726
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_room.js
generated
vendored
@ -1,726 +0,0 @@
|
||||
|
||||
|
||||
var activeBox = -1; // nothing selected
|
||||
var aspectRatio = 4/3; // standard definition video aspect ratio
|
||||
var maxCALLERS = 3;
|
||||
var numVideoOBJS = maxCALLERS+1;
|
||||
var layout;
|
||||
|
||||
function getIdOfBox(boxNum) {
|
||||
return "box" + boxNum;
|
||||
}
|
||||
|
||||
|
||||
function reshapeFull(parentw, parenth) {
|
||||
return {
|
||||
left:0,
|
||||
top:0,
|
||||
width:parentw,
|
||||
height:parenth
|
||||
};
|
||||
}
|
||||
|
||||
function reshapeTextEntryBox(parentw, parenth) {
|
||||
return {
|
||||
left:parentw/4,
|
||||
top:parenth/4,
|
||||
width:parentw/2,
|
||||
height: parenth/4
|
||||
};
|
||||
}
|
||||
|
||||
function reshapeTextEntryField(parentw, parenth) {
|
||||
return {
|
||||
width:parentw -40
|
||||
};
|
||||
}
|
||||
|
||||
var margin = 20;
|
||||
|
||||
function reshapeToFullSize(parentw, parenth) {
|
||||
var left, top, width, height;
|
||||
var margin= 20;
|
||||
|
||||
if( parentw < parenth*aspectRatio){
|
||||
width = parentw -margin;
|
||||
height = width/aspectRatio;
|
||||
}
|
||||
else {
|
||||
height = parenth-margin;
|
||||
width = height*aspectRatio;
|
||||
}
|
||||
left = (parentw - width)/2;
|
||||
top = (parenth - height)/2;
|
||||
return {
|
||||
left:left,
|
||||
top:top,
|
||||
width:width,
|
||||
height:height
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// a negative percentLeft is interpreted as setting the right edge of the object
|
||||
// that distance from the right edge of the parent.
|
||||
// Similar for percentTop.
|
||||
//
|
||||
function setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspect) {
|
||||
|
||||
var width, height;
|
||||
if( parentw < parenth*aspectRatio){
|
||||
width = parentw * percentSize;
|
||||
height = width/aspect;
|
||||
}
|
||||
else {
|
||||
height = parenth * percentSize;
|
||||
width = height*aspect;
|
||||
}
|
||||
var left;
|
||||
if( percentLeft < 0) {
|
||||
left = parentw - width;
|
||||
}
|
||||
else {
|
||||
left = 0;
|
||||
}
|
||||
left += Math.floor(percentLeft*parentw);
|
||||
var top = 0;
|
||||
if( percentTop < 0) {
|
||||
top = parenth - height;
|
||||
}
|
||||
else {
|
||||
top = 0;
|
||||
}
|
||||
top += Math.floor(percentTop*parenth);
|
||||
return {
|
||||
left:left,
|
||||
top:top,
|
||||
width:width,
|
||||
height:height
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function setThumbSize(percentSize, percentLeft, percentTop, parentw, parenth) {
|
||||
return setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspectRatio);
|
||||
}
|
||||
|
||||
function setThumbSizeButton(percentSize, percentLeft, percentTop, parentw, parenth, imagew, imageh) {
|
||||
return setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, imagew/imageh);
|
||||
}
|
||||
|
||||
|
||||
var sharedVideoWidth = 1;
|
||||
var sharedVideoHeight = 1;
|
||||
|
||||
function reshape1of2(parentw, parenth) {
|
||||
if( layout=== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3,
|
||||
top: (parenth -sharedVideoHeight)/2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function reshape2of2(parentw, parenth){
|
||||
if( layout=== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3 *2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3 *2 + sharedVideoWidth,
|
||||
top: (parenth -sharedVideoHeight)/2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function reshape1of3(parentw, parenth) {
|
||||
if( layout=== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4 ,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function reshape2of3(parentw, parenth){
|
||||
if( layout=== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4*2+ sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3*2+sharedVideoWidth,
|
||||
top: (parenth -sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function reshape3of3(parentw, parenth) {
|
||||
if( layout=== 'p' ) {
|
||||
return {
|
||||
left: (parentw-sharedVideoWidth)/2,
|
||||
top: (parenth -sharedVideoHeight*3)/4*3+ sharedVideoHeight*2,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
else {
|
||||
return{
|
||||
left: (parentw-sharedVideoWidth*2)/3*1.5+sharedVideoWidth/2,
|
||||
top: (parenth -sharedVideoHeight*2)/3*2+ sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reshape1of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3,
|
||||
top: (parenth - sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
|
||||
function reshape2of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3*2+ sharedVideoWidth,
|
||||
top: (parenth - sharedVideoHeight*2)/3,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
function reshape3of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3,
|
||||
top: (parenth - sharedVideoHeight*2)/3*2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
|
||||
function reshape4of4(parentw, parenth) {
|
||||
return {
|
||||
left: (parentw - sharedVideoWidth*2)/3*2 + sharedVideoWidth,
|
||||
top: (parenth - sharedVideoHeight*2)/3*2 + sharedVideoHeight,
|
||||
width: sharedVideoWidth,
|
||||
height: sharedVideoHeight
|
||||
};
|
||||
}
|
||||
|
||||
var boxUsed = [true, false, false, false];
|
||||
var connectCount = 0;
|
||||
|
||||
|
||||
function setSharedVideoSize(parentw, parenth) {
|
||||
layout = ((parentw /aspectRatio) < parenth)?'p':'l';
|
||||
var w, h;
|
||||
|
||||
function sizeBy(fullsize, numVideos) {
|
||||
return (fullsize - margin*(numVideos+1) )/numVideos;
|
||||
}
|
||||
|
||||
switch(layout+(connectCount+1)) {
|
||||
case 'p1':
|
||||
case 'l1':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 1);
|
||||
break;
|
||||
case 'l2':
|
||||
w = sizeBy(parentw, 2);
|
||||
h = sizeBy(parenth, 1);
|
||||
break;
|
||||
case 'p2':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 2);
|
||||
break;
|
||||
case 'p4':
|
||||
case 'l4':
|
||||
case 'l3':
|
||||
w = sizeBy(parentw, 2);
|
||||
h = sizeBy(parenth, 2);
|
||||
break;
|
||||
case 'p3':
|
||||
w = sizeBy(parentw, 1);
|
||||
h = sizeBy(parenth, 3);
|
||||
break;
|
||||
}
|
||||
sharedVideoWidth = Math.min(w, h * aspectRatio);
|
||||
sharedVideoHeight = Math.min(h, w/aspectRatio);
|
||||
}
|
||||
|
||||
var reshapeThumbs = [
|
||||
function(parentw, parenth) {
|
||||
|
||||
if( activeBox > 0 ) {
|
||||
return setThumbSize(0.20, 0.01, 0.01, parentw, parenth);
|
||||
}
|
||||
else {
|
||||
setSharedVideoSize(parentw, parenth);
|
||||
switch(connectCount) {
|
||||
case 0:return reshapeToFullSize(parentw, parenth);
|
||||
case 1:return reshape1of2(parentw, parenth);
|
||||
case 2:return reshape1of3(parentw, parenth);
|
||||
case 3:return reshape1of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[1]) {
|
||||
return setThumbSize(0.20, 0.01, -0.01, parentw, parenth);
|
||||
}
|
||||
else{
|
||||
switch(connectCount) {
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
return reshape2of3(parentw, parenth);
|
||||
case 3:
|
||||
return reshape2of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[2] ) {
|
||||
return setThumbSize(0.20, -0.01, 0.01, parentw, parenth);
|
||||
}
|
||||
else {
|
||||
switch(connectCount){
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
if( !boxUsed[1]) {
|
||||
return reshape2of3(parentw, parenth);
|
||||
}
|
||||
else {
|
||||
return reshape3of3(parentw, parenth);
|
||||
}
|
||||
case 3:
|
||||
return reshape3of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
},
|
||||
function(parentw, parenth) {
|
||||
if( activeBox >= 0 || !boxUsed[3]) {
|
||||
return setThumbSize(0.20, -0.01, -0.01, parentw, parenth);
|
||||
}
|
||||
else{
|
||||
switch(connectCount){
|
||||
case 1:
|
||||
return reshape2of2(parentw, parenth);
|
||||
case 2:
|
||||
return reshape3of3(parentw, parenth);
|
||||
case 3:
|
||||
return reshape4of4(parentw, parenth);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
function killButtonReshaper(parentw, parenth) {
|
||||
var imagew = 128;
|
||||
var imageh = 128;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.1, -.51, -0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.1, -.01, -.51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function muteButtonReshaper(parentw, parenth) {
|
||||
var imagew = 32;
|
||||
var imageh = 32;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.10, -.51, 0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.10, 0.01, -.51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
function reshapeTextEntryButton(parentw, parenth) {
|
||||
var imagew = 32;
|
||||
var imageh = 32;
|
||||
if( parentw < parenth) {
|
||||
return setThumbSizeButton(0.10, .51, 0.01, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
else {
|
||||
return setThumbSizeButton(0.10, 0.01, .51, parentw, parenth, imagew, imageh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleWindowResize() {
|
||||
var fullpage = document.getElementById('fullpage');
|
||||
fullpage.style.width = window.innerWidth + "px";
|
||||
fullpage.style.height = window.innerHeight + "px";
|
||||
connectCount = easyrtc.getConnectionCount();
|
||||
|
||||
function applyReshape(obj, parentw, parenth) {
|
||||
var myReshape = obj.reshapeMe(parentw, parenth);
|
||||
|
||||
if(typeof myReshape.left !== 'undefined' ) {
|
||||
obj.style.left = Math.round(myReshape.left) + "px";
|
||||
}
|
||||
if(typeof myReshape.top !== 'undefined' ) {
|
||||
obj.style.top = Math.round(myReshape.top) + "px";
|
||||
}
|
||||
if(typeof myReshape.width !== 'undefined' ) {
|
||||
obj.style.width = Math.round(myReshape.width) + "px";
|
||||
}
|
||||
if(typeof myReshape.height !== 'undefined' ) {
|
||||
obj.style.height = Math.round(myReshape.height) + "px";
|
||||
}
|
||||
|
||||
var n = obj.childNodes.length;
|
||||
for(var i = 0; i < n; i++ ) {
|
||||
var childNode = obj.childNodes[i];
|
||||
if( childNode.reshapeMe) {
|
||||
applyReshape(childNode, myReshape.width, myReshape.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyReshape(fullpage, window.innerWidth, window.innerHeight);
|
||||
}
|
||||
|
||||
|
||||
function setReshaper(elementId, reshapeFn) {
|
||||
var element = document.getElementById(elementId);
|
||||
if( !element) {
|
||||
alert("Attempt to apply to reshapeFn to non-existent element " + elementId);
|
||||
}
|
||||
if( !reshapeFn) {
|
||||
alert("Attempt to apply misnamed reshapeFn to element " + elementId);
|
||||
}
|
||||
element.reshapeMe = reshapeFn;
|
||||
}
|
||||
|
||||
|
||||
function collapseToThumbHelper() {
|
||||
if( activeBox >= 0) {
|
||||
var id = getIdOfBox(activeBox);
|
||||
document.getElementById(id).style.zIndex = 2;
|
||||
setReshaper(id, reshapeThumbs[activeBox]);
|
||||
document.getElementById('muteButton').style.display = "none";
|
||||
document.getElementById('killButton').style.display = "none";
|
||||
activeBox = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function collapseToThumb() {
|
||||
collapseToThumbHelper();
|
||||
activeBox = -1;
|
||||
updateMuteImage(false);
|
||||
handleWindowResize();
|
||||
|
||||
}
|
||||
|
||||
function updateMuteImage(toggle) {
|
||||
var muteButton = document.getElementById('muteButton');
|
||||
if( activeBox > 0) { // no kill button for self video
|
||||
muteButton.style.display = "block";
|
||||
var videoObject = document.getElementById( getIdOfBox(activeBox));
|
||||
var isMuted = videoObject.muted?true:false;
|
||||
if( toggle) {
|
||||
isMuted = !isMuted;
|
||||
videoObject.muted = isMuted;
|
||||
}
|
||||
muteButton.src = isMuted?"images/button_unmute.png":"images/button_mute.png";
|
||||
}
|
||||
else {
|
||||
muteButton.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function expandThumb(whichBox) {
|
||||
var lastActiveBox = activeBox;
|
||||
if( activeBox >= 0 ) {
|
||||
collapseToThumbHelper();
|
||||
}
|
||||
if( lastActiveBox !== whichBox) {
|
||||
var id = getIdOfBox(whichBox);
|
||||
activeBox = whichBox;
|
||||
setReshaper(id, reshapeToFullSize);
|
||||
document.getElementById(id).style.zIndex = 1;
|
||||
if( whichBox > 0) {
|
||||
document.getElementById('muteButton').style.display = "block";
|
||||
updateMuteImage();
|
||||
document.getElementById('killButton').style.display = "block";
|
||||
}
|
||||
}
|
||||
updateMuteImage(false);
|
||||
handleWindowResize();
|
||||
}
|
||||
|
||||
function prepVideoBox(whichBox) {
|
||||
var id = getIdOfBox(whichBox);
|
||||
setReshaper(id, reshapeThumbs[whichBox]);
|
||||
document.getElementById(id).onclick = function() {
|
||||
expandThumb(whichBox);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function killActiveBox() {
|
||||
if( activeBox > 0) {
|
||||
var easyrtcid = easyrtc.getIthCaller(activeBox-1);
|
||||
collapseToThumb();
|
||||
setTimeout( function() {
|
||||
easyrtc.hangup(easyrtcid);
|
||||
easyrtc.sendServerMessage(null, "hangup", {hangupEasyrtcid:caller});
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function muteActiveBox() {
|
||||
updateMuteImage(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function callEverybodyElse(roomName, otherPeople) {
|
||||
|
||||
easyrtc.setRoomOccupantListener(null, null); // so we're only called once.
|
||||
|
||||
var list = [];
|
||||
var connectCount = 0;
|
||||
|
||||
for(var i in otherPeople ) {
|
||||
list.push(i);
|
||||
}
|
||||
|
||||
//
|
||||
// Connect in reverse order. Latter arriving people are more likely to have
|
||||
// empty slots.
|
||||
//
|
||||
function establishConnection(position) {
|
||||
function callSuccess() {
|
||||
connectCount++;
|
||||
if( connectCount < maxCALLERS && position > 0) {
|
||||
establishConnection(position-1);
|
||||
}
|
||||
}
|
||||
function callFailure(errorCode, errorText) {
|
||||
easyrtc.showError(errorCode, errorText);
|
||||
if( connectCount < maxCALLERS && position > 0) {
|
||||
establishConnection(position-1);
|
||||
}
|
||||
}
|
||||
easyrtc.call(list[position], callSuccess, callFailure);
|
||||
|
||||
}
|
||||
if( list.length > 0) {
|
||||
establishConnection(list.length-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess() {
|
||||
console.log("Successfully connected");
|
||||
expandThumb(0); // expand the mirror image initially.
|
||||
}
|
||||
|
||||
function loginFailure(errorCode, errorText ) {
|
||||
easyrtc.showError(errorCode, errorText);
|
||||
}
|
||||
|
||||
|
||||
function cancelText() {
|
||||
document.getElementById('textentryBox').style.display = "none";
|
||||
document.getElementById('textEntryButton').style.display = "block";
|
||||
}
|
||||
|
||||
|
||||
function sendText(e) {
|
||||
document.getElementById('textentryBox').style.display = "none";
|
||||
document.getElementById('textEntryButton').style.display = "block";
|
||||
var stringToSend = document.getElementById('textentryField').value;
|
||||
if( stringToSend && stringToSend !== "") {
|
||||
for(var i = 0; i < maxCALLERS; i++ ) {
|
||||
var easyrtcid = easyrtc.getIthCaller(i);
|
||||
if( easyrtcid && easyrtcid !== "") {
|
||||
easyrtc.sendPeerMessage(easyrtcid, "img", stringToSend);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function showTextEntry() {
|
||||
document.getElementById('textentryField').value = "";
|
||||
document.getElementById('textentryBox').style.display = "block";
|
||||
document.getElementById('textEntryButton').style.display = "none";
|
||||
document.getElementById('textentryField').focus();
|
||||
}
|
||||
|
||||
|
||||
function showMessage(startX, startY, content) {
|
||||
var fullPage = document.getElementById('fullpage');
|
||||
var fullW = parseInt(fullPage.offsetWidth);
|
||||
var fullH = parseInt(fullPage.offsetHeight);
|
||||
var centerEndX = .2*startX + .8*fullW/2;
|
||||
var centerEndY = .2*startY + .8*fullH/2;
|
||||
|
||||
var cloudObject = document.createElement("img");
|
||||
cloudObject.src = "images/cloud.png";
|
||||
cloudObject.onload = function() {
|
||||
cloudObject.style.left = startX + "px";
|
||||
cloudObject.style.top = startY + "px";
|
||||
cloudObject.style.width = "4px";
|
||||
cloudObject.style.height = "4px";
|
||||
cloudObject.style.opacity = 0.7;
|
||||
cloudObject.style.zIndex = 5;
|
||||
cloudObject.className = "transit boxCommon";
|
||||
fullPage.appendChild(cloudObject);
|
||||
var textObject;
|
||||
function removeCloud() {
|
||||
if( textObject) {
|
||||
fullPage.removeChild(textObject);
|
||||
fullPage.removeChild(cloudObject);
|
||||
}
|
||||
}
|
||||
setTimeout(function() {
|
||||
cloudObject.style.left = centerEndX - fullW/4 + "px";
|
||||
cloudObject.style.top = centerEndY - fullH/4+ "px";
|
||||
cloudObject.style.width = (fullW/2) + "px";
|
||||
cloudObject.style.height = (fullH/2) + "px";
|
||||
}, 10);
|
||||
setTimeout(function() {
|
||||
textObject = document.createElement('div');
|
||||
textObject.className = "boxCommon";
|
||||
textObject.style.left = Math.floor(centerEndX-fullW/8) + "px";
|
||||
textObject.style.top = Math.floor(centerEndY) + "px";
|
||||
textObject.style.fontSize = "36pt";
|
||||
textObject.style.width = (fullW*.4) + "px";
|
||||
textObject.style.height = (fullH*.4) + "px";
|
||||
textObject.style.zIndex = 6;
|
||||
textObject.appendChild( document.createTextNode(content));
|
||||
fullPage.appendChild(textObject);
|
||||
textObject.onclick = removeCloud;
|
||||
cloudObject.onclick = removeCloud;
|
||||
}, 1000);
|
||||
setTimeout(function() {
|
||||
cloudObject.style.left = startX + "px";
|
||||
cloudObject.style.top = startY + "px";
|
||||
cloudObject.style.width = "4px";
|
||||
cloudObject.style.height = "4px";
|
||||
fullPage.removeChild(textObject);
|
||||
}, 9000);
|
||||
setTimeout(function(){
|
||||
fullPage.removeChild(cloudObject);
|
||||
}, 10000);
|
||||
};
|
||||
}
|
||||
|
||||
function messageListener(easyrtcid, msgType, content) {
|
||||
for(var i = 0; i < maxCALLERS; i++) {
|
||||
if( easyrtc.getIthCaller(i) === easyrtcid) {
|
||||
var startArea = document.getElementById(getIdOfBox(i+1));
|
||||
var startX = parseInt(startArea.offsetLeft) + parseInt(startArea.offsetWidth)/2;
|
||||
var startY = parseInt(startArea.offsetTop) + parseInt(startArea.offsetHeight)/2;
|
||||
showMessage(startX, startY, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appInit() {
|
||||
|
||||
// Prep for the top-down layout manager
|
||||
setReshaper('fullpage', reshapeFull);
|
||||
for(var i = 0; i < numVideoOBJS; i++) {
|
||||
prepVideoBox(i);
|
||||
}
|
||||
setReshaper('killButton', killButtonReshaper);
|
||||
setReshaper('muteButton', muteButtonReshaper);
|
||||
setReshaper('textentryBox', reshapeTextEntryBox);
|
||||
setReshaper('textentryField', reshapeTextEntryField);
|
||||
setReshaper('textEntryButton', reshapeTextEntryButton);
|
||||
|
||||
updateMuteImage(false);
|
||||
window.onresize = handleWindowResize;
|
||||
handleWindowResize(); //initial call of the top-down layout manager
|
||||
|
||||
// easyrtc.setVideoBandwidth(20);
|
||||
easyrtc.setRoomOccupantListener(callEverybodyElse);
|
||||
easyrtc.easyApp("easyrtc.room", "box0", ["box1", "box2", "box3"], loginSuccess, loginFailure);
|
||||
easyrtc.setPeerListener(messageListener);
|
||||
easyrtc.setDisconnectListener( function() {
|
||||
easyrtc.showError("LOST-CONNECTION", "Lost connection to signaling server");
|
||||
});
|
||||
easyrtc.setOnCall( function(easyrtcid, slot) {
|
||||
boxUsed[slot+1] = true;
|
||||
if(activeBox === 0 && easyrtc.getConnectionCount() === 1) { // first connection
|
||||
collapseToThumb();
|
||||
document.getElementById('textEntryButton').style.display = 'block';
|
||||
}
|
||||
document.getElementById(getIdOfBox(slot+1)).style.visibility = "visible";
|
||||
handleWindowResize();
|
||||
});
|
||||
|
||||
|
||||
easyrtc.setOnHangup(function(easyrtcid, slot) {
|
||||
boxUsed[slot+1] = false;
|
||||
console.log("hanging up on " + easyrtcid);
|
||||
if(activeBox > 0 && slot+1 === activeBox) {
|
||||
collapseToThumb();
|
||||
}
|
||||
setTimeout(function() {
|
||||
document.getElementById(getIdOfBox(slot+1)).style.visibility = "hidden";
|
||||
|
||||
if( easyrtc.getConnectionCount() === 0 ) { // no more connections
|
||||
expandThumb(0);
|
||||
document.getElementById('textEntryButton').style.display = 'none';
|
||||
document.getElementById('textentryBox').style.display = 'none';
|
||||
}
|
||||
handleWindowResize();
|
||||
},20);
|
||||
});
|
||||
}
|
||||
|
||||
|
209
messenger/js/easyrtc/node_modules/easyrtc/demos/js/demo_screen_receive.js
generated
vendored
@ -1,209 +0,0 @@
|
||||
//
|
||||
//Copyright (c) 2014, Priologic Software Inc.
|
||||
//All rights reserved.
|
||||
//
|
||||
//Redistribution and use in source and binary forms, with or without
|
||||
//modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
//LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
//POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
var selfEasyrtcid = "";
|
||||
|
||||
|
||||
function initApp() {
|
||||
if( window.localStorage && window.localStorage.easyrtcUserName ) {
|
||||
document.getElementById('userName').value = window.localStorage.easyrtcUserName;
|
||||
}
|
||||
}
|
||||
|
||||
function disable(domId) {
|
||||
document.getElementById(domId).disabled = "disabled";
|
||||
}
|
||||
|
||||
|
||||
function enable(domId) {
|
||||
document.getElementById(domId).disabled = "";
|
||||
}
|
||||
|
||||
|
||||
function connect() {
|
||||
console.log("Initializing.");
|
||||
|
||||
var userName = document.getElementById('userName').value;
|
||||
if( !easyrtc.isNameValid(userName)) {
|
||||
easyrtc.showError("BAD-USER-NAME", "illegal user name");
|
||||
return;
|
||||
}
|
||||
|
||||
easyrtc.setUsername(userName);
|
||||
if( window.localStorage ) {
|
||||
window.localStorage.easyrtcUserName = document.getElementById('userName').value;
|
||||
}
|
||||
|
||||
|
||||
easyrtc.enableAudio(document.getElementById('shareAudio').checked);
|
||||
easyrtc.enableVideo(false);
|
||||
easyrtc.setRoomOccupantListener(convertListToButtons);
|
||||
easyrtc.connect("easyrtc.videoScreen", loginSuccess, loginFailure);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function hangup() {
|
||||
easyrtc.hangupAll();
|
||||
disable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// this method actually just removes old buttons.
|
||||
// The adding of buttons is done with the data listener.
|
||||
//
|
||||
function convertListToButtons(roomName, data, isPrimary){
|
||||
console.log("saw data list of " + JSON.stringify(data));
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
var i, nextChild;
|
||||
|
||||
for( i = otherClientDiv.childNodes[0]; i; i = nextChild ){
|
||||
nextChild = i.nextSibling;
|
||||
var buttonId = i.id;
|
||||
if( !data[buttonId]){
|
||||
console.log(" removing button with id " + buttonId);
|
||||
otherClientDiv.removeChild(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function requestFullScreen() {
|
||||
var elem = document.getElementById('videos');
|
||||
elem.className = 'bigBox';
|
||||
if (elem.requestFullscreen) {
|
||||
elem.requestFullscreen();
|
||||
} else if (elem.mozRequestFullScreen) {
|
||||
elem.mozRequestFullScreen();
|
||||
} else if (elem.webkitRequestFullscreen) {
|
||||
elem.webkitRequestFullscreen();
|
||||
}
|
||||
var hideBox = document.getElementById('shrinkBox');
|
||||
hideBox.className = 'yesShrink';
|
||||
hideBox.onclick = function() {
|
||||
hideBox.className = 'noShrink';
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
}
|
||||
elem.className = 'smallBox';
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
easyrtc.setPeerListener(function(easyrtcid, msgType, data){
|
||||
var otherClientDiv = document.getElementById('otherClients');
|
||||
var button = document.createElement('button');
|
||||
button.onclick = function(easyrtcid) {
|
||||
return function() {
|
||||
performCall(easyrtcid);
|
||||
};
|
||||
}(easyrtcid);
|
||||
button.id = "callbutton_" +easyrtcid;
|
||||
console.log("adding button for id =" + easyrtcid);
|
||||
var label = document.createTextNode("Get screen of " + easyrtc.idToName(easyrtcid));
|
||||
button.appendChild(label);
|
||||
otherClientDiv.appendChild(button);
|
||||
});
|
||||
|
||||
|
||||
function performCall(otherEasyrtcid) {
|
||||
easyrtc.hangupAll();
|
||||
var acceptedCB = function(accepted, easyrtcid) {
|
||||
if( !accepted ) {
|
||||
easyrtc.showError("CALL-REJECTED", "Sorry, your call to " + easyrtc.idToName(easyrtcid) + " was rejected");
|
||||
enable('otherClients');
|
||||
}
|
||||
};
|
||||
|
||||
var successCB = function() {
|
||||
enable('hangupButton');
|
||||
};
|
||||
var failureCB = function() {
|
||||
enable('otherClients');
|
||||
};
|
||||
easyrtc.call(otherEasyrtcid, successCB, failureCB, acceptedCB);
|
||||
enable('hangupButton');
|
||||
}
|
||||
|
||||
|
||||
function loginSuccess(easyrtcid) {
|
||||
disable("connectButton");
|
||||
enable("disconnectButton");
|
||||
enable('otherClients');
|
||||
document.getElementById("iam").innerHTML = "Connected";
|
||||
selfEasyrtcid = easyrtcid;
|
||||
}
|
||||
|
||||
|
||||
function loginFailure(errorCode, message) {
|
||||
easyrtc.showError("LOGIN-FAILURE", "failure to login");
|
||||
}
|
||||
|
||||
|
||||
function disconnect() {
|
||||
document.getElementById("iam").innerHTML = "logged out";
|
||||
easyrtc.disconnect();
|
||||
console.log("disconnecting from server");
|
||||
enable("connectButton");
|
||||
disable("disconnectButton");
|
||||
}
|
||||
|
||||
|
||||
easyrtc.setStreamAcceptor( function(caller, stream) {
|
||||
var video = document.getElementById('callerVideo');
|
||||
easyrtc.setVideoObjectSrc(video,stream);
|
||||
console.log("saw video from " + caller);
|
||||
enable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
|
||||
easyrtc.setOnStreamClosed( function (easyrtcid) {
|
||||
easyrtc.setVideoObjectSrc(document.getElementById('callerVideo'), "");
|
||||
document.cancelFullScreen();
|
||||
disable("hangupButton");
|
||||
});
|
||||
|
||||
|
||||
var callerPending = null;
|
||||
|
||||
easyrtc.setCallCancelled( function(easyrtcid){
|
||||
if( easyrtcid === callerPending) {
|
||||
document.getElementById('acceptCallBox').style.display = "none";
|
||||
callerPending = false;
|
||||
}
|
||||
});
|