Audio filetype fallback stops working
The current version (v 2.7.1) of this plugin breaks the filetype fallback feature of the default WordPress [audio] shortcut. For example, only the .wav file will be included in the final HTML code for:
[audio mp3="source.mp3" ogg="source.ogg" wav="source.wav"]
It seems this issues is caused by lines 635-640 in wavesurfer-wp.php:
// Check audio type to determine the link
if ( isset( $attr['wav'] ) ) { $link = $attr['wav']; }
if ( isset( $attr['mp3'] ) ) { $link = $attr['mp3']; }
if ( isset( $attr['m4a'] ) ) { $link = $attr['m4a']; }
if ( isset( $attr['ogg'] ) ) { $link = $attr['ogg']; }
if ( isset( $attr['src'] ) ) { $link = $attr['src']; }
But I'm not quite sure how to fix it. Could you please have a look? Thanks!
Hi ! Thanks for the report, I noticed it also see it missed WMA, which is natively, the list of supported extensions is filterable (and should work with wavesurfer as far as I know).
https://core.trac.wordpress.org/browser/tags/4.6.1/src/wp-includes/media.php#L2106
If attr check has to be recoded to support fallback, then maybe having something closer to the native audio shortcode may be better, rather than this simple check.
https://core.trac.wordpress.org/browser/tags/4.6.1/src/wp-includes/media.php#L2220
But it would require a bit more time investment to understand how it works.
I may consider it later, but meanwhile, any volunteer is free to propose a PHP fix :)
Cheers !
Thank you very much for your reply. I've initiated a pull request for the WMA support, but I'm new to both WordPress & PHP and the filetype fallback feature is way beyond my ability. Really sorry that I'm not able to contribute more in this case.
@YaguangZhang Don't worry, I may take care of this later, but I need to be more familiar with how it is supposed to work.