diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 7f046def8..496244300 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -874,7 +874,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()); } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index af57d7cc9..021ec4a5e 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -408,11 +408,7 @@ public abstract class XmppActivity extends ActionBarActivity { metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); new EmojiService(this).init(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY); - } else { - this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA); - } + this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY); this.mTheme = findTheme(); setTheme(this.mTheme); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index 640776122..dca04c000 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -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(); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e96b62066..1b4b56e7d 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -961,4 +961,5 @@ Server does not support generating invites No active accounts support this feature The backup has been started. You’ll get a notification once it has been completed. + Unable to enable video.