mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: dashboard update to openvidu-browser Promise API
parent
4837c1402d
commit
6fad64db96
|
@ -132,63 +132,60 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|||
this.testStatus = 'CONNECTING';
|
||||
this.testButton = 'Testing...';
|
||||
|
||||
this.session.connect('token', (error) => {
|
||||
if (!error) {
|
||||
this.session.connect(null).then(() => {
|
||||
|
||||
this.testStatus = 'CONNECTED';
|
||||
this.testStatus = 'CONNECTED';
|
||||
|
||||
const publisherRemote = OV.initPublisher('mirrored-video', {
|
||||
audio: true,
|
||||
video: true,
|
||||
audioActive: true,
|
||||
videoActive: true,
|
||||
quality: 'MEDIUM'
|
||||
},
|
||||
e => {
|
||||
if (!!e) {
|
||||
console.error(e);
|
||||
}
|
||||
const publisherRemote = OV.initPublisher('mirrored-video', {
|
||||
publishAudio: true,
|
||||
publishVideo: true,
|
||||
resolution: '640x480'
|
||||
},
|
||||
e => {
|
||||
if (!!e) {
|
||||
console.error(e);
|
||||
}
|
||||
);
|
||||
|
||||
publisherRemote.on('accessAllowed', () => {
|
||||
this.msgChain.push('Camera access allowed');
|
||||
});
|
||||
|
||||
publisherRemote.on('accessDenied', () => {
|
||||
this.endTestVideo();
|
||||
this.msgChain.push('Camera access denied');
|
||||
});
|
||||
|
||||
publisherRemote.on('videoElementCreated', (video) => {
|
||||
this.showSpinner = true;
|
||||
this.msgChain.push('Video element created');
|
||||
});
|
||||
|
||||
publisherRemote.on('remoteVideoPlaying', (video) => {
|
||||
this.msgChain.push('Remote video playing');
|
||||
this.testButton = 'End test';
|
||||
this.testStatus = 'PLAYING';
|
||||
this.showSpinner = false;
|
||||
});
|
||||
|
||||
publisherRemote.subscribeToRemote();
|
||||
this.session.publish(publisherRemote);
|
||||
} else {
|
||||
if (error.code === 401) { // User unauthorized error. OpenVidu security is active
|
||||
this.endTestVideo();
|
||||
let dialogRef: MatDialogRef<CredentialsDialogComponent>;
|
||||
dialogRef = this.dialog.open(CredentialsDialogComponent);
|
||||
dialogRef.componentInstance.myReference = dialogRef;
|
||||
|
||||
dialogRef.afterClosed().subscribe(secret => {
|
||||
if (secret) {
|
||||
this.connectToSession('wss://' + location.hostname + ':4443/testSession?secret=' + secret);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
|
||||
publisherRemote.on('accessAllowed', () => {
|
||||
this.msgChain.push('Camera access allowed');
|
||||
});
|
||||
|
||||
publisherRemote.on('accessDenied', () => {
|
||||
this.endTestVideo();
|
||||
this.msgChain.push('Camera access denied');
|
||||
});
|
||||
|
||||
publisherRemote.on('videoElementCreated', (video) => {
|
||||
this.showSpinner = true;
|
||||
this.msgChain.push('Video element created');
|
||||
});
|
||||
|
||||
publisherRemote.on('remoteVideoPlaying', (video) => {
|
||||
this.msgChain.push('Remote video playing');
|
||||
this.testButton = 'End test';
|
||||
this.testStatus = 'PLAYING';
|
||||
this.showSpinner = false;
|
||||
});
|
||||
|
||||
publisherRemote.subscribeToRemote();
|
||||
this.session.publish(publisherRemote);
|
||||
|
||||
}).catch(error => {
|
||||
if (error.code === 401) { // User unauthorized error. OpenVidu security is active
|
||||
this.endTestVideo();
|
||||
let dialogRef: MatDialogRef<CredentialsDialogComponent>;
|
||||
dialogRef = this.dialog.open(CredentialsDialogComponent);
|
||||
dialogRef.componentInstance.myReference = dialogRef;
|
||||
|
||||
dialogRef.afterClosed().subscribe(secret => {
|
||||
if (secret) {
|
||||
this.connectToSession('wss://' + location.hostname + ':4443/testSession?secret=' + secret);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, OnDestroy, HostListener, ViewEncapsulation, ApplicationRef } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { OpenVidu, Session, Stream, Subscriber } from 'openvidu-browser';
|
||||
import { OpenVidu, Session, Stream, Subscriber, StreamEvent } from 'openvidu-browser';
|
||||
|
||||
import { OpenViduLayout } from '../openvidu-layout';
|
||||
|
||||
|
@ -52,22 +52,21 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.session = OV.initSession(fullSessionId);
|
||||
|
||||
this.session.on('streamCreated', (event) => {
|
||||
this.session.on('streamCreated', (event: StreamEvent) => {
|
||||
const subscriber: Subscriber = this.session.subscribe(event.stream, '');
|
||||
this.addRemoteStream(event.stream);
|
||||
});
|
||||
|
||||
this.session.on('streamDestroyed', (event) => {
|
||||
this.session.on('streamDestroyed', (event: StreamEvent) => {
|
||||
event.preventDefault();
|
||||
this.deleteRemoteStream(event.stream);
|
||||
this.openviduLayout.updateLayout();
|
||||
});
|
||||
|
||||
this.session.connect(null, (error) => {
|
||||
if (error) {
|
||||
this.session.connect(null)
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
this.openviduLayout = new OpenViduLayout();
|
||||
this.openviduLayout.initLayoutContainer(document.getElementById('layout'), {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["webpack/bootstrap 3c2551942fa92eb189e2"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3c2551942fa92eb189e2"],"sourceRoot":"webpack:///"}
|
||||
{"version":3,"sources":["webpack/bootstrap 61249b85238bdf352ff8"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 61249b85238bdf352ff8"],"sourceRoot":"webpack:///"}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue