wavesurfer-wp icon indicating copy to clipboard operation
wavesurfer-wp copied to clipboard

Audio filetype fallback stops working

Open YaguangZhang opened this issue 8 years ago • 3 comments

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!

YaguangZhang avatar Mar 12 '17 18:03 YaguangZhang

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 !

X-Raym avatar Mar 12 '17 20:03 X-Raym

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 avatar Mar 13 '17 02:03 YaguangZhang

@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.

X-Raym avatar Mar 13 '17 02:03 X-Raym