Skip to content

Commit 2de621c

Browse files
committed
update
1 parent 907fe3b commit 2de621c

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/app/app.component.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<div class="container-fluid">
2-
32
<form [formGroup]="conversationFormGroup" (ngSubmit)="getOrcreateConversation()">
43
<mat-form-field>
54
<mat-label>Conversation Name</mat-label>
65
<input type="text" matInput placeholder="abcd" formControlName="name">
76
</mat-form-field>&nbsp;
87
<button mat-raised-button color="primary" type="submit" [disabled]="!conversationFormGroup.valid" title="Get Or Create Conversation">GetOrCreateConversation</button>
98
</form>
10-
119
<div id="conference">
1210
<div id="remote-container">
1311
</div>

src/app/app.component.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export class AppComponent {
2323
return this.conversationFormGroup.get('name') as FormControl;
2424
}
2525

26-
conversation: any;
27-
2826
getOrcreateConversation() {
2927
var localStream = null;
3028

@@ -43,16 +41,16 @@ export class AppComponent {
4341
//==============================
4442
// 3/ CREATE CONVERSATION
4543
//==============================
46-
this.conversation = session.getConversation(this.conversationNameFc.value);
44+
const conversation = session.getConversation(this.conversationNameFc.value);
4745

4846
//==========================================================
4947
// 4/ ADD EVENT LISTENER : WHEN NEW STREAM IS AVAILABLE IN CONVERSATION
5048
//==========================================================
51-
this.conversation.on('streamListChanged', (streamInfo) => {
49+
conversation.on('streamListChanged', (streamInfo: any) => {
5250
console.log("streamListChanged :", streamInfo);
5351
if (streamInfo.listEventType === 'added') {
5452
if (streamInfo.isRemote === true) {
55-
this.conversation.subscribeToMedia(streamInfo.streamId)
53+
conversation.subscribeToMedia(streamInfo.streamId)
5654
.then((stream) => {
5755
console.log('subscribeToMedia success');
5856
}).catch((err) => {
@@ -64,7 +62,7 @@ export class AppComponent {
6462
//=====================================================
6563
// 4 BIS/ ADD EVENT LISTENER : WHEN STREAM IS ADDED/REMOVED TO/FROM THE CONVERSATION
6664
//=====================================================
67-
this.conversation.on('streamAdded', (stream: any) => {
65+
conversation.on('streamAdded', (stream: any) => {
6866
stream.addInDiv('remote-container', 'remote-media-' + stream.streamId, {}, false);
6967
}).on('streamRemoved', (stream: any) => {
7068
stream.removeFromDiv('remote-container', 'remote-media-' + stream.streamId);
@@ -79,7 +77,7 @@ export class AppComponent {
7977
video: true
8078
}
8179
})
82-
.then((stream) => {
80+
.then((stream: any) => {
8381

8482
console.log('createStream :', stream);
8583

@@ -91,12 +89,12 @@ export class AppComponent {
9189
//==============================
9290
// 6/ JOIN CONVERSATION
9391
//==============================
94-
this.conversation.join()
92+
conversation.join()
9593
.then((response: any) => {
9694
//==============================
97-
// 7/ PUBLISH OWN STREAM
95+
// 7/ PUBLISH LOCAL STREAM
9896
//==============================
99-
this.conversation.publish(localStream);
97+
conversation.publish(localStream);
10098
}).catch((err) => {
10199
console.error('Conversation join error', err);
102100
});

src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4-
5-
import { AppComponent } from './app.component';
64
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
75
import { MatFormFieldModule } from '@angular/material/form-field';
86
import { MatInputModule } from '@angular/material/input';
97

8+
import { AppComponent } from './app.component';
9+
1010
@NgModule({
1111
declarations: [
1212
AppComponent

0 commit comments

Comments
 (0)