1
0
Fork 1

Do not crash when receiving video call on device w/o camera

Upon accepting a video call on a device that can not establish a video track on
its own (for example by not having a camera), displaying the video enable/disable
button would fail. This commit defaults this button to disabled.

(cherry picked from commit 1822a71c2a80ce31dac1b8a4df25acf012171b43)
This commit is contained in:
Daniel Gultsch 2021-03-26 12:54:23 +01:00 committed by Christian Schneppe
parent 352929cacc
commit 90dc63c669
3 changed files with 8 additions and 2 deletions

View file

@ -888,7 +888,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
}
private void enableVideo(View view) {
requireRtpConnection().setVideoEnabled(true);
try {
requireRtpConnection().setVideoEnabled(true);
} catch (final IllegalStateException e) {
Toast.makeText(this, R.string.unable_to_enable_video, Toast.LENGTH_SHORT).show();
return;
}
updateInCallButtonConfigurationVideo(true, requireRtpConnection().isCameraSwitchable());
}

View file

@ -393,7 +393,7 @@ public class WebRTCWrapper {
boolean isVideoEnabled() {
final VideoTrack videoTrack = this.localVideoTrack;
if (videoTrack == null) {
throw new IllegalStateException("Local video track does not exist");
return false;
}
return videoTrack.enabled();
}

View file

@ -1137,4 +1137,5 @@
<string name="record_voice_mail">Record voice message</string>
<string name="backup_started_message">The backup has been started. Youll get a notification once it has been completed.</string>
<string name="error_security_exception">The app you used to share this file did not provide enough permissions.</string>
<string name="unable_to_enable_video">Unable to enable video.</string>
</resources>