Added dockerfile to openvidu-components tutorials

This commit is contained in:
Carlos Santos 2023-01-17 15:27:50 +01:00
parent 26cfa7d45c
commit 74ef061bdd
86 changed files with 1753 additions and 122 deletions

View File

@ -1,5 +1,4 @@
export const environment = {
production: true,
applicationServerUrl: '',
};

View File

@ -0,0 +1,2 @@
**/node_modules
**/.angular

View File

@ -0,0 +1,25 @@
FROM node:18.13.0-alpine3.17
ARG tutorial_name
COPY ./$tutorial_name ./$tutorial_name
WORKDIR /$tutorial_name
# Install openvidu-angular dependencies and build it for production
RUN npm install -g npm && \
npm install && \
npm run build:prod
# Copy openvidu-basic-node
RUN cp -r ./openvidu-basic-node /opt/ && \
rm -rf ../$tutorial_name
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,28 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME> <TUTORIAL_NAME>\""
exit 1
fi
if [ $# -eq 1 ]; then
echo "No tutorial argument provided. Usage: \"./create_image.sh <IMAGE_NAME> <TUTORIAL_NAME>\""
exit 1
fi
DIR="../"$2""
if [ -d "$DIR" ]; then
pushd ../
cp -r ../openvidu-basic-node ./"$2"
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true --build-arg tutorial_name=$2 -f docker/Dockerfile -t "$1" .
rm -rf ./"$2"/openvidu-basic-node
else
echo "Error: ${DIR} not found. Can not continue."
exit 1
fi

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node index.js "$*"

View File

@ -10,7 +10,6 @@ TUTORIALS=(
'openvidu-custom-participants-panel'
'openvidu-custom-stream'
'openvidu-custom-toolbar'
'openvidu-custom-toolbar'
'openvidu-custom-ui'
'openvidu-toggle-hand'
'openvidu-toolbar-buttons'

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,9 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel, PanelService, PanelType } from "openvidu-angular";
import { PanelService, PanelType, TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -49,7 +50,7 @@ import { TokenModel, PanelService, PanelType } from "openvidu-angular";
})
export class AppComponent {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "toolbar-additionalbtn-directive-example";
tokens!: TokenModel;
@ -89,12 +90,12 @@ export class AppComponent {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -39,7 +39,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -30,7 +31,7 @@ import { TokenModel } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "activities-panel-directive-example";
tokens!: TokenModel;
@ -50,12 +51,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,9 +1,10 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel, Signal } from "openvidu-angular";
import { Signal, TokenModel } from "openvidu-angular";
import { Session, SignalOptions } from "openvidu-browser";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -35,7 +36,7 @@ import { Session, SignalOptions } from "openvidu-browser";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "chat-panel-directive-example";
tokens!: TokenModel;
@ -75,12 +76,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Subscription, lastValueFrom } from "rxjs";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom, Subscription } from "rxjs";
import { TokenModel, ParticipantService, ParticipantAbstractModel } from "openvidu-angular";
import { ParticipantAbstractModel, ParticipantService, TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -35,7 +36,7 @@ import { TokenModel, ParticipantService, ParticipantAbstractModel } from "openvi
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'layout-directive-example';
tokens!: TokenModel;

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -33,7 +34,7 @@ import { TokenModel } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "panel-directive-example";
tokens!: TokenModel;
@ -53,12 +54,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel, OpenViduService } from "openvidu-angular";
import { OpenViduService, TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -23,7 +24,7 @@ import { TokenModel, OpenViduService } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "participants-panel-directive-example";
tokens!: TokenModel;
@ -50,12 +51,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-root',
@ -22,7 +23,7 @@ import { TokenModel } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'participants-panel-directive-example';
tokens!: TokenModel;
@ -42,12 +43,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Subscription, lastValueFrom } from "rxjs";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom, Subscription } from "rxjs";
import { ParticipantAbstractModel, ParticipantService, TokenModel } from "openvidu-angular";
@ -34,7 +34,7 @@ import { ParticipantAbstractModel, ParticipantService, TokenModel } from "openvi
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'participants-panel-directive-example';
tokens!: TokenModel;

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from '@angular/core';
import { lastValueFrom } from "rxjs";
import { TokenModel } from 'openvidu-angular';
@ -25,7 +25,7 @@ import { TokenModel } from 'openvidu-angular';
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'toolbar-directive-example';
tokens!: TokenModel;
@ -45,12 +45,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -42,7 +42,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -6,7 +6,7 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { OpenViduService, TokenModel } from "openvidu-angular";
@ -17,7 +17,7 @@ import { OpenViduService, TokenModel } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'toolbar-directive-example';
tokens!: TokenModel;
@ -50,12 +50,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -42,7 +42,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -0,0 +1 @@
docker/

View File

@ -0,0 +1,3 @@
SERVER_PORT=5000
OPENVIDU_URL=http://localhost:4443/
OPENVIDU_SECRET=MY_SECRET

View File

@ -0,0 +1,129 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

