[wp-trac] [WordPress Trac] #36680: Audio player with preload="metadata" shows incorrect duration for audio files 1 hour or longer
WordPress Trac
noreply at wordpress.org
Mon Sep 11 14:39:23 UTC 2017
#36680: Audio player with preload="metadata" shows incorrect duration for audio
files 1 hour or longer
--------------------------+------------------------------
Reporter: Dexterity | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 4.5.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by caercam):
Spent some time playing with this issue today, still happens with
WordPress 4.8.1. First it seemed to be a known --and solved-- bug from
MediaElement.js (See
[https://github.com/mediaelement/mediaelement/issues/1819 ticket] and
[https://github.com/mediaelement/mediaelement/pull/1826 PR]) so I tried
overriding the shipped MediaElement version (2.22.0) with the fixed
version (2.23.0), but after some fiddling I realized all that's needed for
the duration to be displayed properly is the correct time format. Adding
this snippet to my site did the job:
{{{#!php
<?php
add_filter( 'mejs_settings', 'change_mejs_time_format' ) );
function change_mejs_time_format( $mejs_settings ) {
$mejs_settings['timeFormat'] = 'hh:mm:ss';
return $mejs_settings;
}
}}}
It's worth noting that changing the time format applies to ''all'' media,
so you could end up with 10 second videos with a total time display
"00:00:10". @Dexterity if you're OK with that side-effect you can fix your
example site.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36680#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list