Skip to content

VideoMetadata.duration returns seconds instead of milliseconds on MacOS #153

@jarvislin

Description

@jarvislin

Sumary

Currently, VideoMetadata.duration is documented / expected to return the video duration in milliseconds (ms). However, in practice, the value returned is in seconds.

After investigation, the duration ultimately comes from AVPlayerItem.duration on macOS, which is a CMTime. The value is converted using CMTimeGetSeconds(...), which by definition returns a Double in seconds, not milliseconds.

This results in a unit mismatch between the API contract and the actual behavior, which can easily lead to incorrect calculations (e.g. progress bars, seek positions, or cross-platform duration handling).

Expected behavior

VideoMetadata.duration should return the duration in milliseconds, as originally intended.

Actual behavior

VideoMetadata.duration returns a value in seconds.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions