Currently there doesn't seem to be any consistent way to get the duration of a timed media file (such as video or audio), either through core query=imageinfo or TimedMediaHandler's modified query=videoinfo.
It looks like I can get the duration out of the metadata fields, but these are different for each format...
WebM has metadata entry 'playtime_seconds':
https://commons.wikimedia.org/w/api.php?action=query&titles=File:Fjordsteam.webm&prop=imageinfo&iiprop=url|size|mediatype|metadata&format=json
But Ogg has metadata entry 'length':
https://commons.wikimedia.org/w/api.php?action=query&titles=File:Folgers.ogv&prop=imageinfo&iiprop=url|size|mediatype|metadata&format=json
For now I can hardcode these two checks, but I'd much prefer a standard property on imageinfo.
Version: unspecified
Severity: enhancement
URL: https://commons.wikimedia.org/w/api.php?action=query&titles=File:Folgers.ogv&prop=imageinfo&iiprop=url|size|mediatype|metadata&format=json