openvidu-components: Subscribed to participants after session is created

This commit is contained in:
csantosm 2022-08-05 13:50:22 +02:00
parent 28cc1b44b7
commit 56c6a3044e
2 changed files with 6 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import { TokenModel, ParticipantService, ParticipantAbstractModel } from "openvi
@Component({
selector: "app-root",
template: `
<ov-videoconference [tokens]="tokens">
<ov-videoconference [tokens]="tokens" (onSessionCreated)="subscribeToParticipants()">
<div *ovLayout>
<div class="container">
<div class="item" *ngFor="let stream of localParticipant | streams">
@ -48,7 +48,6 @@ export class AppComponent implements OnInit {
constructor(private httpClient: HttpClient, private participantService: ParticipantService) { }
async ngOnInit() {
this.subscribeToParticipants();
this.tokens = {
webcam: await this.getToken(),
screen: await this.getToken()
@ -75,12 +74,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

@ -7,7 +7,7 @@ import { ParticipantAbstractModel, ParticipantService, TokenModel } from "openvi
@Component({
selector: 'app-root',
template: `
<ov-videoconference [tokens]="tokens" [toolbarDisplaySessionName]="false">
<ov-videoconference [tokens]="tokens" [toolbarDisplaySessionName]="false" (onSessionCreated)="subscribeToParticipants()">
<div *ovParticipantsPanel id="my-panel">
<ul id="local">
<li>{{localParticipant.nickname}}</li>
@ -50,7 +50,6 @@ export class AppComponent implements OnInit {
) { }
async ngOnInit() {
this.subscribeToParticipants();
this.tokens = {
webcam: await this.getToken(),
screen: await this.getToken()
@ -78,12 +77,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.
*/