Giter Site home page Giter Site logo

Comments (15)

a914-gowtham avatar a914-gowtham commented on June 5, 2024 1

thanks @gifandadelasty you made day. I have fixed this and added some fixes for android 13 in v1.7.14

from android-video-trimmer.

hsinha76 avatar hsinha76 commented on June 5, 2024

Getting same issue.

from android-video-trimmer.

a914-gowtham avatar a914-gowtham commented on June 5, 2024

@Narendrakumar-Vanamala @hsinha76 Could you share the device detail and library version?

from android-video-trimmer.

Narendrakumar-Vanamala avatar Narendrakumar-Vanamala commented on June 5, 2024

Am checking Samsung Galaxy- A30S - Android 11 Version

from android-video-trimmer.

a914-gowtham avatar a914-gowtham commented on June 5, 2024

this issue had been fixed in 1.7.0. Could you share the library version?

from android-video-trimmer.

hsinha76 avatar hsinha76 commented on June 5, 2024

Xioami Note 4
Android version 7.0

from android-video-trimmer.

Narendrakumar-Vanamala avatar Narendrakumar-Vanamala commented on June 5, 2024

this issue had been fixed in 1.7.0. Could you share the library version

Am using 1.7.0 version and yesterday i debug here are the obsevation

Library working demo i verified it am getting file path as content://media/external/video/media/1583 but my application returns some different path as /storage/emulated/0/Android/data/packagename/cache/test.mp4.

Please suggest and help me for the above fix.

from android-video-trimmer.

a914-gowtham avatar a914-gowtham commented on June 5, 2024

Before, 1.5.11 there was an option to store video files in the storage folder wherever we want. In 1.5.11 I removed write permission due to the android 11 storage changes.

Demo app uses an older version than 1.5.11.

Now Trimmed videos are stored as a cache file because it doesn't need any write permission, won't be showing in the gallery as a video file and I thought it would be fine. since most use cases will be just uploading the trimmed video file to the server.

from android-video-trimmer.

Narendrakumar-Vanamala avatar Narendrakumar-Vanamala commented on June 5, 2024

Before, 1.5.11 there was an option to store video files in the storage folder wherever we want. In 1.5.11 I removed write permission due to the android 11 storage changes.

Demo app uses an older version than 1.5.11.

Now Trimmed videos are stored as a cache file because it doesn't need any write permission, won't be showing in the gallery as a video file and I thought it would be fine. since most use cases will be just uploading the trimmed video file to the server.

I checked latest version too, am getting the same issue. shall I change the video save location ? Please suggest on this.

It would be great help me on how to store video file location in Android-11 and i need to pass that location to TrimActivity.

from android-video-trimmer.

a914-gowtham avatar a914-gowtham commented on June 5, 2024

You can't change video location.

  1. Do you still get getRealPath null issue?
  2. Share your use case I will try to find a workaround

from android-video-trimmer.

Narendrakumar-Vanamala avatar Narendrakumar-Vanamala commented on June 5, 2024

Yes, am getting null

Here is the my usecase

We have two options one is record a video and trim the video and other one is pick video from gallery and trim.
Now am passing video storage URLto openTrimActivity(), after that am getting null from getRealPath() method.

Here the below format am passing storage URL to openTrimActivity()
ex: /storage/emulated/0/Android/data/packagename/cache/test.mp4.

Let me know any other details if required.

from android-video-trimmer.

a914-gowtham avatar a914-gowtham commented on June 5, 2024

@Narendrakumar-Vanamala Can try passing uri string instead of filepath

from android-video-trimmer.

Narendrakumar-Vanamala avatar Narendrakumar-Vanamala commented on June 5, 2024

from android-video-trimmer.

gifandadelasty avatar gifandadelasty commented on June 5, 2024

Hello..
I'm getting same issue.. I'm developing app that allow user to take video or pick from gallery, but after video taken and video saved in storage Video Trimmer facing error with this details :

java.lang.NullPointerException: Attempt to invoke interface method 'int android.database.Cursor.getColumnIndexOrThrow(java.lang.String)' on a null object reference
at com.gowtham.library.utils.FileUtils.getRealPath(FileUtils.java:26)
at com.gowtham.library.ui.ActVideoTrimmer.lambda$setDataInView$4$com-gowtham-library-ui-ActVideoTrimmer(ActVideoTrimmer.java:217)
at com.gowtham.library.ui.ActVideoTrimmer$$ExternalSyntheticLambda11.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

This is code in CreatorActivity.kt :

// --- START TRIM VIDEO ---
TrimVideo.activity(videoUri.toString())
.setCompressOption(CompressOption(30, "1M", 480, 640))
.setTrimType(TrimType.MIN_MAX_DURATION)
.setMinToMax(10, 120)
.start(this, startTrimVideoForResult)

videoUri is an Uri, and it converted to string with toString() to become:
"/storage/emulated/0/AppName/Camera/video_2023Jun24_2209.mp4"

I have try using Uri.fromFile() that suggested by @Narendrakumar-Vanamala , but still getting this NullException..

Thanks for your help..

from android-video-trimmer.

gifandadelasty avatar gifandadelasty commented on June 5, 2024

Hi bro..
I have solved this.. This library needs Content Uri instead of File Path. So, if the video come from CameraActivity.kt first its need to converted to content Uri before calling TrimVideo activity..

Before : "/storage/emulated/0/AppName/Camera/video_2023Jun24_2209.mp4" (getRealPath getting Null)

Converting to Content Uri:
[ KOTLIN ]
val videoFile = File("/storage/emulated/0/VideoPath/example_video.mp4")
val projection = arrayOf(videoFile.absolutePath)
MediaScannerConnection.scanFile(context, projection, null) { path, contentUri ->
// --- TrimVideo.activity(contentUri.toString()) ---
}

[ JAVA ]
File videoFile = new File("/storage/emulated/0/VideoPath/example_video.mp4");
String[] projection = { videoFile.getAbsolutePath() };
MediaScannerConnection.scanFile(context, projection, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri contentUri) {
// --- TrimVideo.activity(contentUri.toString()) ---
}
});

After : "content://media/external/video/media/####" (Its WORKED)

Thank you for the great library @a914-gowtham 👍

Reference : https://stackoverflow.com/a/53349110/18410044

from android-video-trimmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.