I am developing an app which requires a video or an image to be inserted inside a PNG image frame with one or multiple videos, the image part of the program is working well since I can just convert the View into a bitmap and save it, the issue I face comes when I have to save the image frame with a video inside it, I am able to pick up a video and set it inside the Video-view as well but when trying to save it, I am left helpless. Since there is no way to convert a view into a video.
My layout:
<androidx.constraintlayout.widget.ConstraintLayout
android:id = "@+id/multiView"
android:layout_width = "match_parent"
android:layout_height = "0dp"
android:layout_weight = "1" >
<RelativeLayout
android:id = "@+id/relativeLayout"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<ImageView
android:id = "@+id/frame"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:scaleType = "fitXY"
android:src = "@drawable/flowerpower"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent" />
<FrameLayout
android:id = "@+id/stickerAdd"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout >
The constraintlayout is the parent view which has the other view like the PNG imageview and the stickerview, the images/video selected by the users are added dynamically to the position inside the blank space of a frame
Here is how I am saving the images with the frame :
View view = multiView;
view.setDrawingCacheEnabled ( true );
Bitmap bitmap = Bitmap.createBitmap ( view.getDrawingCache ( ) );
view.setDrawingCacheEnabled ( false );
File localFile = new File ( path , filename );
FileOutputStream outputStream = new FileOutputStream ( localFile );
bitmap.compress ( Bitmap.CompressFormat.JPEG , 100 , outputStream );
outputStream.flush ( );
outputStream.close ( );
MediaScannerConnection.scanFile ( this , new String[] { localFile.getAbsolutePath ( ) } ,
null , ( path1 , uri ) -> {
} );
Toasty.custom ( MainActivity.this , "Image Saved" , null ,
getColor ( R.color.colorPrimary ) , getColor ( R.color.colorAccent ) , Toast.LENGTH_SHORT ,
false , true ).show ( );
Can anyone help me in how to save this but as a video