openvidu/openvidu-testapp/src/app/app.component.ts

36 lines
917 B
TypeScript
Raw Normal View History

2017-09-26 18:13:00 +02:00
import { Component } from '@angular/core';
import { Router } from '@angular/router';
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 {
openviduURL = 'https://' + window.location.hostname + ':4443/';
openviduSecret = 'MY_SECRET';
2017-09-26 18:13:00 +02:00
constructor(private router: Router, private openviduParamsService: OpenviduParamsService) { }
updateUrl(url) {
this.openviduURL = url;
this.updateParams();
}
updateSecret(secret) {
this.openviduSecret = secret;
this.updateParams();
}
updateParams() {
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
}
}