View File

@ -0,0 +1,30 @@
# openvidu-basic-node
This is a minimal OpenVidu server application sample built for Node with Express. Visit [Application server](https://docs.openvidu.io/en/stable/application-server/) documentation for further context.
It internally uses [openvidu-node-client SDK](https://docs.openvidu.io/en/stable/reference-docs/openvidu-node-client/).
## Prerequisites
- [Node](https://nodejs.org/es/download/)
## Run
Download repository
```
git clone git@github.com:OpenVidu/openvidu-tutorials.git
cd openvidu-tutorials/openvidu-basic-node
```
Install dependencies
```
npm install
```
Run the application
```
node index.js
```

View File

@ -0,0 +1,11 @@
FROM node:16-alpine3.16
# Copy openvidu-basic-node
COPY . /opt/openvidu-basic-node
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
ENTRYPOINT [ "node", "index.js" ]

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh X.Y.Z\""
exit 1
fi
pushd ../
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .

View File

@ -0,0 +1,57 @@
require("dotenv").config(!!process.env.CONFIG ? {path: process.env.CONFIG} : {});
var express = require("express");
var bodyParser = require("body-parser");
var http = require("http");
var OpenVidu = require("openvidu-node-client").OpenVidu;
var cors = require("cors");
var app = express();
// Environment variable: PORT where the node server is listening
var SERVER_PORT = process.env.SERVER_PORT || 5000;
// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.env.OPENVIDU_URL || 'http://localhost:4443';
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.env.OPENVIDU_SECRET || 'MY_SECRET';
// Enable CORS support
app.use(
cors({
origin: "*",
})
);
var server = http.createServer(app);
var openvidu = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
// Allow application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));
// Allow application/json
app.use(bodyParser.json());
// Serve static resources if available
app.use(express.static(__dirname + '/public'));
// Serve application
server.listen(SERVER_PORT, () => {
console.log("Application started on port: ", SERVER_PORT);
console.warn('Application server connecting to OpenVidu at ' + OPENVIDU_URL);
});
app.post("/api/sessions", async (req, res) => {
var session = await openvidu.createSession(req.body);
res.send(session.sessionId);
});
app.post("/api/sessions/:sessionId/connections", async (req, res) => {
var session = openvidu.activeSessions.find(
(s) => s.sessionId === req.params.sessionId
);
if (!session) {
res.status(404).send();
} else {
var connection = await session.createConnection(req.body);
res.send(connection.token);
}
});
process.on('uncaughtException', err => console.error(err));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
{
"name": "openvidu-basic-node",
"version": "2.25.0",
"main": "index.js",
"dependencies": {
"body-parser": "1.20.0",
"cors": "2.8.5",
"dotenv": "16.0.1",
"express": "4.18.1",
"openvidu-node-client": "2.25.0"
}
}

View File

@ -6,7 +6,7 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-root',
@ -11,7 +12,7 @@ import { TokenModel } from "openvidu-angular";
})
export class AppComponent {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'openvidu-custom-ui';
tokens!: TokenModel;
@ -31,12 +32,12 @@ export class AppComponent {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -5,9 +5,7 @@
"ng": "ng",
"start": "ng serve --configuration development",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,12 +1,13 @@
import { Component, OnInit } from "@angular/core";
import { animate, style, transition, trigger } from "@angular/animations";
import { HttpClient } from "@angular/common/http";
import { trigger, transition, style, animate } from "@angular/animations";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { ParticipantService, OpenViduService } from "openvidu-angular";
import { OpenViduService, ParticipantService } from "openvidu-angular";
import { ParticipantAppModel } from "./models/participant-app.model";
import { Session, SignalOptions } from "openvidu-browser";
import { environment } from 'src/environments/environment';
enum SignalApp {
HAND_TOGGLE = 'handToggle'
@ -31,7 +32,7 @@ enum SignalApp {
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
tokens: { webcam: string; screen: string };
hasHandRaised: boolean = false;
@ -91,12 +92,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel, OpenViduService, ParticipantService } from "openvidu-angular";
import { OpenViduService, ParticipantService, TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-root',
@ -22,7 +23,7 @@ import { TokenModel, OpenViduService, ParticipantService } from "openvidu-angula
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = 'toolbar-additionalbtn-directive-example';
tokens!: TokenModel;
@ -56,12 +57,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -66,7 +66,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",

View File

@ -5,7 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development"
"watch": "ng build --watch --configuration development",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"private": true,
"dependencies": {

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Component, OnInit } from "@angular/core";
import { lastValueFrom } from "rxjs";
import { TokenModel } from "openvidu-angular";
import { environment } from 'src/environments/environment';
@Component({
selector: "app-root",
@ -17,7 +18,7 @@ import { TokenModel } from "openvidu-angular";
})
export class AppComponent implements OnInit {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
sessionId = "toolbar-additionalPanelbtn";
tokens!: TokenModel;
@ -41,12 +42,12 @@ export class AppComponent implements OnInit {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*