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

Add support for .mov files (QuickTime video) #48

Open
reykjalin opened this issue Dec 29, 2022 · 2 comments
Open

Add support for .mov files (QuickTime video) #48

reykjalin opened this issue Dec 29, 2022 · 2 comments

Comments

@reykjalin
Copy link

As I was testing this add-on with the BuddyPress 11.0 RC I noticed that when I try to upload videos recorded on my iPhone the Activity page would tell me the file type is not supported:

image

I think this is because iPhones save videos as .mov files (video/quicktime) by default. Would it be possible to allow uploading .mov files to more seamlessly support uploads from Apple devices? Or at least add that as an option to the available settings?

According to this Apple Community question from 2019 MP4 and MOV files should practically identical but tbh I'm not sure if this has any compatibility implications.

I think the worst case is only Apple devices will be able to view those videos, but I would love to have the option to allow those videos even if that's the case. I would not expect this plugin to do any converting for compatibility purposes.

@imath
Copy link
Contributor

imath commented Dec 29, 2022

Hi @reykjalin

Thanks a lot for testing the plugin and for sharing your feedback. To get video format, BP Attachments is using the wp_get_video_extensions() WordPress function which only allows some video formats - I guess the ones that are the best compatible with the <video> HTML5 tag.

At this stage I'm unsure if we should allow the mov format, but you can easily make it possible for your specific Website putting the following code into a bp-custom.php file inside your /wp-content/plugins/ folder.

function bp_attachments_include_mov_extension( array $exts ) {
	return array_merge( $exts, array( 'mov' ) );
}
add_filter( 'wp_video_extensions', 'bp_attachments_include_mov_extension', 10, 1 );

Once done, head over to the Options tab of the BuddyPress Settings Administration screen to allow this file format from the Movie media type as shown below:

admin-screen

Save the settings, and then you'll be able to share mov files into BP Activities:

figcaption

As you can see above, your feedback made me improve a bit the Media output when these are audio or video files to make sure if the browser doesn't support the format, the user can still download it thanks to the mention under the media output.

See this commit a3760f3 for more information.

I'm going to leave this ticket open so that we get a chance to have more answers to this question: should we include the mov file to available video extensions (although WordPress don't) ?

@reykjalin
Copy link
Author

To get video format, BP Attachments is using the wp_get_video_extensions() WordPress function which only allows some video formats

Ah, that's where the video file extensions come from! I couldn't figure it out while reading through the code. The filter approach you suggested is definitely sufficient for what I need 🙂

your feedback made me improve a bit the Media output when these are audio or video files to make sure if the browser doesn't support the format, the user can still download it thanks to the mention under the media output.

That's an excellent addition, looks great 💯

should we include the mov file to available video extensions (although WordPress don't) ?

Personally I lean more towards sticking with WordPress defaults without any further context, especially since support for the extension can be added via filter. If MOV files are widely supported on all modern browsers and systems without any issues I think the extension should be added to the list returned from WordPress core.

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