davidliu
Committed by GitHub

Remove deprecated methods and unused classes (#356)

1 -/*  
2 - * Copyright 2023-2024 LiveKit, Inc.  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -  
17 -package io.livekit.android.room  
18 -  
19 -import android.content.Context  
20 -import android.hardware.camera2.CameraManager  
21 -import android.os.Handler  
22 -import android.os.Looper  
23 -import livekit.org.webrtc.Camera1Enumerator  
24 -import livekit.org.webrtc.Camera2Enumerator  
25 -  
26 -object DeviceManager {  
27 -  
28 - enum class Kind {  
29 - // Only camera input currently, audio input/output only has one option atm.  
30 - CAMERA,  
31 - }  
32 -  
33 - private val defaultDevices = mutableMapOf<Kind, String>()  
34 - private val listeners =  
35 - mutableMapOf<Kind, MutableList<OnDeviceAvailabilityChangeListener>>()  
36 -  
37 - private var hasSetupListeners = false  
38 -  
39 - @Synchronized  
40 - internal fun setupListenersIfNeeded(context: Context) {  
41 - if (hasSetupListeners) {  
42 - return  
43 - }  
44 -  
45 - hasSetupListeners = true  
46 - val cameraManager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager  
47 - cameraManager.registerAvailabilityCallback(  
48 - object : CameraManager.AvailabilityCallback() {  
49 - override fun onCameraAvailable(cameraId: String) {  
50 - notifyListeners(Kind.CAMERA)  
51 - }  
52 -  
53 - override fun onCameraUnavailable(cameraId: String) {  
54 - notifyListeners(Kind.CAMERA)  
55 - }  
56 -  
57 - override fun onCameraAccessPrioritiesChanged() {  
58 - notifyListeners(Kind.CAMERA)  
59 - }  
60 - },  
61 - Handler(Looper.getMainLooper()),  
62 - )  
63 - }  
64 -  
65 - fun getDefaultDevice(kind: Kind): String? {  
66 - return defaultDevices[kind]  
67 - }  
68 -  
69 - fun setDefaultDevice(kind: Kind, deviceId: String?) {  
70 - if (deviceId != null) {  
71 - defaultDevices[kind] = deviceId  
72 - } else {  
73 - defaultDevices.remove(kind)  
74 - }  
75 - }  
76 -  
77 - /**  
78 - * @return the list of device ids for [kind]  
79 - */  
80 - fun getDevices(context: Context, kind: Kind): List<String> {  
81 - return when (kind) {  
82 - Kind.CAMERA -> {  
83 - val cameraEnumerator = if (Camera2Enumerator.isSupported(context)) {  
84 - Camera2Enumerator(context)  
85 - } else {  
86 - Camera1Enumerator()  
87 - }  
88 - cameraEnumerator.deviceNames.toList()  
89 - }  
90 - }  
91 - }  
92 -  
93 - fun registerOnDeviceAvailabilityChange(  
94 - kind: Kind,  
95 - listener: OnDeviceAvailabilityChangeListener,  
96 - ) {  
97 - if (listeners[kind] == null) {  
98 - listeners[kind] = mutableListOf()  
99 - }  
100 - listeners[kind]!!.add(listener)  
101 - }  
102 -  
103 - fun unregisterOnDeviceAvailabilityChange(  
104 - kind: Kind,  
105 - listener: OnDeviceAvailabilityChangeListener,  
106 - ) {  
107 - listeners[kind]?.remove(listener)  
108 - }  
109 -  
110 - private fun notifyListeners(kind: Kind) {  
111 - listeners[kind]?.forEach {  
112 - it.onDeviceAvailabilityChanged(kind)  
113 - }  
114 - }  
115 -  
116 - interface OnDeviceAvailabilityChangeListener {  
117 - fun onDeviceAvailabilityChanged(kind: Kind)  
118 - }  
119 -}  
@@ -53,7 +53,6 @@ import livekit.LivekitModels @@ -53,7 +53,6 @@ import livekit.LivekitModels
53 import livekit.LivekitRtc 53 import livekit.LivekitRtc
54 import livekit.org.webrtc.* 54 import livekit.org.webrtc.*
55 import javax.inject.Named 55 import javax.inject.Named
56 -import kotlin.jvm.Throws  
57 56
58 class Room 57 class Room
59 @AssistedInject 58 @AssistedInject
@@ -101,9 +100,6 @@ constructor( @@ -101,9 +100,6 @@ constructor(
101 @JvmInline 100 @JvmInline
102 value class Sid(val sid: String) 101 value class Sid(val sid: String)
103 102
104 - @Deprecated("Use events instead.")  
105 - var listener: RoomListener? = null  
106 -  
107 /** 103 /**
108 * The session id of the room. 104 * The session id of the room.
109 * 105 *
@@ -287,7 +283,6 @@ constructor( @@ -287,7 +283,6 @@ constructor(
287 ) 283 )
288 284
289 is ParticipantEvent.MetadataChanged -> { 285 is ParticipantEvent.MetadataChanged -> {
290 - listener?.onMetadataChanged(it.participant, it.prevMetadata, this@Room)  
291 emitWhenConnected( 286 emitWhenConnected(
292 RoomEvent.ParticipantMetadataChanged( 287 RoomEvent.ParticipantMetadataChanged(
293 this@Room, 288 this@Room,
@@ -386,8 +381,7 @@ constructor( @@ -386,8 +381,7 @@ constructor(
386 } 381 }
387 382
388 if (!response.hasParticipant()) { 383 if (!response.hasParticipant()) {
389 - listener?.onFailedToConnect(this, RoomException.ConnectException("server didn't return any participants"))  
390 - return 384 + throw RoomException.ConnectException("server didn't return a local participant")
391 } 385 }
392 386
393 localParticipant.updateFromInfo(response.participant) 387 localParticipant.updateFromInfo(response.participant)
@@ -407,7 +401,6 @@ constructor( @@ -407,7 +401,6 @@ constructor(
407 } 401 }
408 402
409 mutableRemoteParticipants = newParticipants 403 mutableRemoteParticipants = newParticipants
410 - listener?.onParticipantDisconnected(this, removedParticipant)  
411 eventBus.postEvent(RoomEvent.ParticipantDisconnected(this, removedParticipant), coroutineScope) 404 eventBus.postEvent(RoomEvent.ParticipantDisconnected(this, removedParticipant), coroutineScope)
412 } 405 }
413 406
@@ -481,7 +474,6 @@ constructor( @@ -481,7 +474,6 @@ constructor(
481 ) 474 )
482 475
483 is ParticipantEvent.MetadataChanged -> { 476 is ParticipantEvent.MetadataChanged -> {
484 - listener?.onMetadataChanged(it.participant, it.prevMetadata, this@Room)  
485 emitWhenConnected( 477 emitWhenConnected(
486 RoomEvent.ParticipantMetadataChanged( 478 RoomEvent.ParticipantMetadataChanged(
487 this@Room, 479 this@Room,
@@ -553,7 +545,6 @@ constructor( @@ -553,7 +545,6 @@ constructor(
553 } 545 }
554 546
555 mutableActiveSpeakers = speakers.toList() 547 mutableActiveSpeakers = speakers.toList()
556 - listener?.onActiveSpeakersChanged(mutableActiveSpeakers, this)  
557 eventBus.postEvent(RoomEvent.ActiveSpeakersChanged(this, mutableActiveSpeakers), coroutineScope) 548 eventBus.postEvent(RoomEvent.ActiveSpeakersChanged(this, mutableActiveSpeakers), coroutineScope)
558 } 549 }
559 550
@@ -581,7 +572,6 @@ constructor( @@ -581,7 +572,6 @@ constructor(
581 .sortedBy { it.audioLevel } 572 .sortedBy { it.audioLevel }
582 573
583 mutableActiveSpeakers = updatedSpeakersList.toList() 574 mutableActiveSpeakers = updatedSpeakersList.toList()
584 - listener?.onActiveSpeakersChanged(mutableActiveSpeakers, this)  
585 eventBus.postEvent(RoomEvent.ActiveSpeakersChanged(this, mutableActiveSpeakers), coroutineScope) 575 eventBus.postEvent(RoomEvent.ActiveSpeakersChanged(this, mutableActiveSpeakers), coroutineScope)
586 } 576 }
587 577
@@ -625,8 +615,6 @@ constructor( @@ -625,8 +615,6 @@ constructor(
625 cleanupRoom() 615 cleanupRoom()
626 engine.close() 616 engine.close()
627 617
628 - listener?.onDisconnect(this, null)  
629 - listener = null  
630 localParticipant.dispose() 618 localParticipant.dispose()
631 619
632 // Ensure all observers see the disconnected before closing scope. 620 // Ensure all observers see the disconnected before closing scope.
@@ -742,7 +730,6 @@ constructor( @@ -742,7 +730,6 @@ constructor(
742 */ 730 */
743 override fun onEngineReconnected() { 731 override fun onEngineReconnected() {
744 state = State.CONNECTED 732 state = State.CONNECTED
745 - listener?.onReconnected(this)  
746 eventBus.postEvent(RoomEvent.Reconnected(this), coroutineScope) 733 eventBus.postEvent(RoomEvent.Reconnected(this), coroutineScope)
747 } 734 }
748 735
@@ -751,7 +738,6 @@ constructor( @@ -751,7 +738,6 @@ constructor(
751 */ 738 */
752 override fun onEngineReconnecting() { 739 override fun onEngineReconnecting() {
753 state = State.RECONNECTING 740 state = State.RECONNECTING
754 - listener?.onReconnecting(this)  
755 eventBus.postEvent(RoomEvent.Reconnecting(this), coroutineScope) 741 eventBus.postEvent(RoomEvent.Reconnecting(this), coroutineScope)
756 } 742 }
757 743
@@ -818,7 +804,6 @@ constructor( @@ -818,7 +804,6 @@ constructor(
818 } else { 804 } else {
819 val participant = getOrCreateRemoteParticipant(participantIdentity, info) 805 val participant = getOrCreateRemoteParticipant(participantIdentity, info)
820 if (isNewParticipant) { 806 if (isNewParticipant) {
821 - listener?.onParticipantConnected(this, participant)  
822 eventBus.postEvent(RoomEvent.ParticipantConnected(this, participant), coroutineScope) 807 eventBus.postEvent(RoomEvent.ParticipantConnected(this, participant), coroutineScope)
823 } else { 808 } else {
824 participant.updateFromInfo(info) 809 participant.updateFromInfo(info)
@@ -872,7 +857,6 @@ constructor( @@ -872,7 +857,6 @@ constructor(
872 val quality = ConnectionQuality.fromProto(info.quality) 857 val quality = ConnectionQuality.fromProto(info.quality)
873 val participant = getParticipantBySid(info.participantSid) ?: return 858 val participant = getParticipantBySid(info.participantSid) ?: return
874 participant.connectionQuality = quality 859 participant.connectionQuality = quality
875 - listener?.onConnectionQualityChanged(participant, quality)  
876 eventBus.postEvent(RoomEvent.ConnectionQualityChanged(this, participant, quality), coroutineScope) 860 eventBus.postEvent(RoomEvent.ConnectionQualityChanged(this, participant, quality), coroutineScope)
877 } 861 }
878 } 862 }
@@ -896,7 +880,6 @@ constructor( @@ -896,7 +880,6 @@ constructor(
896 null 880 null
897 } 881 }
898 882
899 - listener?.onDataReceived(data, participant, this)  
900 eventBus.postEvent(RoomEvent.DataReceived(this, data, participant, topic), coroutineScope) 883 eventBus.postEvent(RoomEvent.DataReceived(this, data, participant, topic), coroutineScope)
901 participant?.onDataReceived(data, topic) 884 participant?.onDataReceived(data, topic)
902 } 885 }
@@ -940,7 +923,6 @@ constructor( @@ -940,7 +923,6 @@ constructor(
940 * @suppress 923 * @suppress
941 */ 924 */
942 override fun onFailToConnect(error: Throwable) { 925 override fun onFailToConnect(error: Throwable) {
943 - listener?.onFailedToConnect(this, error)  
944 // scope will likely be closed already here, so force it out of scope. 926 // scope will likely be closed already here, so force it out of scope.
945 eventBus.tryPostEvent(RoomEvent.FailedToConnect(this, error)) 927 eventBus.tryPostEvent(RoomEvent.FailedToConnect(this, error))
946 } 928 }
@@ -1001,13 +983,11 @@ constructor( @@ -1001,13 +983,11 @@ constructor(
1001 983
1002 /** @suppress */ 984 /** @suppress */
1003 override fun onTrackMuted(publication: TrackPublication, participant: Participant) { 985 override fun onTrackMuted(publication: TrackPublication, participant: Participant) {
1004 - listener?.onTrackMuted(publication, participant, this)  
1005 eventBus.postEvent(RoomEvent.TrackMuted(this, publication, participant), coroutineScope) 986 eventBus.postEvent(RoomEvent.TrackMuted(this, publication, participant), coroutineScope)
1006 } 987 }
1007 988
1008 /** @suppress */ 989 /** @suppress */
1009 override fun onTrackUnmuted(publication: TrackPublication, participant: Participant) { 990 override fun onTrackUnmuted(publication: TrackPublication, participant: Participant) {
1010 - listener?.onTrackUnmuted(publication, participant, this)  
1011 eventBus.postEvent(RoomEvent.TrackUnmuted(this, publication, participant), coroutineScope) 991 eventBus.postEvent(RoomEvent.TrackUnmuted(this, publication, participant), coroutineScope)
1012 } 992 }
1013 993
@@ -1015,7 +995,6 @@ constructor( @@ -1015,7 +995,6 @@ constructor(
1015 * @suppress 995 * @suppress
1016 */ 996 */
1017 override fun onTrackUnpublished(publication: RemoteTrackPublication, participant: RemoteParticipant) { 997 override fun onTrackUnpublished(publication: RemoteTrackPublication, participant: RemoteParticipant) {
1018 - listener?.onTrackUnpublished(publication, participant, this)  
1019 eventBus.postEvent(RoomEvent.TrackUnpublished(this, publication, participant), coroutineScope) 998 eventBus.postEvent(RoomEvent.TrackUnpublished(this, publication, participant), coroutineScope)
1020 } 999 }
1021 1000
@@ -1023,7 +1002,6 @@ constructor( @@ -1023,7 +1002,6 @@ constructor(
1023 * @suppress 1002 * @suppress
1024 */ 1003 */
1025 override fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant) { 1004 override fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant) {
1026 - listener?.onTrackPublished(publication, participant, this)  
1027 if (e2eeManager != null) { 1005 if (e2eeManager != null) {
1028 e2eeManager!!.addPublishedTrack(publication.track!!, publication, participant, this) 1006 e2eeManager!!.addPublishedTrack(publication.track!!, publication, participant, this)
1029 } 1007 }
@@ -1034,7 +1012,6 @@ constructor( @@ -1034,7 +1012,6 @@ constructor(
1034 * @suppress 1012 * @suppress
1035 */ 1013 */
1036 override fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant) { 1014 override fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant) {
1037 - listener?.onTrackUnpublished(publication, participant, this)  
1038 e2eeManager?.let { e2eeManager -> 1015 e2eeManager?.let { e2eeManager ->
1039 e2eeManager!!.removePublishedTrack(publication.track!!, publication, participant, this) 1016 e2eeManager!!.removePublishedTrack(publication.track!!, publication, participant, this)
1040 } 1017 }
@@ -1045,7 +1022,6 @@ constructor( @@ -1045,7 +1022,6 @@ constructor(
1045 * @suppress 1022 * @suppress
1046 */ 1023 */
1047 override fun onTrackSubscribed(track: Track, publication: RemoteTrackPublication, participant: RemoteParticipant) { 1024 override fun onTrackSubscribed(track: Track, publication: RemoteTrackPublication, participant: RemoteParticipant) {
1048 - listener?.onTrackSubscribed(track, publication, participant, this)  
1049 if (e2eeManager != null) { 1025 if (e2eeManager != null) {
1050 e2eeManager!!.addSubscribedTrack(track, publication, participant, this) 1026 e2eeManager!!.addSubscribedTrack(track, publication, participant, this)
1051 } 1027 }
@@ -1060,7 +1036,6 @@ constructor( @@ -1060,7 +1036,6 @@ constructor(
1060 exception: Exception, 1036 exception: Exception,
1061 participant: RemoteParticipant, 1037 participant: RemoteParticipant,
1062 ) { 1038 ) {
1063 - listener?.onTrackSubscriptionFailed(sid, exception, participant, this)  
1064 eventBus.postEvent(RoomEvent.TrackSubscriptionFailed(this, sid, exception, participant), coroutineScope) 1039 eventBus.postEvent(RoomEvent.TrackSubscriptionFailed(this, sid, exception, participant), coroutineScope)
1065 } 1040 }
1066 1041
@@ -1072,7 +1047,6 @@ constructor( @@ -1072,7 +1047,6 @@ constructor(
1072 publication: RemoteTrackPublication, 1047 publication: RemoteTrackPublication,
1073 participant: RemoteParticipant, 1048 participant: RemoteParticipant,
1074 ) { 1049 ) {
1075 - listener?.onTrackUnsubscribed(track, publication, participant, this)  
1076 e2eeManager?.let { e2eeManager -> 1050 e2eeManager?.let { e2eeManager ->
1077 e2eeManager!!.removeSubscribedTrack(track, publication, participant, this) 1051 e2eeManager!!.removeSubscribedTrack(track, publication, participant, this)
1078 } 1052 }
@@ -1080,8 +1054,9 @@ constructor( @@ -1080,8 +1054,9 @@ constructor(
1080 } 1054 }
1081 1055
1082 /** 1056 /**
1083 - * // TODO(@dl): can this be moved out of Room/SDK? 1057 + * Initialize a [SurfaceViewRenderer] for rendering a video from this room.
1084 */ 1058 */
  1059 + // TODO(@dl): can this be moved out of Room/SDK?
1085 fun initVideoRenderer(viewRenderer: SurfaceViewRenderer) { 1060 fun initVideoRenderer(viewRenderer: SurfaceViewRenderer) {
1086 viewRenderer.init(eglBase.eglBaseContext, null) 1061 viewRenderer.init(eglBase.eglBaseContext, null)
1087 viewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) 1062 viewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)
@@ -1089,8 +1064,9 @@ constructor( @@ -1089,8 +1064,9 @@ constructor(
1089 } 1064 }
1090 1065
1091 /** 1066 /**
1092 - * // TODO(@dl): can this be moved out of Room/SDK? 1067 + * Initialize a [TextureViewRenderer] for rendering a video from this room.
1093 */ 1068 */
  1069 + // TODO(@dl): can this be moved out of Room/SDK?
1094 fun initVideoRenderer(viewRenderer: TextureViewRenderer) { 1070 fun initVideoRenderer(viewRenderer: TextureViewRenderer) {
1095 viewRenderer.init(eglBase.eglBaseContext, null) 1071 viewRenderer.init(eglBase.eglBaseContext, null)
1096 viewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT) 1072 viewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)
@@ -1130,136 +1106,6 @@ constructor( @@ -1130,136 +1106,6 @@ constructor(
1130 } 1106 }
1131 } 1107 }
1132 1108
1133 -/**  
1134 - * Room Listener, this class provides callbacks that clients should override.  
1135 - *  
1136 - */  
1137 -@Deprecated("Use Room.events instead")  
1138 -interface RoomListener {  
1139 - /**  
1140 - * A network change has been detected and LiveKit attempts to reconnect to the room  
1141 - * When reconnect attempts succeed, the room state will be kept, including tracks that are subscribed/published  
1142 - */  
1143 - fun onReconnecting(room: Room) {}  
1144 -  
1145 - /**  
1146 - * The reconnect attempt had been successful  
1147 - */  
1148 - fun onReconnected(room: Room) {}  
1149 -  
1150 - /**  
1151 - * Disconnected from room  
1152 - */  
1153 - fun onDisconnect(room: Room, error: Exception?) {}  
1154 -  
1155 - /**  
1156 - * When a [RemoteParticipant] joins after the local participant. It will not emit events  
1157 - * for participants that are already in the room  
1158 - */  
1159 - fun onParticipantConnected(room: Room, participant: RemoteParticipant) {}  
1160 -  
1161 - /**  
1162 - * When a [RemoteParticipant] leaves after the local participant has joined.  
1163 - */  
1164 - fun onParticipantDisconnected(room: Room, participant: RemoteParticipant) {}  
1165 -  
1166 - /**  
1167 - * Could not connect to the room  
1168 - */  
1169 - fun onFailedToConnect(room: Room, error: Throwable) {}  
1170 -  
1171 - /**  
1172 - * Active speakers changed. List of speakers are ordered by their audio level. loudest  
1173 - * speakers first. This will include the [LocalParticipant] too.  
1174 - */  
1175 - fun onActiveSpeakersChanged(speakers: List<Participant>, room: Room) {}  
1176 -  
1177 - // Participant callbacks  
1178 - /**  
1179 - * Participant metadata is a simple way for app-specific state to be pushed to all users.  
1180 - * When RoomService.UpdateParticipantMetadata is called to change a participant's state,  
1181 - * this event will be fired for all clients in the room.  
1182 - */  
1183 - fun onMetadataChanged(participant: Participant, prevMetadata: String?, room: Room) {}  
1184 -  
1185 - /**  
1186 - * The participant was muted.  
1187 - *  
1188 - * For the local participant, the callback will be called if setMute was called on the  
1189 - * [LocalTrackPublication], or if the server has requested the participant to be muted  
1190 - */  
1191 - fun onTrackMuted(publication: TrackPublication, participant: Participant, room: Room) {}  
1192 -  
1193 - /**  
1194 - * The participant was unmuted.  
1195 - *  
1196 - * For the local participant, the callback will be called if setMute was called on the  
1197 - * [LocalTrackPublication], or if the server has requested the participant to be muted  
1198 - */  
1199 - fun onTrackUnmuted(publication: TrackPublication, participant: Participant, room: Room) {}  
1200 -  
1201 - /**  
1202 - * When a new track is published to room after the local participant has joined. It will  
1203 - * not fire for tracks that are already published  
1204 - */  
1205 - fun onTrackPublished(publication: RemoteTrackPublication, participant: RemoteParticipant, room: Room) {}  
1206 -  
1207 - /**  
1208 - * A [RemoteParticipant] has unpublished a track  
1209 - */  
1210 - fun onTrackUnpublished(publication: RemoteTrackPublication, participant: RemoteParticipant, room: Room) {}  
1211 -  
1212 - /**  
1213 - * When a new track is published to room after the local participant has joined.  
1214 - */  
1215 - fun onTrackPublished(publication: LocalTrackPublication, participant: LocalParticipant, room: Room) {}  
1216 -  
1217 - /**  
1218 - * [LocalParticipant] has unpublished a track  
1219 - */  
1220 - fun onTrackUnpublished(publication: LocalTrackPublication, participant: LocalParticipant, room: Room) {}  
1221 -  
1222 - /**  
1223 - * The [LocalParticipant] has subscribed to a new track. This event will always fire as  
1224 - * long as new tracks are ready for use.  
1225 - */  
1226 - fun onTrackSubscribed(track: Track, publication: TrackPublication, participant: RemoteParticipant, room: Room) {}  
1227 -  
1228 - /**  
1229 - * Could not subscribe to a track  
1230 - */  
1231 - fun onTrackSubscriptionFailed(sid: String, exception: Exception, participant: RemoteParticipant, room: Room) {}  
1232 -  
1233 - /**  
1234 - * A subscribed track is no longer available. Clients should listen to this event and ensure  
1235 - * the track removes all renderers  
1236 - */  
1237 - fun onTrackUnsubscribed(track: Track, publications: TrackPublication, participant: RemoteParticipant, room: Room) {}  
1238 -  
1239 - /**  
1240 - * Received data published by another participant  
1241 - */  
1242 - fun onDataReceived(data: ByteArray, participant: RemoteParticipant?, room: Room) {}  
1243 -  
1244 - /**  
1245 - * The connection quality for a participant has changed.  
1246 - *  
1247 - * @param participant Either a remote participant or [Room.localParticipant]  
1248 - * @param quality the new connection quality  
1249 - */  
1250 - fun onConnectionQualityChanged(participant: Participant, quality: ConnectionQuality) {}  
1251 -  
1252 - companion object {  
1253 - fun getDefaultDevice(kind: DeviceManager.Kind): String? {  
1254 - return DeviceManager.getDefaultDevice(kind)  
1255 - }  
1256 -  
1257 - fun setDefaultDevice(kind: DeviceManager.Kind, deviceId: String?) {  
1258 - DeviceManager.setDefaultDevice(kind, deviceId)  
1259 - }  
1260 - }  
1261 -}  
1262 -  
1263 sealed class RoomException(message: String? = null, cause: Throwable? = null) : 1109 sealed class RoomException(message: String? = null, cause: Throwable? = null) :
1264 Exception(message, cause) { 1110 Exception(message, cause) {
1265 class ConnectException(message: String? = null, cause: Throwable? = null) : 1111 class ConnectException(message: String? = null, cause: Throwable? = null) :
@@ -92,7 +92,6 @@ open class Participant( @@ -92,7 +92,6 @@ open class Participant(
92 @get:FlowObservable 92 @get:FlowObservable
93 var isSpeaking: Boolean by flowDelegate(false) { newValue, oldValue -> 93 var isSpeaking: Boolean by flowDelegate(false) { newValue, oldValue ->
94 if (newValue != oldValue) { 94 if (newValue != oldValue) {
95 - listener?.onSpeakingChanged(this)  
96 internalListener?.onSpeakingChanged(this) 95 internalListener?.onSpeakingChanged(this)
97 eventBus.postEvent(ParticipantEvent.SpeakingChanged(this, newValue), scope) 96 eventBus.postEvent(ParticipantEvent.SpeakingChanged(this, newValue), scope)
98 if (newValue) { 97 if (newValue) {
@@ -118,7 +117,6 @@ open class Participant( @@ -118,7 +117,6 @@ open class Participant(
118 @get:FlowObservable 117 @get:FlowObservable
119 var metadata: String? by flowDelegate(null) { newMetadata, oldMetadata -> 118 var metadata: String? by flowDelegate(null) { newMetadata, oldMetadata ->
120 if (newMetadata != oldMetadata) { 119 if (newMetadata != oldMetadata) {
121 - listener?.onMetadataChanged(this, oldMetadata)  
122 internalListener?.onMetadataChanged(this, oldMetadata) 120 internalListener?.onMetadataChanged(this, oldMetadata)
123 eventBus.postEvent(ParticipantEvent.MetadataChanged(this, oldMetadata), scope) 121 eventBus.postEvent(ParticipantEvent.MetadataChanged(this, oldMetadata), scope)
124 } 122 }
@@ -167,12 +165,6 @@ open class Participant( @@ -167,12 +165,6 @@ open class Participant(
167 internal set 165 internal set
168 166
169 /** 167 /**
170 - * Listener for when participant properties change  
171 - */  
172 - @Deprecated("Use events instead")  
173 - var listener: ParticipantListener? = null  
174 -  
175 - /**  
176 * @suppress 168 * @suppress
177 */ 169 */
178 @Deprecated("Use events instead") 170 @Deprecated("Use events instead")
@@ -336,13 +328,11 @@ open class Participant( @@ -336,13 +328,11 @@ open class Participant(
336 328
337 // Internal methods just for posting events. 329 // Internal methods just for posting events.
338 internal fun onTrackMuted(trackPublication: TrackPublication) { 330 internal fun onTrackMuted(trackPublication: TrackPublication) {
339 - listener?.onTrackMuted(trackPublication, this)  
340 internalListener?.onTrackMuted(trackPublication, this) 331 internalListener?.onTrackMuted(trackPublication, this)
341 eventBus.postEvent(ParticipantEvent.TrackMuted(this, trackPublication), scope) 332 eventBus.postEvent(ParticipantEvent.TrackMuted(this, trackPublication), scope)
342 } 333 }
343 334
344 internal fun onTrackUnmuted(trackPublication: TrackPublication) { 335 internal fun onTrackUnmuted(trackPublication: TrackPublication) {
345 - listener?.onTrackUnmuted(trackPublication, this)  
346 internalListener?.onTrackUnmuted(trackPublication, this) 336 internalListener?.onTrackUnmuted(trackPublication, this)
347 eventBus.postEvent(ParticipantEvent.TrackUnmuted(this, trackPublication), scope) 337 eventBus.postEvent(ParticipantEvent.TrackUnmuted(this, trackPublication), scope)
348 } 338 }
@@ -374,6 +364,9 @@ open class Participant( @@ -374,6 +364,9 @@ open class Participant(
374 } 364 }
375 } 365 }
376 366
  367 +/**
  368 + * @suppress
  369 + */
377 @Deprecated("Use Participant.events instead.") 370 @Deprecated("Use Participant.events instead.")
378 interface ParticipantListener { 371 interface ParticipantListener {
379 // all participants 372 // all participants
@@ -101,7 +101,6 @@ class RemoteParticipant( @@ -101,7 +101,6 @@ class RemoteParticipant(
101 101
102 for (publication in newTrackPublications.values) { 102 for (publication in newTrackPublications.values) {
103 internalListener?.onTrackPublished(publication, this) 103 internalListener?.onTrackPublished(publication, this)
104 - listener?.onTrackPublished(publication, this)  
105 eventBus.postEvent(ParticipantEvent.TrackPublished(this, publication), scope) 104 eventBus.postEvent(ParticipantEvent.TrackPublished(this, publication), scope)
106 } 105 }
107 106
@@ -133,7 +132,6 @@ class RemoteParticipant( @@ -133,7 +132,6 @@ class RemoteParticipant(
133 LKLog.e { "remote participant ${this.sid} --- $message" } 132 LKLog.e { "remote participant ${this.sid} --- $message" }
134 133
135 internalListener?.onTrackSubscriptionFailed(sid, exception, this) 134 internalListener?.onTrackSubscriptionFailed(sid, exception, this)
136 - listener?.onTrackSubscriptionFailed(sid, exception, this)  
137 eventBus.postEvent(ParticipantEvent.TrackSubscriptionFailed(this, sid, exception), scope) 135 eventBus.postEvent(ParticipantEvent.TrackSubscriptionFailed(this, sid, exception), scope)
138 } else { 136 } else {
139 coroutineScope.launch { 137 coroutineScope.launch {
@@ -170,7 +168,6 @@ class RemoteParticipant( @@ -170,7 +168,6 @@ class RemoteParticipant(
170 // TODO: how does mediatrack send ended event? 168 // TODO: how does mediatrack send ended event?
171 169
172 internalListener?.onTrackSubscribed(track, publication, this) 170 internalListener?.onTrackSubscribed(track, publication, this)
173 - listener?.onTrackSubscribed(track, publication, this)  
174 eventBus.postEvent(ParticipantEvent.TrackSubscribed(this, track, publication), scope) 171 eventBus.postEvent(ParticipantEvent.TrackSubscribed(this, track, publication), scope)
175 } 172 }
176 173
@@ -186,12 +183,10 @@ class RemoteParticipant( @@ -186,12 +183,10 @@ class RemoteParticipant(
186 // track may already be disposed, ignore. 183 // track may already be disposed, ignore.
187 } 184 }
188 internalListener?.onTrackUnsubscribed(track, publication, this) 185 internalListener?.onTrackUnsubscribed(track, publication, this)
189 - listener?.onTrackUnsubscribed(track, publication, this)  
190 eventBus.postEvent(ParticipantEvent.TrackUnsubscribed(this, track, publication), scope) 186 eventBus.postEvent(ParticipantEvent.TrackUnsubscribed(this, track, publication), scope)
191 } 187 }
192 if (sendUnpublish) { 188 if (sendUnpublish) {
193 internalListener?.onTrackUnpublished(publication, this) 189 internalListener?.onTrackUnpublished(publication, this)
194 - listener?.onTrackUnpublished(publication, this)  
195 eventBus.postEvent(ParticipantEvent.TrackUnpublished(this, publication), scope) 190 eventBus.postEvent(ParticipantEvent.TrackUnpublished(this, publication), scope)
196 } 191 }
197 publication.track = null 192 publication.track = null
@@ -212,7 +207,6 @@ class RemoteParticipant( @@ -212,7 +207,6 @@ class RemoteParticipant(
212 207
213 // Internal methods just for posting events. 208 // Internal methods just for posting events.
214 internal fun onDataReceived(data: ByteArray, topic: String?) { 209 internal fun onDataReceived(data: ByteArray, topic: String?) {
215 - listener?.onDataReceived(data, this)  
216 eventBus.postEvent(ParticipantEvent.DataReceived(this, data, topic), scope) 210 eventBus.postEvent(ParticipantEvent.DataReceived(this, data, topic), scope)
217 } 211 }
218 212
@@ -26,7 +26,7 @@ data class LocalVideoTrackOptions( @@ -26,7 +26,7 @@ data class LocalVideoTrackOptions(
26 */ 26 */
27 val deviceId: String? = null, 27 val deviceId: String? = null,
28 val position: CameraPosition? = CameraPosition.FRONT, 28 val position: CameraPosition? = CameraPosition.FRONT,
29 - val captureParams: VideoCaptureParameter = VideoPreset169.QHD.capture, 29 + val captureParams: VideoCaptureParameter = VideoPreset169.H540.capture,
30 ) 30 )
31 31
32 data class VideoCaptureParameter( 32 data class VideoCaptureParameter(
@@ -126,36 +126,6 @@ enum class VideoPreset169( @@ -126,36 +126,6 @@ enum class VideoPreset169(
126 VideoCaptureParameter(3840, 2160, 30), 126 VideoCaptureParameter(3840, 2160, 30),
127 VideoEncoding(8_000_000, 30), 127 VideoEncoding(8_000_000, 30),
128 ), 128 ),
129 -  
130 - @Deprecated("QVGA is deprecated, use H180 instead")  
131 - QVGA(  
132 - VideoCaptureParameter(320, 180, 15),  
133 - VideoEncoding(125_000, 15),  
134 - ),  
135 -  
136 - @Deprecated("VGA is deprecated, use H360 instead")  
137 - VGA(  
138 - VideoCaptureParameter(640, 360, 30),  
139 - VideoEncoding(400_000, 30),  
140 - ),  
141 -  
142 - @Deprecated("QHD is deprecated, use H540 instead")  
143 - QHD(  
144 - VideoCaptureParameter(960, 540, 30),  
145 - VideoEncoding(800_000, 30),  
146 - ),  
147 -  
148 - @Deprecated("HD is deprecated, use H720 instead")  
149 - HD(  
150 - VideoCaptureParameter(1280, 720, 30),  
151 - VideoEncoding(2_500_000, 30),  
152 - ),  
153 -  
154 - @Deprecated("FHD is deprecated, use H1080 instead")  
155 - FHD(  
156 - VideoCaptureParameter(1920, 1080, 30),  
157 - VideoEncoding(4_000_000, 30),  
158 - ),  
159 } 129 }
160 130
161 /** 131 /**
@@ -201,34 +171,4 @@ enum class VideoPreset43( @@ -201,34 +171,4 @@ enum class VideoPreset43(
201 VideoCaptureParameter(1920, 1440, 30), 171 VideoCaptureParameter(1920, 1440, 30),
202 VideoEncoding(3_800_000, 30), 172 VideoEncoding(3_800_000, 30),
203 ), 173 ),
204 -  
205 - @Deprecated("QVGA is deprecated, use H120 instead")  
206 - QVGA(  
207 - VideoCaptureParameter(240, 180, 15),  
208 - VideoEncoding(100_000, 15),  
209 - ),  
210 -  
211 - @Deprecated("VGA is deprecated, use H360 instead")  
212 - VGA(  
213 - VideoCaptureParameter(480, 360, 30),  
214 - VideoEncoding(320_000, 30),  
215 - ),  
216 -  
217 - @Deprecated("QHD is deprecated, use H540 instead")  
218 - QHD(  
219 - VideoCaptureParameter(720, 540, 30),  
220 - VideoEncoding(640_000, 30),  
221 - ),  
222 -  
223 - @Deprecated("HD is deprecated, use H720 instead")  
224 - HD(  
225 - VideoCaptureParameter(960, 720, 30),  
226 - VideoEncoding(2_000_000, 30),  
227 - ),  
228 -  
229 - @Deprecated("FHD is deprecated, use H1080 instead")  
230 - FHD(  
231 - VideoCaptureParameter(1440, 1080, 30),  
232 - VideoEncoding(3_200_000, 30),  
233 - ),  
234 } 174 }
@@ -72,10 +72,8 @@ class ParticipantTest { @@ -72,10 +72,8 @@ class ParticipantTest {
72 } 72 }
73 } 73 }
74 74
75 - val publicListener = MetadataListener()  
76 val internalListener = MetadataListener() 75 val internalListener = MetadataListener()
77 76
78 - participant.listener = publicListener  
79 participant.internalListener = internalListener 77 participant.internalListener = internalListener
80 78
81 val prevMetadata = participant.metadata 79 val prevMetadata = participant.metadata
@@ -88,7 +86,6 @@ class ParticipantTest { @@ -88,7 +86,6 @@ class ParticipantTest {
88 assertEquals(prevMetadata, listener.prevMetadataValue) 86 assertEquals(prevMetadata, listener.prevMetadataValue)
89 } 87 }
90 88
91 - checkValues(publicListener)  
92 checkValues(internalListener) 89 checkValues(internalListener)
93 } 90 }
94 91