Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Duration parameter is broken on Android #127

Open
vanfresh opened this issue Aug 1, 2021 · 3 comments · May be fixed by #133
Open

Bug: Duration parameter is broken on Android #127

vanfresh opened this issue Aug 1, 2021 · 3 comments · May be fixed by #133

Comments

@vanfresh
Copy link

vanfresh commented Aug 1, 2021

  Future<MediaInfo?> compressVideo(
    String path, {
    VideoQuality quality = VideoQuality.DefaultQuality,
    bool deleteOrigin = false,
    int? startTime,
    int? duration,
    bool? includeAudio,
    int frameRate = 30,
  }) 

Duration is broken in Android. I tried using seconds and milliseconds for the parameter. If I use seconds, it will trim the video to less than 1 second for a 10 second video. If I use milliseconds, it will run into negative value territory from being to large.

@vanfresh vanfresh changed the title Bug: Duration parameter is broken in Android Bug: Duration parameter is broken on Android Aug 1, 2021
@hazzo
Copy link

hazzo commented Sep 16, 2021

Anything?

@hazzo
Copy link

hazzo commented Sep 17, 2021

I found out that using a video with seconds and dividing it by 100 and rounding it up (does not support double the duration parameter) it works. The issue here is that it may make videos longer if they are for example 11 seconds.

I think the issue is in the android plugin here:

  val dataSource = if (startTime != null || duration != null){
      val source = UriDataSource(context, Uri.parse(path))
      TrimDataSource(source, (1000 * 1000 * (startTime ?: 0)).toLong(), (1000 * 1000 * (duration ?: 0)).toLong())
  }else{
      UriDataSource(context, Uri.parse(path))
  }

For some reason TrimDataSource does not like the transformation to microseconds.

@hazzo hazzo linked a pull request Sep 17, 2021 that will close this issue
@SunilAG2021
Copy link

yes duration is not work

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

Successfully merging a pull request may close this issue.

3 participants