@@ -23,8 +23,6 @@ export class AppComponent {
23
23
return this . conversationFormGroup . get ( 'name' ) as FormControl ;
24
24
}
25
25
26
- conversation : any ;
27
-
28
26
getOrcreateConversation ( ) {
29
27
var localStream = null ;
30
28
@@ -43,16 +41,16 @@ export class AppComponent {
43
41
//==============================
44
42
// 3/ CREATE CONVERSATION
45
43
//==============================
46
- this . conversation = session . getConversation ( this . conversationNameFc . value ) ;
44
+ const conversation = session . getConversation ( this . conversationNameFc . value ) ;
47
45
48
46
//==========================================================
49
47
// 4/ ADD EVENT LISTENER : WHEN NEW STREAM IS AVAILABLE IN CONVERSATION
50
48
//==========================================================
51
- this . conversation . on ( 'streamListChanged' , ( streamInfo ) => {
49
+ conversation . on ( 'streamListChanged' , ( streamInfo : any ) => {
52
50
console . log ( "streamListChanged :" , streamInfo ) ;
53
51
if ( streamInfo . listEventType === 'added' ) {
54
52
if ( streamInfo . isRemote === true ) {
55
- this . conversation . subscribeToMedia ( streamInfo . streamId )
53
+ conversation . subscribeToMedia ( streamInfo . streamId )
56
54
. then ( ( stream ) => {
57
55
console . log ( 'subscribeToMedia success' ) ;
58
56
} ) . catch ( ( err ) => {
@@ -64,7 +62,7 @@ export class AppComponent {
64
62
//=====================================================
65
63
// 4 BIS/ ADD EVENT LISTENER : WHEN STREAM IS ADDED/REMOVED TO/FROM THE CONVERSATION
66
64
//=====================================================
67
- this . conversation . on ( 'streamAdded' , ( stream : any ) => {
65
+ conversation . on ( 'streamAdded' , ( stream : any ) => {
68
66
stream . addInDiv ( 'remote-container' , 'remote-media-' + stream . streamId , { } , false ) ;
69
67
} ) . on ( 'streamRemoved' , ( stream : any ) => {
70
68
stream . removeFromDiv ( 'remote-container' , 'remote-media-' + stream . streamId ) ;
@@ -79,7 +77,7 @@ export class AppComponent {
79
77
video : true
80
78
}
81
79
} )
82
- . then ( ( stream ) => {
80
+ . then ( ( stream : any ) => {
83
81
84
82
console . log ( 'createStream :' , stream ) ;
85
83
@@ -91,12 +89,12 @@ export class AppComponent {
91
89
//==============================
92
90
// 6/ JOIN CONVERSATION
93
91
//==============================
94
- this . conversation . join ( )
92
+ conversation . join ( )
95
93
. then ( ( response : any ) => {
96
94
//==============================
97
- // 7/ PUBLISH OWN STREAM
95
+ // 7/ PUBLISH LOCAL STREAM
98
96
//==============================
99
- this . conversation . publish ( localStream ) ;
97
+ conversation . publish ( localStream ) ;
100
98
} ) . catch ( ( err ) => {
101
99
console . error ( 'Conversation join error' , err ) ;
102
100
} ) ;
0 commit comments