How to add frames of multiple videos in a timeline view in android?

Viewed 851

I'm developing an app just like Inshot App in which i'm selecting both videos and images to make one video file in the last after editing process. When I'm selecting both, Images have to convert first into the video, so i've converted it. I have already done coding for displaying frames of only one video in a timeline view as i've used videoview to display that video w.r.t to frames,Videoview can only get one uri.Now i want to display multiple videos as i selected. Please help me to do this. Thanks & Regards.

We can't merge those multiple videos before displaying those videos in a editor.we can only merge those after editing.

Here is the screenshot of Inshot app in which multiple videos can be placed side by side in a timeline view.

InShot App Screenshot

Here is my code for showing only one video in frames.

for(int i=0;i<uriPaths.size();i++) {
            if (uriPaths.get(i).contains(".jpg") ||uriPaths.get(i).contains(".jpeg")||uriPaths.get(i).contains(".JPG") ||uriPaths.get(i).contains(".JPEG")|| uriPaths.get(i).contains(".png")||uriPaths.get(i).contains(".PNG")) {
                vPath=getVideoFilePath();
                int finalI = i;
                listener=new EncodeListener() {
                    @Override
                    public void onProgress(float v) {

                    }

                    @Override
                    public void onCompleted() {
                        // exportMp4ToGallery(this, vPath);
                        runOnUiThread(new Thread(new Runnable() {
                            @Override
                            public void run() {

                                uris = Uri.fromFile(new File(String.valueOf(vPath)));

                                String replacedStr = String.valueOf(uris).replaceAll("%5B/", "");
                                replacedStr = String.valueOf(replacedStr).replaceAll("%5D", "");

                                mVideoView.setVideoURI(Uri.parse(replacedStr));
                                mVideoView.requestFocus();


                                mTimeLineView.setVideo(Uri.parse(replacedStr));

                                setMaxDuration(mMaxDuration);
                                setUpListeners();
                                setUpMargins();

                            }
                        })
                        );



                    }

                    @Override
                    public void onFailed(Exception e) {

                    }
                };
                duration= TimeUnit.SECONDS.toMicros(5);

                imageToVideo=new ImageToVideoConverter(vPath,uriPaths.get(i),listener,size=new Size(720,720),duration);
              imageToVideo.start();
            }
            else {

                uris = Uri.fromFile(new File(String.valueOf(uriPaths)));

                String replacedStr = String.valueOf(uris).replaceAll("%5B/", "");
                replacedStr = String.valueOf(replacedStr).replaceAll("%5D", "");
                mVideoView.setVideoURI(Uri.parse(replacedStr));
                mVideoView.requestFocus();

                mTimeLineView.setVideo(Uri.parse(replacedStr));

                setMaxDuration(mMaxDuration);
                setUpListeners();
                setUpMargins();
            }
        }
0 Answers
Related