summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/theme-tools/responsive-videos.php')
-rw-r--r--plugins/jetpack/modules/theme-tools/responsive-videos.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos.php b/plugins/jetpack/modules/theme-tools/responsive-videos.php
index 61987a8d..9bd35dae 100644
--- a/plugins/jetpack/modules/theme-tools/responsive-videos.php
+++ b/plugins/jetpack/modules/theme-tools/responsive-videos.php
@@ -42,6 +42,11 @@ function jetpack_responsive_videos_embed_html( $html ) {
return $html;
}
+ // Short-circuit for AMP responses, since custom scripts are not allowed in AMP and videos are naturally responsive.
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return $html;
+ }
+
// The customizer video widget wraps videos with a class of wp-video
// mejs as of 4.9 apparently resizes videos too which causes issues
// skip the video if it is wrapped in wp-video.
@@ -79,6 +84,11 @@ function jetpack_responsive_videos_maybe_wrap_oembed( $html, $url = null ) {
return $html;
}
+ // Short-circuit for AMP responses, since custom scripts are not allowed in AMP and videos are naturally responsive.
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return $html;
+ }
+
$jetpack_video_wrapper = '<div class="jetpack-video-wrapper">';
$already_wrapped = strpos( $html, $jetpack_video_wrapper );