surfaceview

preview display in android media recorder

帅比萌擦擦* 提交于 2020-01-24 03:53:26
问题 In android how to show preview surface before media recorder start. my app have video recording functionality,when i navigate to video recording fragment it display black screen,when i start recording using start button camera preview is display and recording start. how to start preview before recording. i have added code that i used in onCreateView() of fragment- surfaceHolder = mySurfaceView.getHolder(); camera = Camera.open(); if(camera!=null){ camera.setDisplayOrientation(90); Camera

SurfaceView hides other components on screen

孤者浪人 提交于 2020-01-23 04:18:07
问题 I am creating a layout of type FrameLayout, in which I am adding two views. Two views are objects of GLSurfaceView and SurfaceView respectively. According to Android Developers Documentation regarding SurfaceView, "The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed." It works well for me and SurfaceView always stays behind my GLSurfaceView (used for opneGL drawings). But resuming

Pinch zoom on SurfaceView

一曲冷凌霜 提交于 2020-01-21 06:44:06
问题 I'm trying to implement pinch zoom on a SurfaceView . I've done a lot of research regarding this and I found this class to implement pinch zoom. Here is how I modified it: public class ZoomLayout extends FrameLayout implements ScaleGestureDetector.OnScaleGestureListener { private SurfaceView mSurfaceView; private enum Mode { NONE, DRAG, ZOOM } private static final String TAG = "ZoomLayout"; private static final float MIN_ZOOM = 1.0f; private static final float MAX_ZOOM = 4.0f; private Mode

unity打包android项目在模拟器上被surfaceview遮挡

a 夏天 提交于 2020-01-18 07:03:46
1.在手机端,surfaceview在unity布局之下,并没有错误,但是在模拟器上产生了这个问题,想了很多办法, 看到了大佬的思路,就是自定义UnityPlayer,重写addview方法,找到父布局下的surfaceview控件,然后进行操作,具体操作看大佬链接: https://www.jianshu.com/p/2ba2bbf247ce 其中,将false改为ture即可。 if (child is SurfaceView) { child.setZOrderOnTop(false) } 来源: CSDN 作者: YaphetS_Zero 链接: https://blog.csdn.net/YaphetS_Zero/article/details/103805364

[Android/安卓]屏幕旋转时改变SurfaceView(视频)宽高

流过昼夜 提交于 2020-01-17 23:55:07
主要解决自定义SurfaceView时,屏幕发生旋转后,SurfaceView也会跟随旋转的问题(因为是做播放器,所以SurfaceView宽高需要由视频宽高决定),最后SurfaceView还需要等比例缩放成屏幕的宽高。 int mWidth = getMeasuredWidth(); int mHeight = getMeasuredHeight(); int oldAngle = 90; /** * 旋转更新(屏幕旋转时调用,0和180 -> 横屏,90和270 -> 竖屏) * 屏幕旋转需要考虑旋转后的高宽变化,例如:竖屏时,高比宽大,横屏时:高比宽小。 * 所以旋转后要确定那边为宽,那边为高,然后将视频等比例缩放至屏幕相应大小。 * @param angle 旋转角度。传入0、180、90、270 */ private void updateOrientation(int angle) { if( videoWidth <= 0 || videoHeight <= 0 ) return; //需要改变宽高的LayoutParams ViewGroup.LayoutParams lp = getLayoutParams(); //是否为横版视频 boolean isLandscapeVideo = videoWidth > videoHeight; //是否为横屏

screenshot android presentation display/surface

只愿长相守 提交于 2020-01-17 05:48:59
问题 I would like to make "instant" screenshots of an Presentation object in Android. My Presentation normally renders to a virtual display (PRIVATE) which is backed by the surface from a MediaRecorder that is setup to record video. Recording the presentation as a video works great. mMediaRecorder = new MediaRecorder(); mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); mMediaRecorder.setOutputFormat(MediaRecorder

Surfaceview ANR onResume

爱⌒轻易说出口 提交于 2020-01-16 14:27:51
问题 I'm working on a Android game using SurfaceView, the game works fine, so I want to pause it when the user hits HOME key but when getting back the SurfaceView disappears(black background Edit: sometimes the drawing appears ) and buttons are inactive in both cases then I get ANR. public class MainActivity extends Activity { private Game game; MainPanel mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); game = new Game(); LoadLevel(); Init();

How can I make circle GLSurfaceView on Videoview?

China☆狼群 提交于 2020-01-16 00:49:09
问题 I'm using camera recorder library for video recording it's use GLSurfaceView. In my layout on VideoView I overlay GLSurfaceView. It's showing Circle shape when I overlay GLSurfaceView over ImageView It's showing Square shape when I overlay GLSurfaceView over VideoView. I have tried below code for making circle GLSurfaceView. public class SampleGLView extends GLSurfaceView implements View.OnTouchListener { private Path clippingPath; public SampleGLView(Context context) { this(context, null); }

How to make Circular Mask and Clip GLSurfaceView?

倖福魔咒の 提交于 2020-01-14 09:01:10
问题 I work with an SDK that provides a rectangular GLSurfaceView through a callback. I want to be able to render this view in a circular layout. (i.e.) I would like to display the view on a circular view It's showing Circle shape when I overlay GLSurfaceView over ImageView GLSurfaceView over ImageView It's showing Square shape when I overlay GLSurfaceView over VideoView . GLSurfaceView over VideoView I have tried below code for making circle GLSurfaceView public class SampleGLView extends

Divide the screen into SurfaceView and xml layout

懵懂的女人 提交于 2020-01-13 09:42:31
问题 MyActivity has setContentView(MySurfaceView) that covers all the screen. I would like to divide the screen into two parts: the first 2/3 of the screen must be occupied by MySurfaceView and the last 1/3 by my_activity_layout.xml . How can I do that? Thanks. EDIT Thanks for your answers, but I don't have how to apply them in my case. To be clear, these are my objects: 回答1: Solution: To attach an xml file in your layout, you can make use of the <include> tag. Reusing layouts is particularly