-
Notifications
You must be signed in to change notification settings - Fork 383
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
Force videopress to use html5 player for AMP #1125
Conversation
Despite the code in this PR, I still see the validation warning, I'm not sure why... |
Ok, got it, it's because of this validation, so shortcodes are processed, but there is no way to hook to it for allowing modification for AMP. Maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Eventually the Jetpack-specific code will be merged into Jetpack code itself per #1021.
jetpack-helper.php
Outdated
} | ||
|
||
if ( isset( $_GET[ AMP_Validation_Utils::VALIDATE_QUERY_VAR ] ) ) { // WPCS: CSRF ok. | ||
add_filter( 'videopress_shortcode_options', 'amp_videopress_enable_freedom_mode' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary now that you have b6a4671 right?
@@ -590,6 +590,7 @@ public static function print_edit_form_validation_status( $post ) { | |||
|
|||
// If no results from URL are available, validate post content outside frontend context. | |||
if ( empty( $validation_errors ) && post_type_supports( $post->post_type, 'editor' ) ) { | |||
do_action( 'pre_amp_render_post', $post->ID ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have the phpdoc added to it on the line before:
/** This action is documented in amp.php */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure that this change applies when amp
theme support is present, there should be also something like this:
add_action( 'template_redirect', function() {
if ( is_amp_endpoint() ) {
amp_jetpack_mods();
}
}, 9 );
This could be used instead of the pre_amp_render_post
action.
@westonruter Thank you for the review, I'll address your comments tomorrow unless someone beats me to it. I'm not really clear what you meant by your comment here though: Why hooking to |
@yurynix In v0.7 we've added So by doing |
@yurynix also, you may want to rebase your commits onto the |
@@ -590,6 +590,7 @@ public static function print_edit_form_validation_status( $post ) { | |||
|
|||
// If no results from URL are available, validate post content outside frontend context. | |||
if ( empty( $validation_errors ) && post_type_supports( $post->post_type, 'editor' ) ) { | |||
do_action( 'pre_amp_render_post', $post->ID ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this changes can be reverted because this entire if
statement is going to be removed in #1132
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw that now, we can drop my last 2 commits, sorry for the noise.
…_render_post" This reverts commit 658377b.
…pport * Remove obsolete filter addition for videopress_shortcode_options when validate query var is present. * Add missing phpdoc. * Clean up phpcs issues.
b6a4671
to
145991d
Compare
@yurynix I've rebased onto |
Thank you for all the explanation and the work here @westonruter . This is caused because of the code that validates the output don't call Which may be this workaround should be, a content embed handler, so I've pushed a commit to do just that, ideally, it should live in the Jetpack plugin with the rest of the workarounds. |
…orce-videopress-use-html5
d7668fb
to
3903e1a
Compare
I've tested it and it works great 👍 |
Videopress embed uses an
iframe
and ascript
tag,script
tag is not allowed in AMP, so it's stripped and a warning is generated.This PR tries to force html5 player, so the player would be actually a
<video />
tagthat would be converted to
<amp-video />
.