David Zhao

fixed sample app to publish audio

@@ -23,7 +23,6 @@ class CallViewModel( @@ -23,7 +23,6 @@ class CallViewModel(
23 val room: LiveData<Room> = mutableRoom 23 val room: LiveData<Room> = mutableRoom
24 private val mutableRemoteParticipants = MutableLiveData<List<RemoteParticipant>>() 24 private val mutableRemoteParticipants = MutableLiveData<List<RemoteParticipant>>()
25 val remoteParticipants: LiveData<List<RemoteParticipant>> = mutableRemoteParticipants 25 val remoteParticipants: LiveData<List<RemoteParticipant>> = mutableRemoteParticipants
26 - private val participants = HashMap<String, LiveData<RemoteParticipant>>()  
27 26
28 init { 27 init {
29 viewModelScope.launch { 28 viewModelScope.launch {
@@ -31,16 +30,10 @@ class CallViewModel( @@ -31,16 +30,10 @@ class CallViewModel(
31 application, 30 application,
32 url, 31 url,
33 token, 32 token,
34 - ConnectOptions(false), 33 + ConnectOptions(true),
35 this@CallViewModel 34 this@CallViewModel
36 ) 35 )
37 updateParticipants(room) 36 updateParticipants(room)
38 - for (p in room.remoteParticipants.values) {  
39 - if (p.identity == null) {  
40 - continue  
41 - }  
42 - participants[p.identity!!] = MutableLiveData(p)  
43 - }  
44 mutableRoom.value = room 37 mutableRoom.value = room
45 } 38 }
46 } 39 }
@@ -54,10 +47,6 @@ class CallViewModel( @@ -54,10 +47,6 @@ class CallViewModel(
54 ) 47 )
55 } 48 }
56 49
57 - fun getParticipantObservable(identity: String): LiveData<RemoteParticipant>? {  
58 - return participants[identity]  
59 - }  
60 -  
61 override fun onCleared() { 50 override fun onCleared() {
62 super.onCleared() 51 super.onCleared()
63 mutableRoom.value?.disconnect() 52 mutableRoom.value?.disconnect()
@@ -72,8 +61,6 @@ class CallViewModel( @@ -72,8 +61,6 @@ class CallViewModel(
72 participant: RemoteParticipant 61 participant: RemoteParticipant
73 ) { 62 ) {
74 updateParticipants(room) 63 updateParticipants(room)
75 - participants[participant.identity!!] = MutableLiveData(participant)  
76 -  
77 } 64 }
78 65
79 override fun onParticipantDisconnected( 66 override fun onParticipantDisconnected(
@@ -81,7 +68,6 @@ class CallViewModel( @@ -81,7 +68,6 @@ class CallViewModel(
81 participant: RemoteParticipant 68 participant: RemoteParticipant
82 ) { 69 ) {
83 updateParticipants(room) 70 updateParticipants(room)
84 - participants.remove(participant.identity!!)  
85 } 71 }
86 72
87 override fun onFailedToConnect(room: Room, error: Exception) { 73 override fun onFailedToConnect(room: Room, error: Exception) {