2017-09-26 18:13:00 +02:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import { Router } from '@angular/router';
|
2017-09-30 13:48:40 +02:00
|
|
|
import { OpenviduParamsService } from './services/openvidu-params.service';
|
2017-09-26 18:13:00 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.css']
|
|
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
|
2018-11-21 14:32:59 +01:00
|
|
|
openviduURL = 'https://' + window.location.hostname + ':4443/';
|
2017-09-30 13:48:40 +02:00
|
|
|
openviduSecret = 'MY_SECRET';
|
2017-09-26 18:13:00 +02:00
|
|
|
|
2017-09-30 13:48:40 +02:00
|
|
|
constructor(private router: Router, private openviduParamsService: OpenviduParamsService) { }
|
|
|
|
|
|
|
|
updateUrl(url) {
|
|
|
|
this.openviduURL = url;
|
|
|
|
this.updateParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateSecret(secret) {
|
|
|
|
this.openviduSecret = secret;
|
|
|
|
this.updateParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateParams() {
|
2017-10-16 15:49:23 +02:00
|
|
|
let myUrl = this.openviduURL;
|
|
|
|
if (!(myUrl.substring(myUrl.length - 1) === '/')) {
|
|
|
|
myUrl += '/';
|
|
|
|
}
|
|
|
|
this.openviduParamsService.updateParams({ openviduUrl: myUrl, openviduSecret: this.openviduSecret });
|
2017-09-26 18:13:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|