I am making a view recorder class.Which can record a video(.mp4) of any view or view group(relative layout), and also record everything that is present inside this view group.
I have looked into mediaProjections API. But it screenRecords everything that is present on the screen including status bar etc.
I also tried using this solution.https://github.com/z4hyoung/ViewRecorder/tree/masterBut As my requirement is that my relative layout contains a video view. It records it as black container, because the video view extends a surface view and not able to get the content of the surface view.
This what my code looks like,This is the xml file I want to record the rootView here and all the children inside it. But not any sibling of rootView.
Looking for a generic solution to create a view/viewgroup recorder that can also record contents of the video view or any other surface view present inside as children of the view group.
<?xml version="1.0" encoding="utf-8"?><RelativeLayout 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"><RelativeLayout android:id="@+id/rootView" android:background="@android:color/holo_orange_dark" android:layout_width="match_parent" android:layout_height="match_parent"><VideoView android:id="@+id/videoView" android:layout_centerInParent="true" android:layout_width="match_parent" android:layout_height="300dp" /><SeekBar android:id="@+id/seekBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/videoView" android:layout_marginTop="16dp" /><LinearLayout android:id="@+id/mediaControls" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/seekBar" android:layout_centerHorizontal="true" android:layout_marginTop="16dp" android:orientation="horizontal"><Button android:id="@+id/btnRewind" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rewind" /><Button android:id="@+id/btnPlayPause" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Play" /><Button android:id="@+id/btnForward" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Forward" /><Button android:id="@+id/btnStartStopRecord" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/start_record" /></LinearLayout></RelativeLayout><TextView android:id="@+id/hiddenView" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="This text view should not come in the recorded video"/></RelativeLayout>
I also tried using this solution. https://github.com/z4hyoung/ViewRecorder/tree/master But As my requirement is that my relative layout contains a video view. It records it as black container, because the video view extends a surface view and not able to get the content of the surface view.