Closed obenland closed 7 years ago
@obenland Can you elaborate further? You can currently upload and select the alternative sources:
Right, so when the original file is of one of these three formats, could we not just automatically set it as an alternate source? (even though it's not really alternate)
Good point. If I select an MP4 to begin with, actually I think then that there shouldn't even be an “MP4” button shown since there is no need alternative. I think this would be better than pre-populating the MP4 alternative source, since then you could click to remove the alternative source and that wouldn't make sense.
Would this apply to the audio widget as well? Here is a screen grab for editing audio on an mp3 file:
It does, yes
It's true that this issue does reflect a core deficiency in the media JS, so it would probably be better to fix in core rather than focus on patching it in the plugin only.
We do need to revisit this. I just tried inserting an MP4 into a post and it generated a shortcode:
[video width="480" height="270" mp4="http://src.wordpress-develop.dev/wp-content/uploads/2017/04/echo-hereweare.mp4"][/video]
Note that it used the mp4
attribute and not the url
attribute. As such, when editing the video it showed with that source pre-selected:
By not using the url
field, we'll have to make some changes in how we detect in the base media widget for whether or not a selection has been made or not. Namely logic like this in \WP_Widget_Media::widget()
will need to be changed or made extensible (the $instance['url']
part):
// Short-circuit if no media is selected.
if ( ( ! $instance['attachment_id'] || 'attachment' !== get_post_type( $instance['attachment_id'] ) ) && ! $instance['url'] ) {
return;
}
So it seems there are a few different issues at play here ( too early in the AM for puns? ) - so to summarize:
Shall we break out all of these into individual issues?
I think all of these 3 issues are closely related and will be resolved by just just opting to use the video extension prop (e.g. mp4
) instead of only using url
.
This may be out of the scope for media widgets, but when using an audio or video file, the edit screen allows users to upload and select alternative sources for full html5 availability.
In the case of video, when selecting a mp4 or ogv or webm file, we could automatically set those as alternative sources.
This might not make a difference to the html5 compatibility, but it's one less thing a user has to worry about.