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: + +![OpenVidu structure](https://drive.google.com/uc?export=view&id=0B61cQ4sbhmWScEVBaG00N3l4N00) + + + - **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: ` +
+

{{stream.getId()}}

+ +
` +}) +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 00000000..8081c7ce Binary files /dev/null and b/openvidu-ng-testapp/src/favicon.ico differ diff --git a/openvidu-ng-testapp/src/index.html b/openvidu-ng-testapp/src/index.html new file mode 100644 index 00000000..08101d16 --- /dev/null +++ b/openvidu-ng-testapp/src/index.html @@ -0,0 +1,14 @@ + + + + + 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 00000000..c13f8038 Binary files /dev/null and b/openvidu-server/src/main/resources/keystore.jks differ diff --git a/openvidu-test/.project b/openvidu-test/.project index e6856744..15865489 100644 --- a/openvidu-test/.project +++ b/openvidu-test/.project @@ -15,8 +15,14 @@ + + org.springframework.ide.eclipse.core.springbuilder + + + + org.springframework.ide.eclipse.core.springnature org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature