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

Android : mediaInformation.duration returns second instead of millisecond #311

Closed
florianmlr opened this issue Jan 11, 2022 · 3 comments
Closed
Assignees
Labels
android Affect Android platform documentation-bug Documentation is missing or wrong fixed-in-react-native-v4.5.2 fixed-in-v5.1 library Affects the library v4.5 Affects v4.5 release v4.5.1 Affects v4.5.1 release

Comments

@florianmlr
Copy link

Description
In Android the method getDuration() returns a duration expressed in second instead of millisecond as mentionned in the documentation. (Only tested in Android)

    /**
     * Returns duration.
     *
     * @return media duration in milliseconds
     */
    public String getDuration() {
        return getStringProperty(KEY_DURATION);
    }

Expected behavior
The duration converted in millisecond

Current behavior
For a 31s video, I get this value : 31.180000

To Reproduce

val videoPath = // Your video path
val mediaInformation = FFprobeKit.getMediaInformation(videoPath)
val duration = mediaInformation.mediaInformation?.duration
println(duration)

Environment

  • Platform: Android
  • Architecture: arm64
  • Version: v4.5
  • Source branch: main
  • Android Studio version: 4.0
@tanersener tanersener added documentation-bug Documentation is missing or wrong v4.5.1 Affects v4.5.1 release android Affect Android platform v4.5 Affects v4.5 release library Affects the library labels Jan 11, 2022
@tanersener tanersener self-assigned this Jan 11, 2022
@tanersener
Copy link
Collaborator

tanersener commented Jan 11, 2022

We cannot change the type of the data returned from getDuration method. It is String as you can see from the source code.

However, it seems like its unit is not milliseconds as the docs say. We need to update the documentation.

@tanersener
Copy link
Collaborator

react-native v4.5.2 release includes the updated documentation for react-native platform.

Native platforms (Android, iOS, macOS, tvOS) also have the doc update on the development branch. It will be included in the next release.

@AkshayScott
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Affect Android platform documentation-bug Documentation is missing or wrong fixed-in-react-native-v4.5.2 fixed-in-v5.1 library Affects the library v4.5 Affects v4.5 release v4.5.1 Affects v4.5.1 release
Projects
None yet
Development

No branches or pull requests

3 participants