[wp-trac] [WordPress Trac] #61398: Missing src attribute on <audio> tag prevents m4a audio files playing in safari.
WordPress Trac
noreply at wordpress.org
Thu Jun 13 12:37:37 UTC 2024
#61398: Missing src attribute on <audio> tag prevents m4a audio files playing in
safari.
--------------------------+------------------------------
Reporter: ericmulder | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by mai21):
== Test Report
=== Description
This report validates that the indicated patch works as expected.
Patch tested: Adding patch code in code snippet
{{{
function peek_audio_shortcode($html, $atts, $audio, $post_id, $library) {
// check if the <audio> tag has a src attribute (use a preg match
<audio src="" >). If not, get the first <source> tag
if (!preg_match('/<audio[^>]*src\s*=\s*"[^"]*"[^>]*>/', $html)) {
// get the first source tag
preg_match('/<source[^>]*src\s*=\s*"([^"]*)"[^>]*>/', $html,
$matches);
$src = $matches[1];
// now add the src="" to the audio tag
$html = preg_replace('/<audio/', '<audio src="' . $src . '"',
$html);
}
return $html;
}
add_filter('wp_audio_shortcode', 'peek_audio_shortcode', 10, 5);
}}}
=== Environment
- WordPress: 6.6-beta2-58396
- PHP: 8.3.6
- Server: nginx/1.24.0
- Database: mysqli (Server: 10.6.16-MariaDB-0ubuntu0.22.04.1-log / Client:
mysqlnd 8.3.6)
- Browser: Chrome 125.0.0.0
- OS: Linux
- Theme: Twenty Eleven 4.6
- MU Plugins: None activated
- Plugins:
* Code Snippets 3.6.5.1
* Test Reports 1.1.0
* WordPress Beta Tester 3.5.5
=== Actual Results
1. ✅ Issue resolved with patch => m4a is working either added by media
or shortcode
=== Additional Notes
- Tested on Chrome, Safari, Firefox and Opera
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61398#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list