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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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_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>
|
<SurfaceView android:layout_height="88dip" android:layout_width="72dip" android:id="@+id/video_capture_surface" android:layout_gravity="right|bottom"
|
||||||
</LinearLayout>
|
android:layout_margin="15dip"></SurfaceView>
|
||||||
|
</FrameLayout>
|
|
@ -40,14 +40,15 @@ public class VideoCallActivity extends Activity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.videocall);
|
setContentView(R.layout.videocall);
|
||||||
|
|
||||||
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
mVideoView = (SurfaceView) findViewById(R.id.video_surface);
|
||||||
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView);
|
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView);
|
||||||
|
|
||||||
mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface);
|
mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface);
|
||||||
|
|
||||||
final int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
final int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
||||||
AndroidCameraRecord.setOrientationCode(rotation);
|
AndroidCameraRecord.setOrientationCode(rotation);
|
||||||
hack(rotation);
|
|
||||||
|
if (!firstLaunch) workaroundCapturePreviewHiddenOnSubsequentRotations();
|
||||||
|
|
||||||
AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler);
|
AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler);
|
||||||
firstLaunch = false;
|
firstLaunch = false;
|
||||||
|
@ -55,19 +56,17 @@ public class VideoCallActivity extends Activity {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void hack(int rotation) {
|
private void workaroundCapturePreviewHiddenOnSubsequentRotations() {
|
||||||
if (rotation != 0 && !firstLaunch) {
|
View view = findViewById(R.id.video_frame);
|
||||||
View view = findViewById(R.id.video_frame);
|
if (view == null) {
|
||||||
if (view == null) {
|
Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???");
|
||||||
Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???");
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameLayout frame = (FrameLayout) view;
|
|
||||||
frame.removeAllViews();
|
|
||||||
frame.addView(mVideoCaptureView);
|
|
||||||
frame.addView(mVideoView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrameLayout frame = (FrameLayout) view;
|
||||||
|
frame.removeAllViews();
|
||||||
|
frame.addView(mVideoCaptureView);
|
||||||
|
frame.addView(mVideoView);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue