Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#43263 new enhancement

wp_audio_shortcode() preload default: should it be metadata or none?

Reported by: hearvox's profile hearvox Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.6
Component: Media Keywords:
Focuses: Cc:

Description

Using this ticket to open a discussion about the audio tag’s preload attribute defaulting to
none in wp_audio_shortcode().

none won’t display the audio’s total time in the player (until the user hits play). So the effect of this default is millions of sites’ players display total times of “00:00”. (You can specify preload as a shortcode attr, but most sites don’t. )

Setting the preload attribute to metadata does extract and display total time upon page-load. Also metadata is both the wp_video_shortcode() default and the HTML-spec suggested default (to browser makers):
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#attr-preload

Bandwidth might be the valid concern, tho, as some browsers preload an excessive amount of metadata (I'm looking at you, Chrome) . See results of tests by @blobfolio:
https://wordpress.slack.com/archives/C02SX62S6/p1518116191000138

FYI, the default 'preload' => 'none' is here:
https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/media.php#L2223

FYI-2, you can change that with the wp_audio_shortcode filter (via regex on the HTML output):
https://gist.github.com/hearvox/098774e9887442d39ddc6e34bedb10b1

Change History (1)

#1 @blobfolio
7 years ago

It is also worth noting that while Chrome is a bit greedy, the default behavior for the browser is preload="metadata" https://googlechrome.github.io/samples/media/preload-metadata. So it should be behavior its users are familiar with.

Note: See TracTickets for help on using tickets.