mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Safeguard against crashes on devices with no camera
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
8df1cdf964
commit
a3c54fd854
@ -504,6 +504,10 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
onMicrophoneClick();
|
onMicrophoneClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||||
|
cameraControlButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
||||||
cameraSwitchButton.setVisibility(View.VISIBLE);
|
cameraSwitchButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -518,6 +522,10 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
onCameraClick();
|
onCameraClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||||
|
cameraControlButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
||||||
cameraSwitchButton.setVisibility(View.VISIBLE);
|
cameraSwitchButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -606,6 +614,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
videoCapturer = createCameraCapturer(cameraEnumerator);
|
videoCapturer = createCameraCapturer(cameraEnumerator);
|
||||||
|
|
||||||
//Create a VideoSource instance
|
//Create a VideoSource instance
|
||||||
|
if (videoCapturer != null) {
|
||||||
videoSource = peerConnectionFactory.createVideoSource(videoCapturer);
|
videoSource = peerConnectionFactory.createVideoSource(videoCapturer);
|
||||||
localVideoTrack = peerConnectionFactory.createVideoTrack("NCv0", videoSource);
|
localVideoTrack = peerConnectionFactory.createVideoTrack("NCv0", videoSource);
|
||||||
localMediaStream.addTrack(localVideoTrack);
|
localMediaStream.addTrack(localVideoTrack);
|
||||||
@ -618,6 +627,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
localVideoTrack.addRenderer(localRenderer);
|
localVideoTrack.addRenderer(localRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void microphoneInitialization() {
|
private void microphoneInitialization() {
|
||||||
//create an AudioSource instance
|
//create an AudioSource instance
|
||||||
audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
|
audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
|
||||||
|
Loading…
Reference in New Issue
Block a user