Little capture preview in portrait mode. Adapted workaround.
This commit is contained in:
parent
86289d1a73
commit
ac9b15ad1a
2 changed files with 20 additions and 19 deletions
|
@ -1,8 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent">
|
||||
android:id="@+id/video_frame" android:orientation="vertical"
|
||||
android:layout_height="fill_parent" android:layout_width="fill_parent">
|
||||
|
||||
<SurfaceView android:layout_weight="50" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_surface"></SurfaceView>
|
||||
<SurfaceView android:layout_weight="50" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_capture_surface"></SurfaceView>
|
||||
</LinearLayout>
|
||||
<SurfaceView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/video_surface"></SurfaceView>
|
||||
<SurfaceView android:layout_height="88dip" android:layout_width="72dip" android:id="@+id/video_capture_surface" android:layout_gravity="right|bottom"
|
||||
android:layout_margin="15dip"></SurfaceView>
|
||||
</FrameLayout>
|
|
@ -40,14 +40,15 @@ public class VideoCallActivity extends Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.videocall);
|
||||
|
||||
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
||||
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
||||
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView);
|
||||
|
||||
mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface);
|
||||
|
||||
final int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
||||
AndroidCameraRecord.setOrientationCode(rotation);
|
||||
hack(rotation);
|
||||
|
||||
if (!firstLaunch) workaroundCapturePreviewHiddenOnSubsequentRotations();
|
||||
|
||||
AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler);
|
||||
firstLaunch = false;
|
||||
|
@ -55,19 +56,17 @@ public class VideoCallActivity extends Activity {
|
|||
|
||||
|
||||
|
||||
private void hack(int rotation) {
|
||||
if (rotation != 0 && !firstLaunch) {
|
||||
View view = findViewById(R.id.video_frame);
|
||||
if (view == null) {
|
||||
Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???");
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout frame = (FrameLayout) view;
|
||||
frame.removeAllViews();
|
||||
frame.addView(mVideoCaptureView);
|
||||
frame.addView(mVideoView);
|
||||
private void workaroundCapturePreviewHiddenOnSubsequentRotations() {
|
||||
View view = findViewById(R.id.video_frame);
|
||||
if (view == null) {
|
||||
Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???");
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout frame = (FrameLayout) view;
|
||||
frame.removeAllViews();
|
||||
frame.addView(mVideoCaptureView);
|
||||
frame.addView(mVideoView);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue