From 3641e323e32aedd4342810bb75fb05a7d8eb4ed6 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Fri, 22 Sep 2017 16:05:34 +0200 Subject: [PATCH] openvidu-server dashboard improved --- .../src/angular/frontend/package.json | 2 +- .../dashboard/dashboard.component.css | 10 +- .../dashboard/dashboard.component.html | 1 + .../dashboard/dashboard.component.ts | 41 +- .../resources/static/inline.bundle.js.map | 2 +- .../src/main/resources/static/main.bundle.js | 3528 ++++-- .../main/resources/static/main.bundle.js.map | 2 +- .../main/resources/static/polyfills.bundle.js | 1160 +- .../resources/static/polyfills.bundle.js.map | 2 +- .../main/resources/static/styles.bundle.js | 144 +- .../resources/static/styles.bundle.js.map | 2 +- .../main/resources/static/vendor.bundle.js | 10078 ++-------------- .../resources/static/vendor.bundle.js.map | 2 +- 13 files changed, 4238 insertions(+), 10736 deletions(-) diff --git a/openvidu-server/src/angular/frontend/package.json b/openvidu-server/src/angular/frontend/package.json index d75b373d..da4b596a 100644 --- a/openvidu-server/src/angular/frontend/package.json +++ b/openvidu-server/src/angular/frontend/package.json @@ -27,7 +27,7 @@ "hammerjs": "^2.0.8", "rxjs": "^5.1.0", "zone.js": "^0.8.4", - "openvidu-browser": "1.0.3-beta.1" + "openvidu-browser": "1.0.5-beta.3" }, "devDependencies": { "@angular/cli": "1.0.2", diff --git a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.css b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.css index a7a78a9f..900d7fd7 100644 --- a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.css +++ b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.css @@ -34,7 +34,7 @@ md-card-title button.yellow { md-spinner { position: absolute; - top: 55%; + top: 50%; left: 50%; transform: translate(-50%, -50%); } @@ -44,7 +44,7 @@ md-spinner { height: 100px; z-index: 1; position: absolute; - top: 55%; + top: 50%; left: 50%; transform: translate(-50%, -50%); } @@ -82,6 +82,10 @@ md-spinner { stroke-dashoffset: 0; } +#mirrored-video { + position: relative; +} + /* Pure CSS loader */ @@ -90,7 +94,7 @@ md-spinner { height: 100px; z-index: 1; position: absolute; - top: 55%; + top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); diff --git a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.html b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.html index 6ac266b8..ebc1680c 100644 --- a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.html +++ b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.html @@ -42,6 +42,7 @@ +

{{msg}}

diff --git a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.ts b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.ts index 2b216766..51b91d6e 100644 --- a/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.ts +++ b/openvidu-server/src/angular/frontend/src/app/components/dashboard/dashboard.component.ts @@ -28,6 +28,7 @@ export class DashboardComponent implements OnInit, OnDestroy { testButton = 'Test'; tickClass = 'trigger'; showSpinner = false; + msgChain = []; constructor(private infoService: InfoService, public dialog: MdDialog) { // Subscription to info updated event raised by InfoService @@ -78,12 +79,10 @@ export class DashboardComponent implements OnInit, OnDestroy { } connectToSession(mySessionId: string) { - let OV = new OpenVidu(); - this.session = OV.initSession(mySessionId); + this.msgChain = []; - this.session.on('streamCreated', (event) => { - this.session.subscribe(event.stream, 'mirrored-video'); - }); + const OV = new OpenVidu(); + this.session = OV.initSession(mySessionId); this.testStatus = 'CONNECTING'; this.testButton = 'Testing...'; @@ -99,19 +98,28 @@ export class DashboardComponent implements OnInit, OnDestroy { quality: 'MEDIUM' }); - publisherRemote.on('videoElementCreated', (video) => { - - this.showSpinner = true; - - video.element.addEventListener('playing', () => { - console.warn('PLAYING!!'); - this.testButton = 'End test'; - this.testStatus = 'PLAYING'; - this.showSpinner = false; - }); + publisherRemote.on('accessAllowed', () => { + this.msgChain.push('Camera access allowed'); }); - publisherRemote.stream.subscribeToMyRemote(); + 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 @@ -139,6 +147,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.testButton = 'Test'; this.showSpinner = false; this.info = []; + this.msgChain = []; } scrollToBottom(): void { diff --git a/openvidu-server/src/main/resources/static/inline.bundle.js.map b/openvidu-server/src/main/resources/static/inline.bundle.js.map index 7c356906..107c8d68 100644 --- a/openvidu-server/src/main/resources/static/inline.bundle.js.map +++ b/openvidu-server/src/main/resources/static/inline.bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap aa555f663a3f2029c244"],"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,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;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\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\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\t4: 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\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 \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn Promise.resolve();\n\n \t\t// an Promise means \"currently loading\".\n \t\tif(installedChunks[chunkId]) {\n \t\t\treturn installedChunks[chunkId][2];\n \t\t}\n \t\t// start chunk loading\n \t\tvar head = document.getElementsByTagName('head')[0];\n \t\tvar script = document.createElement('script');\n \t\tscript.type = 'text/javascript';\n \t\tscript.charset = 'utf-8';\n \t\tscript.async = true;\n \t\tscript.timeout = 120000;\n\n \t\tif (__webpack_require__.nc) {\n \t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t}\n \t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".chunk.js\";\n \t\tvar timeout = setTimeout(onScriptComplete, 120000);\n \t\tscript.onerror = script.onload = onScriptComplete;\n \t\tfunction onScriptComplete() {\n \t\t\t// avoid mem leaks in IE.\n \t\t\tscript.onerror = script.onload = null;\n \t\t\tclearTimeout(timeout);\n \t\t\tvar chunk = installedChunks[chunkId];\n \t\t\tif(chunk !== 0) {\n \t\t\t\tif(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));\n \t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t}\n \t\t};\n\n \t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\tinstalledChunks[chunkId] = [resolve, reject];\n \t\t});\n \t\tinstalledChunks[chunkId][2] = promise;\n\n \t\thead.appendChild(script);\n \t\treturn promise;\n \t};\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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\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 aa555f663a3f2029c244"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 4a4b51ff5527d3bfe79e"],"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,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;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\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\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\t4: 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\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 \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn Promise.resolve();\n\n \t\t// an Promise means \"currently loading\".\n \t\tif(installedChunks[chunkId]) {\n \t\t\treturn installedChunks[chunkId][2];\n \t\t}\n \t\t// start chunk loading\n \t\tvar head = document.getElementsByTagName('head')[0];\n \t\tvar script = document.createElement('script');\n \t\tscript.type = 'text/javascript';\n \t\tscript.charset = 'utf-8';\n \t\tscript.async = true;\n \t\tscript.timeout = 120000;\n\n \t\tif (__webpack_require__.nc) {\n \t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t}\n \t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".chunk.js\";\n \t\tvar timeout = setTimeout(onScriptComplete, 120000);\n \t\tscript.onerror = script.onload = onScriptComplete;\n \t\tfunction onScriptComplete() {\n \t\t\t// avoid mem leaks in IE.\n \t\t\tscript.onerror = script.onload = null;\n \t\t\tclearTimeout(timeout);\n \t\t\tvar chunk = installedChunks[chunkId];\n \t\t\tif(chunk !== 0) {\n \t\t\t\tif(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));\n \t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t}\n \t\t};\n\n \t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\tinstalledChunks[chunkId] = [resolve, reject];\n \t\t});\n \t\tinstalledChunks[chunkId][2] = promise;\n\n \t\thead.appendChild(script);\n \t\treturn promise;\n \t};\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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\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 4a4b51ff5527d3bfe79e"],"sourceRoot":""} \ No newline at end of file diff --git a/openvidu-server/src/main/resources/static/main.bundle.js b/openvidu-server/src/main/resources/static/main.bundle.js index 1c9bd020..a58fab9e 100644 --- a/openvidu-server/src/main/resources/static/main.bundle.js +++ b/openvidu-server/src/main/resources/static/main.bundle.js @@ -1,548 +1,6 @@ webpackJsonp([1,4],{ -/***/ 104: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var EventEmitter = __webpack_require__(52); -var kurentoUtils = __webpack_require__(277); -var adapter = __webpack_require__(175); -if (window) { - window["adapter"] = adapter; -} -function jq(id) { - return id.replace(/(@|:|\.|\[|\]|,)/g, "\\$1"); -} -function show(id) { - document.getElementById(jq(id)).style.display = 'block'; -} -function hide(id) { - document.getElementById(jq(id)).style.display = 'none'; -} -var Stream = (function () { - function Stream(openVidu, local, room, options) { - var _this = this; - this.openVidu = openVidu; - this.local = local; - this.room = room; - this.ee = new EventEmitter(); - this.videoElements = []; - this.elements = []; - this.showMyRemote = false; - this.localMirrored = false; - this.chanId = 0; - this.dataChannelOpened = false; - this.audioOnly = false; - this.isReady = false; - this.isVideoELementCreated = false; - this.accessIsAllowed = false; - this.accessIsDenied = false; - if (options.id) { - this.id = options.id; - } - else { - this.id = "webcam"; - } - this.connection = options.connection; - 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; - this.audioOnly = options.audioOnly || false; - this.addEventListener('src-added', function (srcEvent) { - _this.videoSrc = srcEvent.src; - if (_this.video) - _this.video.src = srcEvent.src; - console.warn("Videosrc [" + srcEvent.src + "] added to stream [" + _this.getId() + "]"); - }); - } - Stream.prototype.emitSrcEvent = function (wrstream) { - this.ee.emitEvent('src-added', [{ - src: URL.createObjectURL(wrstream) - }]); - }; - Stream.prototype.emitStreamReadyEvent = function () { - this.ee.emitEvent('stream-ready'), [{}]; - }; - Stream.prototype.getVideoSrc = function () { - return this.videoSrc; - }; - Stream.prototype.removeVideo = function (parentElement) { - if (typeof parentElement === "string") { - document.getElementById(parentElement).removeChild(this.video); - } - else if (parentElement instanceof Element) { - parentElement.removeChild(this.video); - } - else if (!parentElement) { - if (document.getElementById(this.parentId)) { - document.getElementById(this.parentId).removeChild(this.video); - } - } - }; - Stream.prototype.getVideoElement = function () { - return this.video; - }; - Stream.prototype.setVideoElement = function (video) { - this.video = video; - }; - Stream.prototype.getRecvVideo = function () { - return this.recvVideo; - }; - Stream.prototype.getRecvAudio = function () { - return this.recvAudio; - }; - Stream.prototype.subscribeToMyRemote = function () { - this.showMyRemote = true; - }; - Stream.prototype.displayMyRemote = function () { - return this.showMyRemote; - }; - Stream.prototype.mirrorLocalStream = function (wr) { - this.showMyRemote = true; - this.localMirrored = true; - if (wr) { - this.wrStream = wr; - this.emitSrcEvent(this.wrStream); - } - }; - Stream.prototype.isLocalMirrored = function () { - return this.localMirrored; - }; - Stream.prototype.getChannelName = function () { - return this.getId() + '_' + this.chanId++; - }; - Stream.prototype.isDataChannelEnabled = function () { - return this.dataChannel; - }; - Stream.prototype.isDataChannelOpened = function () { - return this.dataChannelOpened; - }; - Stream.prototype.onDataChannelOpen = function (event) { - console.log('Data channel is opened'); - this.dataChannelOpened = true; - }; - Stream.prototype.onDataChannelClosed = function (event) { - console.log('Data channel is closed'); - this.dataChannelOpened = false; - }; - Stream.prototype.sendData = function (data) { - if (this.wp === undefined) { - throw new Error('WebRTC peer has not been created yet'); - } - if (!this.dataChannelOpened) { - throw new Error('Data channel is not opened'); - } - console.log("Sending through data channel: " + data); - this.wp.send(data); - }; - Stream.prototype.getWrStream = function () { - return this.wrStream; - }; - Stream.prototype.getWebRtcPeer = function () { - return this.wp; - }; - Stream.prototype.addEventListener = function (eventName, listener) { - this.ee.addListener(eventName, listener); - }; - Stream.prototype.addOnceEventListener = function (eventName, listener) { - this.ee.addOnceListener(eventName, listener); - }; - Stream.prototype.removeListener = function (eventName) { - this.ee.removeAllListeners(eventName); - }; - Stream.prototype.showSpinner = function (spinnerParentId) { - var progress = document.createElement('div'); - progress.id = 'progress-' + this.getId(); - progress.style.background = "center transparent url('img/spinner.gif') no-repeat"; - var spinnerParent = document.getElementById(spinnerParentId); - if (spinnerParent) { - spinnerParent.appendChild(progress); - } - }; - Stream.prototype.hideSpinner = function (spinnerId) { - spinnerId = (spinnerId === undefined) ? this.getId() : spinnerId; - hide('progress-' + spinnerId); - }; - Stream.prototype.playOnlyVideo = function (parentElement, thumbnailId) { - // TO-DO: check somehow if the stream is audio only, so the element created is