Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio filetype fallback stops working #1

Open
YaguangZhang opened this issue Mar 12, 2017 · 3 comments
Open

Audio filetype fallback stops working #1

YaguangZhang opened this issue Mar 12, 2017 · 3 comments

Comments

@YaguangZhang
Copy link

YaguangZhang commented Mar 12, 2017

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!

@X-Raym
Copy link
Owner

X-Raym commented Mar 12, 2017

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 !

@YaguangZhang
Copy link
Author

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.

@X-Raym
Copy link
Owner

X-Raym commented Mar 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants