diff --git a/android-rtc/Videosdk_android_java_quickstart/app/build.gradle b/android-rtc/Videosdk_android_java_quickstart/app/build.gradle index 17c2814..7c476f0 100644 --- a/android-rtc/Videosdk_android_java_quickstart/app/build.gradle +++ b/android-rtc/Videosdk_android_java_quickstart/app/build.gradle @@ -30,7 +30,8 @@ android { dependencies { - implementation 'live.videosdk:rtc-android-sdk:0.1.17' +// implementation 'live.videosdk:rtc-android-sdk:0.1.21' + implementation 'com.github.zujonow:rtc-android-sdk:c07cf2f462' implementation 'com.amitshekhar.android:android-networking:1.0.2' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.8.0' diff --git a/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/MeetingActivity.java b/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/MeetingActivity.java index fe73491..6d28685 100644 --- a/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/MeetingActivity.java +++ b/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/MeetingActivity.java @@ -36,7 +36,7 @@ protected void onCreate(Bundle savedInstanceState) { // 2. Initialize VideoSDK Meeting meeting = VideoSDK.initMeeting( MeetingActivity.this, meetingId, participantName, - micEnabled, webcamEnabled,null, null, true,null); + micEnabled, webcamEnabled,null, null, true,null,null,null); // 3. Add event listener for listening upcoming events meeting.addEventListener(meetingEventListener); diff --git a/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/ParticipantAdapter.java b/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/ParticipantAdapter.java index c0267bb..d77b7cc 100644 --- a/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/ParticipantAdapter.java +++ b/android-rtc/Videosdk_android_java_quickstart/app/src/main/java/live/videosdk/rtc/android/quickstart/ParticipantAdapter.java @@ -1,5 +1,6 @@ package live.videosdk.rtc.android.quickstart; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -24,12 +25,23 @@ public class ParticipantAdapter extends RecyclerView.Adapter participants = new ArrayList<>(); + private PeerViewHolder viewHolder; + public ParticipantAdapter(Meeting meeting) { // adding the local participant(You) to the list - participants.add(meeting.getLocalParticipant()); + // adding Meeting Event listener to get the participant join/leave event in the meeting. meeting.addEventListener(new MeetingEventListener() { + + @Override + public void onMeetingJoined() { + participants.clear(); + participants.add(meeting.getLocalParticipant()); + notifyDataSetChanged(); + super.onMeetingJoined(); + } + @Override public void onParticipantJoined(Participant participant) { // add participant to the list @@ -53,6 +65,17 @@ public void onParticipantLeft(Participant participant) { notifyItemRemoved(pos); } } + + @Override + public void onMeetingStateChanged(String state) { + Log.d("TAG", "onMeetingStateChanged: particiapantAdapter"); + if(state.equals("FAILED")){ + viewHolder.participantView.clearImage(); + viewHolder.participantView.removeTrack(); + viewHolder.participantView.releaseSurfaceViewRenderer(); + } + super.onMeetingStateChanged(state); + } }); } @@ -64,6 +87,7 @@ public PeerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType @Override public void onBindViewHolder(@NonNull PeerViewHolder holder, int position) { + viewHolder = holder; Participant participant = participants.get(position); holder.tvName.setText(participant.getDisplayName()); diff --git a/android-rtc/Videosdk_android_java_quickstart/settings.gradle b/android-rtc/Videosdk_android_java_quickstart/settings.gradle index 4f282e1..dc98389 100644 --- a/android-rtc/Videosdk_android_java_quickstart/settings.gradle +++ b/android-rtc/Videosdk_android_java_quickstart/settings.gradle @@ -3,14 +3,15 @@ pluginManagement { gradlePluginPortal() google() mavenCentral() + maven { url 'https://jitpack.io' } } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() - maven { url 'https://jitpack.io' } mavenCentral() + maven { url 'https://jitpack.io' } maven { url "https://maven.aliyun.com/repository/jcenter" } } }