android-textureview

How to check a video has sound or not in Android?

这一生的挚爱 提交于 2019-12-11 14:36:30
问题 I am using a TextureView with a MediaPlayer to play an mp4 video from a url. Is there any way I can programatically check if the video I am playing has sound? Edit: I'm using API 14, so I don't have access to the MediaPlayer method getTrackInfo Many Thanks 回答1: In API level 16 or later, the MediaPlayer class has a getTrackInfo method that returns a TrackInfo[]. You could then call getTrackType for each element in the array and see if you get MEDIA_TRACK_TYPE_AUDIO . 来源: https://stackoverflow

How can i place dynamic image view over texture view?

瘦欲@ 提交于 2019-12-11 06:19:54
问题 This is my camera preview layout and i have a dynamic image view to show the thumbnail.I am not able to place the image view overlaping the texture view.How to do this?? <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000"> <LinearLayout android:id="@+id/thumbnails" android:layout_width="wrap_content" android:layout_height=

android textureview full screen preview with correct aspect ratio

家住魔仙堡 提交于 2019-12-04 18:01:26
问题 I have been working with the camera2 api demo from google and unfortunately the sample application is built to display the textureview preview at approximately 70% of the screen height, after looking around I was able to determine that this was being caused by the AutoFitTextureView overriding the onMeasure() method as shown below: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = MeasureSpec

android textureview full screen preview with correct aspect ratio

好久不见. 提交于 2019-12-03 11:19:35
I have been working with the camera2 api demo from google and unfortunately the sample application is built to display the textureview preview at approximately 70% of the screen height, after looking around I was able to determine that this was being caused by the AutoFitTextureView overriding the onMeasure() method as shown below: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); if (0 == mRatioWidth || 0

Need to display a camera preview inside a circular view

三世轮回 提交于 2019-12-02 17:23:32
问题 I need to implement a circular camera preview. I am using camera2 api with TextureView. I added the layout as follows: <FrameLayout> <TextureView/> <CircularImageView/> <FrameLayout/> Doing this I am getting the below result: As you can see, the camera preview is displayed in a square, but I want that to be a circular one, also keeping the yellow image in the background. How can I achieve this ? I did refer few examples on similar questions perviously asked but they are done using old camera

Need to display a camera preview inside a circular view

情到浓时终转凉″ 提交于 2019-12-02 09:54:33
I need to implement a circular camera preview. I am using camera2 api with TextureView. I added the layout as follows: <FrameLayout> <TextureView/> <CircularImageView/> <FrameLayout/> Doing this I am getting the below result: As you can see, the camera preview is displayed in a square, but I want that to be a circular one, also keeping the yellow image in the background. How can I achieve this ? I did refer few examples on similar questions perviously asked but they are done using old camera api and not TextureView. Any help is appreciated. Instead of CircularImageView, you need a regular

Playing video using textureview in recyclerview

a 夏天 提交于 2019-11-28 04:00:51
I am trying to implement a list with videos like vine or Instagram app. Where they play video plays when list item is shown or fully visible and video pauses when list item gets hided. I am using textureview with media player to play a video from url and added it as list item in recyclerview. Following is my code. VideosAdapter Class: public class VideosAdapter extends RecyclerView.Adapter<VideosAdapter.ViewHolder> { Context context; private ArrayList<String> urls; public static class ViewHolder extends RecyclerView.ViewHolder { public LinearLayout layout; public TextView textView; public