From 7b19ee51cf36698dd11eec2e2227c51fea5a0093 Mon Sep 17 00:00:00 2001
From: pabloFuente
Date: Wed, 8 Mar 2017 16:50:29 +0100
Subject: [PATCH 1/2] Initial commit
---
README.md | 101 +++++++++++++++
.../src/main/resources/package.json | 3 +-
openvidu-demo/.project | 12 ++
openvidu-ng-testapp/.angular-cli.json | 57 +++++++++
openvidu-ng-testapp/.editorconfig | 13 ++
openvidu-ng-testapp/.gitignore | 41 +++++++
openvidu-ng-testapp/README.md | 27 ++++
openvidu-ng-testapp/e2e/app.e2e-spec.ts | 14 +++
openvidu-ng-testapp/e2e/app.po.ts | 11 ++
openvidu-ng-testapp/e2e/tsconfig.e2e.json | 19 +++
openvidu-ng-testapp/karma.conf.js | 44 +++++++
openvidu-ng-testapp/package.json | 48 ++++++++
openvidu-ng-testapp/protractor.conf.js | 30 +++++
.../src/app/app.component.html | 24 ++++
openvidu-ng-testapp/src/app/app.component.ts | 94 ++++++++++++++
openvidu-ng-testapp/src/app/app.module.ts | 21 ++++
openvidu-ng-testapp/src/app/index.ts | 2 +
.../src/app/stream.component.ts | 48 ++++++++
openvidu-ng-testapp/src/assets/.gitkeep | 0
openvidu-ng-testapp/src/assets/.npmignore | 0
.../src/environments/environment.prod.ts | 3 +
.../src/environments/environment.ts | 8 ++
openvidu-ng-testapp/src/favicon.ico | Bin 0 -> 5430 bytes
openvidu-ng-testapp/src/index.html | 14 +++
openvidu-ng-testapp/src/main.ts | 12 ++
openvidu-ng-testapp/src/polyfills.ts | 19 +++
openvidu-ng-testapp/src/styles.css | 1 +
openvidu-ng-testapp/src/test.ts | 34 +++++
openvidu-ng-testapp/src/tsconfig.app.json | 22 ++++
openvidu-ng-testapp/src/tsconfig.spec.json | 26 ++++
openvidu-ng-testapp/src/typings.d.ts | 5 +
openvidu-ng-testapp/tsconfig.json | 16 +++
openvidu-ng-testapp/tslint.json | 116 ++++++++++++++++++
openvidu-server/.project | 12 ++
.../src/main/resources/application.properties | 6 +
.../src/main/resources/keystore.jks | Bin 0 -> 2232 bytes
openvidu-test/.project | 6 +
37 files changed, 908 insertions(+), 1 deletion(-)
create mode 100644 openvidu-ng-testapp/.angular-cli.json
create mode 100644 openvidu-ng-testapp/.editorconfig
create mode 100644 openvidu-ng-testapp/.gitignore
create mode 100644 openvidu-ng-testapp/README.md
create mode 100644 openvidu-ng-testapp/e2e/app.e2e-spec.ts
create mode 100644 openvidu-ng-testapp/e2e/app.po.ts
create mode 100644 openvidu-ng-testapp/e2e/tsconfig.e2e.json
create mode 100644 openvidu-ng-testapp/karma.conf.js
create mode 100644 openvidu-ng-testapp/package.json
create mode 100644 openvidu-ng-testapp/protractor.conf.js
create mode 100644 openvidu-ng-testapp/src/app/app.component.html
create mode 100644 openvidu-ng-testapp/src/app/app.component.ts
create mode 100644 openvidu-ng-testapp/src/app/app.module.ts
create mode 100644 openvidu-ng-testapp/src/app/index.ts
create mode 100644 openvidu-ng-testapp/src/app/stream.component.ts
create mode 100644 openvidu-ng-testapp/src/assets/.gitkeep
create mode 100644 openvidu-ng-testapp/src/assets/.npmignore
create mode 100644 openvidu-ng-testapp/src/environments/environment.prod.ts
create mode 100644 openvidu-ng-testapp/src/environments/environment.ts
create mode 100644 openvidu-ng-testapp/src/favicon.ico
create mode 100644 openvidu-ng-testapp/src/index.html
create mode 100644 openvidu-ng-testapp/src/main.ts
create mode 100644 openvidu-ng-testapp/src/polyfills.ts
create mode 100644 openvidu-ng-testapp/src/styles.css
create mode 100644 openvidu-ng-testapp/src/test.ts
create mode 100644 openvidu-ng-testapp/src/tsconfig.app.json
create mode 100644 openvidu-ng-testapp/src/tsconfig.spec.json
create mode 100644 openvidu-ng-testapp/src/typings.d.ts
create mode 100644 openvidu-ng-testapp/tsconfig.json
create mode 100644 openvidu-ng-testapp/tslint.json
create mode 100644 openvidu-server/src/main/resources/application.properties
create mode 100644 openvidu-server/src/main/resources/keystore.jks
diff --git a/README.md b/README.md
index 79d824bd..82f4cdb9 100644
--- a/README.md
+++ b/README.md
@@ -8,3 +8,104 @@ for multimedia applications.
OpenVidu and Kurento are licensed under Apache License v2.
OpenVidu was forked from [KurentoRoom project](https://github.com/Kurento/kurento-room).
+
+
+Developing OpenVidu
+===================
+
+First of all, you will need these packages:
+
+```sudo apt-get update```
+
+**node**
+```sudo apt-get install nodejs```
+
+**npm**
+```sudo apt-get install npm```
+
+**maven**
+```sudo apt-get install maven```
+
+**angular-cli**
+```sudo npm install -g @angular/cli```
+
+**typescript**
+```sudo npm install -g typescript```
+
+
+OpenVidu structure
+------------------
+
+OpenVidu is composed by several modules which require some interconnections in order to have an easy and effortless development.
+
+Here's a simple summary about the structure of OpenVidu:
+
+
+
+
+ - **Kurento Media Server**: External module which provides the low-level functionalities related to the media transmission.
+How to *install* and *run* KMS in your development machine:
+
+```
+echo "deb http://ubuntu.kurento.org trusty kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
+wget -O - http://ubuntu.kurento.org/kurento.gpg.key | sudo apt-key add -
+sudo apt-get update
+sudo apt-get install kurento-media-server-6.0
+```
+
+```
+sudo service kurento-media-server-6.0 start
+sudo service kurento-media-server-6.0 stop
+```
+
+[Here](http://doc-kurento.readthedocs.io/en/stable/installation_guide.html) you can check the Kurento's official documentation.
+
+ - [**openvidu-browser**](https://github.com/pabloFuente/openvidu/tree/master/openvidu-browser): Javascript library used to connect the application with openvidu-server
+ - [**openvidu-server**](https://github.com/pabloFuente/openvidu/tree/master/openvidu-server): Java API which provides the connection with Kurento Media Server
+ - **app**: The application that makes use of OpenVidu. In this repo, [**openvidu-ng-testapp**](https://github.com/pabloFuente/openvidu/tree/master/openvidu-ng-testapp).
+
+
+Setup for development
+------------------
+After installing Kurento Media Server and forking or downloading the repo, these are the necessary steps to start developing **openvidu-ng-testapp**:
+
+```
+sudo service kurento-media-server-6.0 start
+```
+
+**/openvidu/openvidu-browser/src/main/resources**
+```
+npm install
+npm link
+```
+**/openvidu/openvidu-ng-testapp**
+```
+npm install
+npm link openvidu-browser
+ng serve
+```
+**/openvidu**
+```
+mvn install -DskipTests=true
+```
+**/openvidu/openvidu-server**
+```
+mvn compile exec:java -Dexec.mainClass="org.openvidu.server.OpenViduServer"
+```
+At these point, you can start modifying *openvidu-ng-testapp*, *openvidu-browser* or *openvidu-server*.
+
+ - *openvidu-ng-testapp*: the previous "ng serve" command will take care of refreshing the browser's page whenever any change takes place.
+ - *openvidu-browser*: after modifying any typescript file, you will need to run the following command to update your changes (*typescript* package is necessary):
+
+ **/openvidu/openvidu-browser/src/main/resources/ts**
+ ```
+ tsc
+ ```
+ - *openvidu-server*: after modifying any file, there is no other alternative but to re-launch the java application if you want to update your changes.
+
+ **/openvidu/openvidu-server**
+ ```
+ mvn compile exec:java -Dexec.mainClass="org.openvidu.server.OpenViduServer"
+ ```
+
+
diff --git a/openvidu-browser/src/main/resources/package.json b/openvidu-browser/src/main/resources/package.json
index 1052ff6d..3f5eb7d8 100644
--- a/openvidu-browser/src/main/resources/package.json
+++ b/openvidu-browser/src/main/resources/package.json
@@ -7,7 +7,8 @@
"scripts": {
"browserify": "cd ts && watchify Main.ts -p [ tsify ] --exclude kurento-browser-extensions --debug -o ../static/js/OpenVidu.js -v",
"test": "echo \"Error: no test specified\" && exit 1",
- "prepublish": "cd ts && tsc"
+ "prepublish": "cd ts && tsc",
+ "developing": "cd ts && tsc -w"
},
"author": "",
"license": "Apache-2.0",
diff --git a/openvidu-demo/.project b/openvidu-demo/.project
index f160dbb4..c3498075 100644
--- a/openvidu-demo/.project
+++ b/openvidu-demo/.project
@@ -5,6 +5,11 @@
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
org.eclipse.jdt.core.javabuilder
@@ -15,9 +20,16 @@
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+ org.springframework.ide.eclipse.core.springnature
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
diff --git a/openvidu-ng-testapp/.angular-cli.json b/openvidu-ng-testapp/.angular-cli.json
new file mode 100644
index 00000000..55bd2927
--- /dev/null
+++ b/openvidu-ng-testapp/.angular-cli.json
@@ -0,0 +1,57 @@
+{
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
+ "project": {
+ "name": "openvidu-ng-testapp"
+ },
+ "apps": [
+ {
+ "root": "src",
+ "outDir": "dist",
+ "assets": [
+ "assets",
+ "favicon.ico"
+ ],
+ "index": "index.html",
+ "main": "main.ts",
+ "polyfills": "polyfills.ts",
+ "test": "test.ts",
+ "tsconfig": "tsconfig.app.json",
+ "testTsconfig": "tsconfig.spec.json",
+ "prefix": "app",
+ "styles": [
+ "styles.css"
+ ],
+ "scripts": [],
+ "environmentSource": "environments/environment.ts",
+ "environments": {
+ "dev": "environments/environment.ts",
+ "prod": "environments/environment.prod.ts"
+ }
+ }
+ ],
+ "e2e": {
+ "protractor": {
+ "config": "./protractor.conf.js"
+ }
+ },
+ "lint": [
+ {
+ "project": "src/tsconfig.app.json"
+ },
+ {
+ "project": "src/tsconfig.spec.json"
+ },
+ {
+ "project": "e2e/tsconfig.e2e.json"
+ }
+ ],
+ "test": {
+ "karma": {
+ "config": "./karma.conf.js"
+ }
+ },
+ "defaults": {
+ "styleExt": "css",
+ "component": {}
+ }
+}
diff --git a/openvidu-ng-testapp/.editorconfig b/openvidu-ng-testapp/.editorconfig
new file mode 100644
index 00000000..6e87a003
--- /dev/null
+++ b/openvidu-ng-testapp/.editorconfig
@@ -0,0 +1,13 @@
+# Editor configuration, see http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+max_line_length = off
+trim_trailing_whitespace = false
diff --git a/openvidu-ng-testapp/.gitignore b/openvidu-ng-testapp/.gitignore
new file mode 100644
index 00000000..8ce87385
--- /dev/null
+++ b/openvidu-ng-testapp/.gitignore
@@ -0,0 +1,41 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+
+# compiled output
+/dist
+/tmp
+
+# dependencies
+/node_modules
+
+# IDEs and editors
+/.idea
+.project
+.classpath
+.c9/
+*.launch
+.settings/
+*.sublime-workspace
+
+# IDE - VSCode
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+
+# misc
+/.sass-cache
+/connect.lock
+/coverage/*
+/libpeerconnection.log
+npm-debug.log
+testem.log
+/typings
+
+# e2e
+/e2e/*.js
+/e2e/*.map
+
+#System Files
+.DS_Store
+Thumbs.db
diff --git a/openvidu-ng-testapp/README.md b/openvidu-ng-testapp/README.md
new file mode 100644
index 00000000..0157fda7
--- /dev/null
+++ b/openvidu-ng-testapp/README.md
@@ -0,0 +1,27 @@
+# OpenviduNgTestapp
+
+This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0-rc.1.
+
+## Development server
+Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+
+## Code scaffolding
+
+Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
+
+## Build
+
+Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
+
+## Running unit tests
+
+Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
+
+## Running end-to-end tests
+
+Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
+Before running the tests make sure you are serving the app via `ng serve`.
+
+## Further help
+
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/openvidu-ng-testapp/e2e/app.e2e-spec.ts b/openvidu-ng-testapp/e2e/app.e2e-spec.ts
new file mode 100644
index 00000000..950be7ad
--- /dev/null
+++ b/openvidu-ng-testapp/e2e/app.e2e-spec.ts
@@ -0,0 +1,14 @@
+import { OpenviduNgTestappPage } from './app.po';
+
+describe('openvidu-ng-testapp App', () => {
+ let page: OpenviduNgTestappPage;
+
+ beforeEach(() => {
+ page = new OpenviduNgTestappPage();
+ });
+
+ it('should display message saying app works', () => {
+ page.navigateTo();
+ expect(page.getParagraphText()).toEqual('app works!');
+ });
+});
diff --git a/openvidu-ng-testapp/e2e/app.po.ts b/openvidu-ng-testapp/e2e/app.po.ts
new file mode 100644
index 00000000..06b2b502
--- /dev/null
+++ b/openvidu-ng-testapp/e2e/app.po.ts
@@ -0,0 +1,11 @@
+import { browser, element, by } from 'protractor';
+
+export class OpenviduNgTestappPage {
+ navigateTo() {
+ return browser.get('/');
+ }
+
+ getParagraphText() {
+ return element(by.css('app-root h1')).getText();
+ }
+}
diff --git a/openvidu-ng-testapp/e2e/tsconfig.e2e.json b/openvidu-ng-testapp/e2e/tsconfig.e2e.json
new file mode 100644
index 00000000..74c2bca1
--- /dev/null
+++ b/openvidu-ng-testapp/e2e/tsconfig.e2e.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": [
+ "es2016"
+ ],
+ "outDir": "../dist/out-tsc-e2e",
+ "module": "commonjs",
+ "target": "es6",
+ "types":[
+ "jasmine",
+ "node"
+ ]
+ }
+}
diff --git a/openvidu-ng-testapp/karma.conf.js b/openvidu-ng-testapp/karma.conf.js
new file mode 100644
index 00000000..84b4cd5a
--- /dev/null
+++ b/openvidu-ng-testapp/karma.conf.js
@@ -0,0 +1,44 @@
+// Karma configuration file, see link for more information
+// https://karma-runner.github.io/0.13/config/configuration-file.html
+
+module.exports = function (config) {
+ config.set({
+ basePath: '',
+ frameworks: ['jasmine', '@angular/cli'],
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-chrome-launcher'),
+ require('karma-jasmine-html-reporter'),
+ require('karma-coverage-istanbul-reporter'),
+ require('@angular/cli/plugins/karma')
+ ],
+ client:{
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
+ },
+ files: [
+ { pattern: './src/test.ts', watched: false }
+ ],
+ preprocessors: {
+ './src/test.ts': ['@angular/cli']
+ },
+ mime: {
+ 'text/x-typescript': ['ts','tsx']
+ },
+ coverageIstanbulReporter: {
+ reports: [ 'html', 'lcovonly' ],
+ fixWebpackSourcePaths: true
+ },
+ angularCli: {
+ environment: 'dev'
+ },
+ reporters: config.angularCli && config.angularCli.codeCoverage
+ ? ['progress', 'coverage-istanbul']
+ : ['progress', 'kjhtml'],
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: true,
+ browsers: ['Chrome'],
+ singleRun: false
+ });
+};
diff --git a/openvidu-ng-testapp/package.json b/openvidu-ng-testapp/package.json
new file mode 100644
index 00000000..c8129f97
--- /dev/null
+++ b/openvidu-ng-testapp/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "openvidu-ng-testapp",
+ "version": "0.0.0",
+ "license": "MIT",
+ "scripts": {
+ "ng": "ng",
+ "start": "ng serve",
+ "build": "ng build",
+ "test": "ng test",
+ "lint": "ng lint",
+ "e2e": "ng e2e"
+ },
+ "private": true,
+ "dependencies": {
+ "@angular/common": "^2.4.0",
+ "@angular/compiler": "^2.4.0",
+ "@angular/core": "^2.4.0",
+ "@angular/forms": "^2.4.0",
+ "@angular/http": "^2.4.0",
+ "@angular/platform-browser": "^2.4.0",
+ "@angular/platform-browser-dynamic": "^2.4.0",
+ "@angular/router": "^3.4.0",
+ "core-js": "^2.4.1",
+ "rxjs": "^5.1.0",
+ "ts-helpers": "^1.1.1",
+ "zone.js": "^0.7.6",
+ "openvidu-browser": "0.0.2"
+ },
+ "devDependencies": {
+ "@angular/cli": "1.0.0-rc.1",
+ "@angular/compiler-cli": "^2.4.0",
+ "@types/jasmine": "2.5.38",
+ "@types/node": "~6.0.60",
+ "codelyzer": "~2.0.0",
+ "jasmine-core": "~2.5.2",
+ "jasmine-spec-reporter": "~3.2.0",
+ "karma": "~1.4.1",
+ "karma-chrome-launcher": "~2.0.0",
+ "karma-cli": "~1.0.1",
+ "karma-jasmine": "~1.1.0",
+ "karma-jasmine-html-reporter": "^0.2.2",
+ "karma-coverage-istanbul-reporter": "^0.2.0",
+ "protractor": "~5.1.0",
+ "ts-node": "~2.0.0",
+ "tslint": "~4.4.2",
+ "typescript": "~2.0.0"
+ }
+}
diff --git a/openvidu-ng-testapp/protractor.conf.js b/openvidu-ng-testapp/protractor.conf.js
new file mode 100644
index 00000000..1c5e1e5a
--- /dev/null
+++ b/openvidu-ng-testapp/protractor.conf.js
@@ -0,0 +1,30 @@
+// Protractor configuration file, see link for more information
+// https://github.com/angular/protractor/blob/master/lib/config.ts
+
+const { SpecReporter } = require('jasmine-spec-reporter');
+
+exports.config = {
+ allScriptsTimeout: 11000,
+ specs: [
+ './e2e/**/*.e2e-spec.ts'
+ ],
+ capabilities: {
+ 'browserName': 'chrome'
+ },
+ directConnect: true,
+ baseUrl: 'http://localhost:4200/',
+ framework: 'jasmine',
+ jasmineNodeOpts: {
+ showColors: true,
+ defaultTimeoutInterval: 30000,
+ print: function() {}
+ },
+ beforeLaunch: function() {
+ require('ts-node').register({
+ project: 'e2e/tsconfig.e2e.json'
+ });
+ },
+ onPrepare() {
+ jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
+ }
+};
diff --git a/openvidu-ng-testapp/src/app/app.component.html b/openvidu-ng-testapp/src/app/app.component.html
new file mode 100644
index 00000000..b607fe69
--- /dev/null
+++ b/openvidu-ng-testapp/src/app/app.component.html
@@ -0,0 +1,24 @@
+
+
Join a video session
+
+
+
+
+
{{sessionId}}
+
+
+
+
+
\ No newline at end of file
diff --git a/openvidu-ng-testapp/src/app/app.component.ts b/openvidu-ng-testapp/src/app/app.component.ts
new file mode 100644
index 00000000..9c48c43d
--- /dev/null
+++ b/openvidu-ng-testapp/src/app/app.component.ts
@@ -0,0 +1,94 @@
+import { Component } from '@angular/core';
+import { OpenVidu, Session, Stream } from 'openvidu-browser';
+
+@Component({
+ selector: 'app-root',
+ templateUrl: './app.component.html'
+})
+export class AppComponent {
+
+ private openVidu: OpenVidu;
+
+ //Join form
+ sessionId: string;
+ participantId: string;
+
+ //Session
+ session: Session;
+ streams: Stream[] = [];
+
+ constructor() {
+ this.generateParticipantInfo();
+ window.onbeforeunload = () => {
+ this.openVidu.close(true);
+ }
+ }
+
+ private generateParticipantInfo(){
+ this.sessionId = "SessionA";
+ this.participantId = "Participant"+Math.floor(Math.random() * 100);
+ }
+
+ private addVideoTag(stream:Stream){
+ console.log("Stream added");
+ this.streams.push(stream);
+ }
+
+ private removeVideoTag(stream:Stream){
+ console.log("Stream removed");
+ this.streams.slice(this.streams.indexOf(stream), 1);
+ }
+
+ joinSession() {
+
+ this.openVidu = new OpenVidu("wss://127.0.0.1:8443/");
+
+ this.openVidu.connect((error, openVidu) => {
+
+ if (error)
+ return console.log(error);
+
+ let camera = openVidu.getCamera();
+
+ camera.requestCameraAccess((error, camera) => {
+
+ if (error)
+ return console.log(error);
+
+ var sessionOptions = {
+ sessionId: this.sessionId,
+ participantId: this.participantId
+ }
+
+ openVidu.joinSession(sessionOptions, (error, session) => {
+
+ if (error)
+ return console.log(error);
+
+ this.session = session;
+
+ this.addVideoTag(camera);
+
+ camera.publish();
+
+ session.addEventListener("stream-added", streamEvent => {
+ this.addVideoTag(streamEvent.stream);
+ });
+
+ session.addEventListener("stream-removed", streamEvent => {
+ this.removeVideoTag(streamEvent.stream);
+ });
+
+ });
+ });
+ });
+ }
+
+ leaveSession() {
+ this.session = null;
+ this.streams = [];
+ this.openVidu.close(true);
+ this.generateParticipantInfo();
+ }
+
+}
diff --git a/openvidu-ng-testapp/src/app/app.module.ts b/openvidu-ng-testapp/src/app/app.module.ts
new file mode 100644
index 00000000..9d91ef7c
--- /dev/null
+++ b/openvidu-ng-testapp/src/app/app.module.ts
@@ -0,0 +1,21 @@
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { HttpModule } from '@angular/http';
+
+import { AppComponent } from './app.component';
+import { StreamComponent } from "./stream.component";
+
+@NgModule({
+ declarations: [
+ AppComponent, StreamComponent
+ ],
+ imports: [
+ BrowserModule,
+ FormsModule,
+ HttpModule
+ ],
+ providers: [],
+ bootstrap: [AppComponent]
+})
+export class AppModule { }
diff --git a/openvidu-ng-testapp/src/app/index.ts b/openvidu-ng-testapp/src/app/index.ts
new file mode 100644
index 00000000..875bdb2f
--- /dev/null
+++ b/openvidu-ng-testapp/src/app/index.ts
@@ -0,0 +1,2 @@
+export * from './app.component';
+export * from './app.module';
diff --git a/openvidu-ng-testapp/src/app/stream.component.ts b/openvidu-ng-testapp/src/app/stream.component.ts
new file mode 100644
index 00000000..15339a4d
--- /dev/null
+++ b/openvidu-ng-testapp/src/app/stream.component.ts
@@ -0,0 +1,48 @@
+import { Component, OnInit, Input, ViewChild } from '@angular/core';
+import { Stream, Session } from 'openvidu-browser';
+import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
+
+@Component({
+ selector: 'stream',
+ styles: [`
+ .participant {
+ float: left;
+ width: 20%;
+ margin: 10px;
+ }
+ .participant video {
+ width: 100%;
+ height: auto;
+ }`],
+ template: `
+ `
+})
+export class StreamComponent {
+
+ @Input()
+ stream: Stream;
+
+ videoSrc: SafeUrl;
+
+ constructor(private sanitizer: DomSanitizer) { }
+
+ ngOnInit() {
+
+ let int = setInterval(() => {
+ if (this.stream.getWrStream()) {
+ this.videoSrc = this.sanitizer.bypassSecurityTrustUrl(
+ URL.createObjectURL(this.stream.getWrStream()));
+ console.log("Video tag src=" + this.videoSrc);
+ clearInterval(int);
+ }
+ }, 1000);
+
+ //this.stream.addEventListener('src-added', () => {
+ // this.video.src = this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(this.stream.getWrStream())).toString();
+ //});
+ }
+
+}
\ No newline at end of file
diff --git a/openvidu-ng-testapp/src/assets/.gitkeep b/openvidu-ng-testapp/src/assets/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/openvidu-ng-testapp/src/assets/.npmignore b/openvidu-ng-testapp/src/assets/.npmignore
new file mode 100644
index 00000000..e69de29b
diff --git a/openvidu-ng-testapp/src/environments/environment.prod.ts b/openvidu-ng-testapp/src/environments/environment.prod.ts
new file mode 100644
index 00000000..3612073b
--- /dev/null
+++ b/openvidu-ng-testapp/src/environments/environment.prod.ts
@@ -0,0 +1,3 @@
+export const environment = {
+ production: true
+};
diff --git a/openvidu-ng-testapp/src/environments/environment.ts b/openvidu-ng-testapp/src/environments/environment.ts
new file mode 100644
index 00000000..00313f16
--- /dev/null
+++ b/openvidu-ng-testapp/src/environments/environment.ts
@@ -0,0 +1,8 @@
+// The file contents for the current environment will overwrite these during build.
+// The build system defaults to the dev environment which uses `environment.ts`, but if you do
+// `ng build --env=prod` then `environment.prod.ts` will be used instead.
+// The list of which env maps to which file can be found in `angular-cli.json`.
+
+export const environment = {
+ production: false
+};
diff --git a/openvidu-ng-testapp/src/favicon.ico b/openvidu-ng-testapp/src/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517
GIT binary patch
literal 5430
zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n
z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975;
z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G
zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${
zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s
z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL
zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK
zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8
z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb
zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul
ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW
zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l
z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf
zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y
z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{
zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|(
z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS-
zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn=
z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky
humW;*g7R+&|Ledvc-
+
+
+
+ OpenviduNg2Example
+
+
+
+
+
+
+ Loading...
+
+
diff --git a/openvidu-ng-testapp/src/main.ts b/openvidu-ng-testapp/src/main.ts
new file mode 100644
index 00000000..5c3c5204
--- /dev/null
+++ b/openvidu-ng-testapp/src/main.ts
@@ -0,0 +1,12 @@
+import './polyfills.ts';
+
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { enableProdMode } from '@angular/core';
+import { environment } from './environments/environment';
+import { AppModule } from './app/';
+
+if (environment.production) {
+ enableProdMode();
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/openvidu-ng-testapp/src/polyfills.ts b/openvidu-ng-testapp/src/polyfills.ts
new file mode 100644
index 00000000..3b4c55b0
--- /dev/null
+++ b/openvidu-ng-testapp/src/polyfills.ts
@@ -0,0 +1,19 @@
+// This file includes polyfills needed by Angular 2 and is loaded before
+// the app. You can add your own extra polyfills to this file.
+import 'core-js/es6/symbol';
+import 'core-js/es6/object';
+import 'core-js/es6/function';
+import 'core-js/es6/parse-int';
+import 'core-js/es6/parse-float';
+import 'core-js/es6/number';
+import 'core-js/es6/math';
+import 'core-js/es6/string';
+import 'core-js/es6/date';
+import 'core-js/es6/array';
+import 'core-js/es6/regexp';
+import 'core-js/es6/map';
+import 'core-js/es6/set';
+import 'core-js/es6/reflect';
+
+import 'core-js/es7/reflect';
+import 'zone.js/dist/zone';
diff --git a/openvidu-ng-testapp/src/styles.css b/openvidu-ng-testapp/src/styles.css
new file mode 100644
index 00000000..e50a47e7
--- /dev/null
+++ b/openvidu-ng-testapp/src/styles.css
@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */
\ No newline at end of file
diff --git a/openvidu-ng-testapp/src/test.ts b/openvidu-ng-testapp/src/test.ts
new file mode 100644
index 00000000..7727c8e6
--- /dev/null
+++ b/openvidu-ng-testapp/src/test.ts
@@ -0,0 +1,34 @@
+import './polyfills.ts';
+
+import 'zone.js/dist/long-stack-trace-zone';
+import 'zone.js/dist/proxy.js';
+import 'zone.js/dist/sync-test';
+import 'zone.js/dist/jasmine-patch';
+import 'zone.js/dist/async-test';
+import 'zone.js/dist/fake-async-test';
+
+// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
+declare var __karma__: any;
+declare var require: any;
+
+// Prevent Karma from running prematurely.
+__karma__.loaded = function () {};
+
+
+Promise.all([
+ System.import('@angular/core/testing'),
+ System.import('@angular/platform-browser-dynamic/testing')
+])
+ // First, initialize the Angular testing environment.
+ .then(([testing, testingBrowser]) => {
+ testing.getTestBed().initTestEnvironment(
+ testingBrowser.BrowserDynamicTestingModule,
+ testingBrowser.platformBrowserDynamicTesting()
+ );
+ })
+ // Then we find all the tests.
+ .then(() => require.context('./', true, /\.spec\.ts/))
+ // And load the modules.
+ .then(context => context.keys().map(context))
+ // Finally, start Karma to run the tests.
+ .then(__karma__.start, __karma__.error);
diff --git a/openvidu-ng-testapp/src/tsconfig.app.json b/openvidu-ng-testapp/src/tsconfig.app.json
new file mode 100644
index 00000000..9f12c4b8
--- /dev/null
+++ b/openvidu-ng-testapp/src/tsconfig.app.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": [
+ "es2016",
+ "dom"
+ ],
+ "outDir": "../out-tsc/app",
+ "target": "es5",
+ "module": "es2015",
+ "baseUrl": "",
+ "types": []
+ },
+ "exclude": [
+ "test.ts",
+ "**/*.spec.ts"
+ ]
+}
diff --git a/openvidu-ng-testapp/src/tsconfig.spec.json b/openvidu-ng-testapp/src/tsconfig.spec.json
new file mode 100644
index 00000000..6c5160e1
--- /dev/null
+++ b/openvidu-ng-testapp/src/tsconfig.spec.json
@@ -0,0 +1,26 @@
+{
+ "compilerOptions": {
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": [
+ "es2016"
+ ],
+ "outDir": "../out-tsc/spec",
+ "module": "commonjs",
+ "target": "es6",
+ "baseUrl": "",
+ "types": [
+ "jasmine",
+ "node"
+ ]
+ },
+ "files": [
+ "test.ts"
+ ],
+ "include": [
+ "**/*.spec.ts"
+ ]
+}
diff --git a/openvidu-ng-testapp/src/typings.d.ts b/openvidu-ng-testapp/src/typings.d.ts
new file mode 100644
index 00000000..a73f5867
--- /dev/null
+++ b/openvidu-ng-testapp/src/typings.d.ts
@@ -0,0 +1,5 @@
+// Typings reference file, see links for more information
+// https://github.com/typings/typings
+// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
+
+declare var System: any;
diff --git a/openvidu-ng-testapp/tsconfig.json b/openvidu-ng-testapp/tsconfig.json
new file mode 100644
index 00000000..7a9d9e8c
--- /dev/null
+++ b/openvidu-ng-testapp/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compileOnSave": false,
+ "compilerOptions": {
+ "outDir": "./dist/out-tsc",
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "target": "es5",
+ "lib": [
+ "es2016",
+ "dom"
+ ]
+ }
+}
diff --git a/openvidu-ng-testapp/tslint.json b/openvidu-ng-testapp/tslint.json
new file mode 100644
index 00000000..9113f136
--- /dev/null
+++ b/openvidu-ng-testapp/tslint.json
@@ -0,0 +1,116 @@
+{
+ "rulesDirectory": [
+ "node_modules/codelyzer"
+ ],
+ "rules": {
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "import-blacklist": [true, "rxjs"],
+ "import-spacing": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "interface-over-type-literal": true,
+ "label-position": true,
+ "max-line-length": [
+ true,
+ 140
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-variable": true,
+ "no-empty": false,
+ "no-empty-interface": true,
+ "no-eval": true,
+ "no-inferrable-types": [true, "ignore-params"],
+ "no-shadowed-variable": true,
+ "no-string-literal": false,
+ "no-string-throw": true,
+ "no-switch-case-fall-through": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "object-literal-sort-keys": false,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "prefer-const": true,
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "radix": true,
+ "semicolon": [
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "typeof-compare": true,
+ "unified-signatures": true,
+ "variable-name": false,
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ],
+
+ "directive-selector": [true, "attribute", "app", "camelCase"],
+ "component-selector": [true, "element", "app", "kebab-case"],
+ "use-input-property-decorator": true,
+ "use-output-property-decorator": true,
+ "use-host-property-decorator": true,
+ "no-input-rename": true,
+ "no-output-rename": true,
+ "use-life-cycle-interface": true,
+ "use-pipe-transform-interface": true,
+ "component-class-suffix": true,
+ "directive-class-suffix": true,
+ "no-access-missing-member": true,
+ "templates-use-public": true,
+ "invoke-injectable": true
+ }
+}
diff --git a/openvidu-server/.project b/openvidu-server/.project
index f6cef2d4..bb71ae66 100644
--- a/openvidu-server/.project
+++ b/openvidu-server/.project
@@ -5,11 +5,21 @@
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
org.eclipse.jdt.core.javabuilder
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
org.eclipse.m2e.core.maven2Builder
@@ -17,7 +27,9 @@
+ org.springframework.ide.eclipse.core.springnature
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
diff --git a/openvidu-server/src/main/resources/application.properties b/openvidu-server/src/main/resources/application.properties
new file mode 100644
index 00000000..fc204d58
--- /dev/null
+++ b/openvidu-server/src/main/resources/application.properties
@@ -0,0 +1,6 @@
+server.port: 8443
+server.address: 0.0.0.0
+server.ssl.key-store: classpath:keystore.jks
+server.ssl.key-store-password: kurento
+server.ssl.keyStoreType: JKS
+server.ssl.keyAlias: kurento-selfsigned
diff --git a/openvidu-server/src/main/resources/keystore.jks b/openvidu-server/src/main/resources/keystore.jks
new file mode 100644
index 0000000000000000000000000000000000000000..c13f80382cbaef224ef743a75c779297f2547b43
GIT binary patch
literal 2232
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
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+ org.springframework.ide.eclipse.core.springnature
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
From b63b99710af7590a93c2b71b72231d903806e06a Mon Sep 17 00:00:00 2001
From: pabloFuente
Date: Thu, 9 Mar 2017 19:46:07 +0100
Subject: [PATCH 2/2] Join session with audio and/or video off. Toggle both
during session
---
README.md | 14 ++--
.../src/main/resources/ts/Participant.ts | 3 +-
.../src/main/resources/ts/Stream.ts | 16 +++++
.../src/app/app.component.html | 10 +++
openvidu-ng-testapp/src/app/app.component.ts | 67 ++++++++++++++++---
openvidu-server/pom.xml | 15 +++++
6 files changed, 111 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 82f4cdb9..b34f325b 100644
--- a/README.md
+++ b/README.md
@@ -90,8 +90,15 @@ mvn install -DskipTests=true
```
**/openvidu/openvidu-server**
```
-mvn compile exec:java -Dexec.mainClass="org.openvidu.server.OpenViduServer"
+mvn compile exec:java
```
+
+*(or if you prefer you can just run the Java application in your favourite IDE)*
+
+
+----------
+
+
At these point, you can start modifying *openvidu-ng-testapp*, *openvidu-browser* or *openvidu-server*.
- *openvidu-ng-testapp*: the previous "ng serve" command will take care of refreshing the browser's page whenever any change takes place.
@@ -105,7 +112,6 @@ At these point, you can start modifying *openvidu-ng-testapp*, *openvidu-browser
**/openvidu/openvidu-server**
```
- mvn compile exec:java -Dexec.mainClass="org.openvidu.server.OpenViduServer"
+ mvn compile exec:java
```
-
-
+*(or re-launch the Java application in your IDE)*
diff --git a/openvidu-browser/src/main/resources/ts/Participant.ts b/openvidu-browser/src/main/resources/ts/Participant.ts
index 29957e93..7c849510 100644
--- a/openvidu-browser/src/main/resources/ts/Participant.ts
+++ b/openvidu-browser/src/main/resources/ts/Participant.ts
@@ -33,7 +33,8 @@ export class Participant {
recvAudio: ( streamOptions.recvAudio == undefined ? true : streamOptions.recvAudio ),
audio: streamOptions.audio,
video: streamOptions.video,
- data: streamOptions.data
+ data: streamOptions.data,
+ mediaConstraints: streamOptions.mediaConstraints
}
let stream = new Stream( openVidu, false, room, streamOpts );
diff --git a/openvidu-browser/src/main/resources/ts/Stream.ts b/openvidu-browser/src/main/resources/ts/Stream.ts
index 53429b2d..a8995745 100644
--- a/openvidu-browser/src/main/resources/ts/Stream.ts
+++ b/openvidu-browser/src/main/resources/ts/Stream.ts
@@ -35,6 +35,7 @@ export interface StreamOptions {
video: boolean;
audio: boolean;
data: boolean;
+ mediaConstraints: any;
}
export interface VideoOptions {
@@ -55,6 +56,9 @@ export class Stream {
private speechEvent: any;
private recvVideo: any;
private recvAudio: any;
+ private sendVideo: boolean;
+ private sendAudio: boolean;
+ private mediaConstraints: any;
private showMyRemote = false;
private localMirrored = false;
private chanId = 0;
@@ -73,6 +77,9 @@ export class Stream {
this.recvVideo = options.recvVideo;
this.recvAudio = options.recvAudio;
this.dataChannel = options.data || false;
+ this.sendVideo = options.video;
+ this.sendAudio = options.audio;
+ this.mediaConstraints = options.mediaConstraints;
}
getRecvVideo() {
@@ -262,6 +269,9 @@ export class Stream {
};
navigator.getUserMedia( constraints, userStream => {
+ userStream.getAudioTracks()[0].enabled = this.sendAudio;
+ userStream.getVideoTracks()[0].enabled = this.sendVideo;
+
this.wrStream = userStream;
callback(undefined, this);
}, error => {
@@ -316,9 +326,15 @@ export class Stream {
private initWebRtcPeer( sdpOfferCallback ) {
if ( this.local ) {
+
+ let userMediaConstraints = {
+ audio : this.sendAudio,
+ video : this.sendVideo
+ }
let options: any = {
videoStream: this.wrStream,
+ mediaConstraints: userMediaConstraints,
onicecandidate: this.participant.sendIceCandidate.bind( this.participant ),
}
diff --git a/openvidu-ng-testapp/src/app/app.component.html b/openvidu-ng-testapp/src/app/app.component.html
index b607fe69..e45f6506 100644
--- a/openvidu-ng-testapp/src/app/app.component.html
+++ b/openvidu-ng-testapp/src/app/app.component.html
@@ -9,6 +9,12 @@
+
+ Send video
+
+
+ Send audio
+
@@ -18,6 +24,10 @@
{{sessionId}}
+
Toggle your video
+
Toggle your audio
diff --git a/openvidu-ng-testapp/src/app/app.component.ts b/openvidu-ng-testapp/src/app/app.component.ts
index 9c48c43d..82a5a6f2 100644
--- a/openvidu-ng-testapp/src/app/app.component.ts
+++ b/openvidu-ng-testapp/src/app/app.component.ts
@@ -9,14 +9,20 @@ export class AppComponent {
private openVidu: OpenVidu;
- //Join form
+ // Join form
sessionId: string;
participantId: string;
- //Session
+ // Session
session: Session;
streams: Stream[] = [];
+ // Publish options
+ joinWithVideo: boolean = true;
+ joinWithAudio: boolean = true;
+ toggleVideo: boolean;
+ toggleAudio: boolean;
+
constructor() {
this.generateParticipantInfo();
window.onbeforeunload = () => {
@@ -24,22 +30,35 @@ export class AppComponent {
}
}
- private generateParticipantInfo(){
+ private generateParticipantInfo() {
this.sessionId = "SessionA";
- this.participantId = "Participant"+Math.floor(Math.random() * 100);
+ this.participantId = "Participant" + Math.floor(Math.random() * 100);
}
- private addVideoTag(stream:Stream){
+ private addVideoTag(stream: Stream) {
console.log("Stream added");
this.streams.push(stream);
}
- private removeVideoTag(stream:Stream){
+ private removeVideoTag(stream: Stream) {
console.log("Stream removed");
this.streams.slice(this.streams.indexOf(stream), 1);
}
joinSession() {
+ var cameraOptions = {
+ audio: this.joinWithAudio,
+ video: this.joinWithVideo,
+ data: true,
+ mediaConstraints: {}
+ }
+ this.joinSessionShared(cameraOptions);
+ }
+
+ joinSessionShared(cameraOptions) {
+
+ this.toggleVideo = this.joinWithVideo;
+ this.toggleAudio = this.joinWithAudio;
this.openVidu = new OpenVidu("wss://127.0.0.1:8443/");
@@ -48,7 +67,7 @@ export class AppComponent {
if (error)
return console.log(error);
- let camera = openVidu.getCamera();
+ let camera = openVidu.getCamera(cameraOptions);
camera.requestCameraAccess((error, camera) => {
@@ -72,11 +91,11 @@ export class AppComponent {
camera.publish();
session.addEventListener("stream-added", streamEvent => {
- this.addVideoTag(streamEvent.stream);
+ this.addVideoTag(streamEvent.stream);
});
session.addEventListener("stream-removed", streamEvent => {
- this.removeVideoTag(streamEvent.stream);
+ this.removeVideoTag(streamEvent.stream);
});
});
@@ -91,4 +110,34 @@ export class AppComponent {
this.generateParticipantInfo();
}
+ updateToggleVideo(event) {
+ this.toggleVideoTrack(event.target.checked);
+ let msg = (event.target.checked) ? 'Publishing video...' : 'Unpublishing video...'
+ console.log(msg);
+ }
+
+ updateToggleAudio(event) {
+ this.toggleAudioTrack(event.target.checked);
+ let msg = (event.target.checked) ? 'Publishing audio...' : 'Unpublishing audio...'
+ console.log(msg);
+ }
+
+ toggleVideoTrack(activate: boolean) {
+ this.openVidu.getCamera().getWebRtcPeer().videoEnabled = activate;
+ }
+
+ toggleAudioTrack(activate: boolean) {
+ this.openVidu.getCamera().getWebRtcPeer().audioEnabled = activate;
+ }
+
+ publishVideoAudio() {
+ this.toggleVideoTrack(true);
+ this.toggleAudioTrack(true);
+ }
+
+ unpublishVideoAudio() {
+ this.toggleVideoTrack(false);
+ this.toggleAudioTrack(false);
+ }
+
}
diff --git a/openvidu-server/pom.xml b/openvidu-server/pom.xml
index 7425c7a2..2caafac7 100644
--- a/openvidu-server/pom.xml
+++ b/openvidu-server/pom.xml
@@ -45,6 +45,11 @@
http://www.kurento.org
+
+
+
+ org.openvidu.server.OpenViduServer
+
@@ -60,6 +65,16 @@
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+
+ ${start-class}
+
+
+