Use MediaPlayer + SurfaceView to play video files MediaPlayer is mainly used to play audio and does not provide an image output interface, so you need to use other components to display the images played by MediaPlayer. You can use SurfaceView to display it. Surface and SurfaceHolder | Android Open Source Project | Android Open […]
Tag: surfaceview
Android uses Camera2 API and GLSurfaceView to implement camera preview
GLSurfaceView and SurfaceView are two view classes used to display images in Android. They have some differences in implementation and usage scenarios. Implementation method: GLSurfaceView is implemented based on OpenGL ES technology and can render images through OpenGL ES. SurfaceView uses a thread-based drawing method to perform drawing operations in independent threads. Performance: Because GLSurfaceView […]
Android MediaPlayer+SurfaceView+custom controller implements video playback
Android provides a variety of video playback methods, as follows: 1. MediaController + VideoView implementation This method is the simplest way to implement it. VideoView inherits SurfaceView and implements the MediaPlayerControl interface. MediaController is an auxiliary controller encapsulated by Android, with controls such as pause, play, stop, and progress bars. VideoView + MediaController can easily […]
Android application development (37) LTPO frame rate test based on Surfaceview
Android application development study notes – directory index Refer to the android official website: Frame rate | Android media | Android Developers Multiple Refresh Rates | Android Open Source Project | Android Open Source Project WindowManager.LayoutParams | Android Developers At present, the flagship mobile phones on the market are basically popularized with LTPO screens. In […]
Android application development (36) frame rate API test based on Surfaceview
Android application development study notes – directory index Refer to the android official website: Frame rate | Android media | Android Developers Multiple Refresh Rates | Android Open Source Project | Android Open Source Project WindowManager.LayoutParams | Android Developers Android 11 has added support for devices with multiple refresh rates. At present, flagship phones on […]
MediaPlay+SurfaceView realizes playing video
1. Introduce the common methods of MediaPlay class and SurfaceView: Common methods of the MediaPlay class: Method name function void seDataSource(String path) set data source (http/rtsp address) void seDataSource(FileDescriptor fd,long offset,long length ) Set data source void seDataSource(Context context,Uri uri) Set a Uri data source static MediaPlayercreate(Context context,int resid) Conveniently create MediaPlayer according to a […]
SurfaceView appears ANR: Surface has already been released solution
There is such a scene in the project that will cause ANR on SurfaceView. Create and use SurfaceView in the main Activity, and then enter the sub-ActivityB continuously, return to the main Activity and then enter the sub-ActivityB. In this cycle, ANR problems will occur. I found a pit by checking the source code of […]
Android uses SurfaceView to display Camera image climbing pit (2)
Preface The previous chapter “[Android uses SurfaceView to display Camera image climbing pit record (1) We have realized the use of SurfaceView to display the real-time frame images in the Camera. The main directory we do this is to take out the data of each frame After image processing by OpenCV, the processed image is […]
Android, is your SurfaceView dormant
This article has authorized the WeChat public account guolin_blog (Guo Lin) to publish exclusively I have used SurfaceView in my work recently, and found that I don’t have a systematic understanding of SurfaceView, and the online information is also some simple explanations, so here is a summary and I hope it will be helpful to […]
Android uses Kotlin to use SurfaceView+Camera in Fragment to realize the function of camera preview and photo saving and display
Controls required in the xml file of 1.fragment <Button android:id=”@ + id/btn_one” app:backgroundTint=”@color/white” android:text=”Click to take photo” android:textSize=”35sp” app:strokeColor=”@color/home_center_bg” android:layout_marginTop=”60dp” app:strokeWidth=”2dp” app:cornerRadius=”25dp” android:textColor=”@color/home_center_bg” android:layout_width=”200dp” android:layout_height=”80dp”/> <TextView android:id=”@ + id/tv_pic_dir” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”160dp” android:text=”Image path:” android:textColor=”#000000″ android:textSize=”14sp” /> <SurfaceView android:id=”@ + id/congig_access_SurfaceView” android:layout_width=”408dp” android:layout_height=”408dp” android:layout_marginTop=”205dp” app:round=”204dp” android:src=”@mipmap/door_icon” /> <ImageView android:id=”@ + id/iv_photo” android:layout_width=”200dp” android:layout_height=”200dp” android:layout_marginTop=”650dp” android:src=”@mipmap/door_icon” […]