Closed ZahidRamzan closed 5 years ago
Hey @ZahidRamzan
I have two follow up questions.
I notice you are using 3.0.0-preview1
. Can you upgrade to the latest GA release? 4.3.1
Can you provide room sids where you observe the issue? You can get a room sid from the room object using the following API. room.getSid()
Thanks!
Hey @ZahidRamzan
I'm closing this issue for now. Please reopen if you have any further questions.
Thanks!
Description
[I'm facing issues in video connection of participants in many sonerios
A little bit low internet causes the video connection lost.
Note: In all above sonerios audio is connected to both participants, its means they are connected in room but "Video" has some issue.
]
Steps to Reproduce
Code
package com.quartrly.android.Twilio;
import android.Manifest; import android.annotation.SuppressLint; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraManager; import android.media.AudioAttributes; import android.media.AudioFocusRequest; import android.media.AudioManager; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.preference.PreferenceManager; import android.text.Html; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationCompat; import androidx.core.content.ContextCompat;
import com.android.volley.Request; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.quartrly.android.FireBase.MyFirebaseMessagingService; import com.quartrly.android.R; import com.quartrly.android.activity.HomeActivity; import com.quartrly.android.constants.ApiUrl; import com.quartrly.android.constants.Constants; import com.quartrly.android.dialoge.CommenDialog; import com.quartrly.android.handler.CommentResponseApiHanlder; import com.quartrly.android.interfaces.CallEndWithNotificationListener; import com.quartrly.android.interfaces.CommentResponseListener; import com.quartrly.android.interfaces.InterFaceHandler; import com.quartrly.android.interfaces.LocalCallListener; import com.quartrly.android.interfaces.MyEventListner; import com.quartrly.android.interfaces.NetworkStateListener; import com.quartrly.android.model.CommentResponse; import com.quartrly.android.model.MyCustomApplication; import com.quartrly.android.recievers.CallReceiverNew; import com.quartrly.android.recievers.ConnectionStateReceiver; import com.quartrly.android.utils.CameraCapturerCompat; import com.quartrly.android.utils.ScreenshotDetectionActivity; import com.quartrly.android.utils.SocketEventHandler; import com.quartrly.android.utils.Utils; import com.quartrly.android.utils.WakeLocker; import com.suke.widget.SwitchButton; import com.twilio.video.AudioCodec; import com.twilio.video.CameraCapturer; import com.twilio.video.CameraCapturer.CameraSource; import com.twilio.video.CameraParameterUpdater; import com.twilio.video.ConnectOptions; import com.twilio.video.EncodingParameters; import com.twilio.video.G722Codec; import com.twilio.video.H264Codec; import com.twilio.video.IsacCodec; import com.twilio.video.LocalAudioTrack; import com.twilio.video.LocalParticipant; import com.twilio.video.LocalVideoTrack; import com.twilio.video.LogLevel; import com.twilio.video.OpusCodec; import com.twilio.video.PcmaCodec; import com.twilio.video.PcmuCodec; import com.twilio.video.RemoteAudioTrack; import com.twilio.video.RemoteAudioTrackPublication; import com.twilio.video.RemoteDataTrack; import com.twilio.video.RemoteDataTrackPublication; import com.twilio.video.RemoteParticipant; import com.twilio.video.RemoteVideoTrack; import com.twilio.video.RemoteVideoTrackPublication; import com.twilio.video.Room; import com.twilio.video.RoomState; import com.twilio.video.TwilioException; import com.twilio.video.Video; import com.twilio.video.VideoCodec; import com.twilio.video.VideoRenderer; import com.twilio.video.VideoTrack; import com.twilio.video.VideoView; import com.twilio.video.Vp8Codec; import com.twilio.video.Vp9Codec;
import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject;
import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; import java.util.Timer; import java.util.TimerTask;
import io.socket.client.Ack; import io.socket.emitter.Emitter;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
public class VideoActivity extends ScreenshotDetectionActivity implements MyEventListner, CallEndWithNotificationListener, LocalCallListener, NetworkStateListener { private static final int CAMERA_MIC_PERMISSION_REQUEST_CODE = 1; private static final String TAG = "Video_Call";
// Timer for floating text if (Constants.IS_REFRESHED) { internetView.setVisibility(View.VISIBLE); txt_internet.setText("Reconnecting...");
// for flashlight
// String flashMode = !flashOn ? // Camera.Parameters.FLASH_MODE_OFF : // Camera.Parameters.FLASH_MODE_TORCH; // // parameters.setFlashMode(flashMode);
// CameraParameterUpdater cameraParameterUpdater; // cameraParameterUpdater.apply();
//
// long currentTime = System.currentTimeMillis(); // Calendar calendar = Calendar.getInstance(); // calendar.setTimeZone(TimeZone.getTimeZone("GMT")); // long now = calendar.getTimeInMillis(); // long diff = callTimeNew - now; // Log.d(TAG, "run: " + "currentTime: " + currentTime + " - callTimeNew: " + callTimeNew + " = time difference: " + diff);
// if (diff == 180000 || diff == 360000 || diff == 540000 || diff == 660000 || diff == 840000) { // // bitmap = ScreenShott.getInstance().takeScreenShotOfRootView(primaryVideoView); // // } } }; timerNew.scheduleAtFixedRate(t, 1000, 1000); }
// registerReceiver(new PhoneUnlockedReceiver(), new IntentFilter("android.intent.action.USER_PRESENT")); registerReceiver(connectionStateReceiver, connectionStateIntentFilter); if (!isOnCall) { updateData(); } }
// Utils.serverLogs.clear(); }
// switchCameraActionFab.show(); switchCameraActionFab.setOnClickListener(switchCameraClickListener()); localVideoActionFab.show(); localVideoActionFab.setOnClickListener(localVideoClickListener()); // muteActionFab.show(); muteActionFab.setOnClickListener(muteClickListener());
// Your Internet connection is slow. Please check your WiFi/Cell signal. Utils.showLoger("Internet Bad"); internetView.setVisibility(View.VISIBLE); txt_internet.setText("Your Internet connection is slow. \n Please check your WiFi/Cell signal.."); } else { Utils.showLoger("Internet Good"); internetView.setVisibility(View.GONE); } }
// if (room.getLocalParticipant().getVideoTracks().isEmpty() && !isPause && !isNetworkDoOff) { // // Utils.showLoger("localTrackIsEmpty"); // // Constants.IS_REFRESHED = true; // finish(); // startActivity(getIntent()); // // } else if (!room.getRemoteParticipants().isEmpty()) { // // if (room.getRemoteParticipants().get(0).getVideoTracks().isEmpty() && !isPause && !isNetworkDoOff) { // // Utils.showLoger("remoteTrackIsEmpty"); // // Constants.IS_REFRESHED = true; // finish(); // startActivity(getIntent()); // } // }
// public class PhoneUnlockedReceiver extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // // KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); // if (keyguardManager.isKeyguardSecure()) { // // Utils.showLoger("Phone Unlocked"); // Utils.showToast(VideoActivity.this, "Phone Unlocked"); // // } // } // }
}
Expected Behavior
Video should connect in all case and behaviors of app.
Actual Behavior
Some times it is connected but sometime not.
Reproduces how Often
on slow internet connection 90% on good internet connection 40%
Logs
Versions
All relevant version information for issue.
Video Android SDK
com.twilio:video-android:3.0.0-preview1
Android API
[eg. 18]
Android Device
Samsung Note8 , S8 ,S7