Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Crop Video with a special view #4

Open
anonym2 opened this issue Jan 5, 2021 · 1 comment
Open

Crop Video with a special view #4

anonym2 opened this issue Jan 5, 2021 · 1 comment

Comments

@anonym2
Copy link

anonym2 commented Jan 5, 2021

Hi first of all , thank you for your library . Im using your library to let my users crop their video in variables aspect ratio , im using this This CropVideoView as a replacement for your Simplecropview , the crop is not working corretly as it should , what im doing wrong ? Here s my code ` Uri fileUri = Uri.fromFile(new File(FinalSingleNewPath));
String destPath = getVideoFilePath();

                                        Log.e(TAG, "translateX = "+  mVideoCropView.getRealPositionX() + " translateY = "+  mVideoCropView.getRealPositionY() );
                                        Log.e(TAG, "resolution.width = "+mVideoCropView.getWidth()+" resolution.getHeight = "+mVideoCropView.getHeight());

                                        FillModeCustomItem fillModeCustomItem = new FillModeCustomItem(
                                                mVideoCropView.getScaleX(),
                                                mVideoCropView.getRotate(),
                                                (int) mVideoCropView.getRealPositionX(),
                                                (int) mVideoCropView.getRealPositionY(),
                                                mVideoCropView.getVideoWidth() ,
                                                mVideoCropView.getVideoHeight()
                                        );


                                        aftercorp.final_flash.EditPostFile.GlFilterGroup glFilterGroup;
                                        if(composerGlFilter == null) {
                                         composerGlFilter = new GlFilter();
                                        }

                                        glFilterGroup  = new GlFilterGroup(new GlFilter()); // the default filter
                                        Log.e(TAG, "currentGlFilter is null");


                           

                                        final Logger mylogger = new Logger() {
                                            @Override
                                            public void debug(String tag, String message) {
                                                Log.d(tag, message);
                                            }

                                            @Override
                                            public void error(String tag, String message, Throwable error) {
                                                Log.e(tag, "Message: "+message + ". Error: "+error.getLocalizedMessage());
                                            }

                                            @Override
                                            public void warning(String tag, String message) {
                                                Log.w(tag, message);
                                            }
                                        };


                                        mp4Composer = null;
                                        mp4Composer = new Mp4Composer(fileUri, destPath, SinglePicture.this, mylogger);
                                        mp4Composer
                                             .size(mVideoCropView.getWidth(), mVideoCropView.getHeight()) // Dont fake it anymore
                                                .fillMode(FillMode.CUSTOM)
                                                .customFillMode(fillModeCustomItem);



                                        if(composerGlFilter != null){
                                            mp4Composer.filter(composerGlFilter);
                                        }else{
                                            mp4Composer.filter(glFilterGroup);
                                        }

                                        mp4Composer.trim(0,  mVideoCropView.getDuration())
                                                .listener(new Mp4Composer.Listener() {
                                                    @Override
                                                    public void onProgress(double progress) {
                                                        Log.d(TAG, "onProgress = " + progress);
                                                        new Thread()
                                                        {
                                                            public void run()
                                                            {
                                                                CropVIdeo.this.runOnUiThread(new Runnable()
                                                                {
                                                                    public void run()
                                                                    {
                                                                        //Do your UI operations like dialog opening or Toast here
                                                                        Toast.makeText( CropVIdeo.this, "onProgress = " + progress, Toast.LENGTH_SHORT).show();
                                                                    }
                                                                });
                                                            }
                                                        }.start();
                                                    }

                                                    @Override
                                                    public void onCompleted() {
                                                        Log.d(TAG, "onCompleted()");

                                                        new Thread()
                                                        {
                                                            public void run()
                                                            {
                                                                CropVIdeo.this.runOnUiThread(new Runnable()
                                                                {
                                                                    public void run()
                                                                    {
                                                                        //Do your UI operations like dialog opening or Toast here
                                                                        Toast.makeText( CropVIdeo.this, "codec complete path = " + destPath, Toast.LENGTH_SHORT).show();
                                                                    }
                                                                });
                                                            }
                                                        }.start();
                                                    }

                                                    @Override
                                                    public void onCanceled() {
                                                        Log.d(TAG, "onCanceled");

                                                        new Thread()
                                                        {
                                                            public void run()
                                                            {
                                                                CropVIdeo.this.runOnUiThread(new Runnable()
                                                                {
                                                                    public void run()
                                                                    {
                                                                        //Do your UI operations like dialog opening or Toast here
                                                                        Toast.makeText( CropVIdeo.this, "videoProcessing onCanceled", Toast.LENGTH_SHORT).show();
                                                                    }
                                                                });
                                                            }
                                                        }.start();
                                                    }

                                                    @Override
                                                    public void onFailed(Exception exception) {
                                                        Log.e(TAG, "onFailed()", exception);

                                                        new Thread()
                                                        {
                                                            public void run()
                                                            {
                                                                CropVIdeo.this.runOnUiThread(new Runnable()
                                                                {
                                                                    public void run()
                                                                    {
                                                                        //Do your UI operations like dialog opening or Toast here
                                                                        Toast.makeText( CropVIdeo.this, exception.getMessage(), Toast.LENGTH_SHORT).show();

                                                                    }
                                                                });
                                                            }
                                                        }.start();

                                                    }
                                                });

                                        mp4Composer.start();

`

@ooyellow58
Copy link

Any solution? I am interested in your update.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants