{"id":367,"date":"2016-11-02T06:03:30","date_gmt":"2016-11-02T06:03:30","guid":{"rendered":"http:\/\/angelwings.net\/blog\/?p=367"},"modified":"2016-11-02T06:03:30","modified_gmt":"2016-11-02T06:03:30","slug":"wordpress-responsive-video-mp4-video-inserted-from-media-library","status":"publish","type":"post","link":"https:\/\/angelwings.net\/blog\/wordpress-responsive-video-mp4-video-inserted-from-media-library\/","title":{"rendered":"WordPress: Responsive video (mp4 video inserted from media library)"},"content":{"rendered":"<p>Changed the wordpress wp-includes\/media.php file. Probably not the best way to do this.<br \/>\nRef: https:\/\/codex.wordpress.org\/Video_Shortcode<\/p>\n<p>At around line 2504, comment out the following:<\/p>\n<pre><code>$html_atts = array(\n\t'class'    =&gt; $atts['class'],\n\t'id'       =&gt; sprintf( 'video-%d-%d', $post_id, $instance ),\n\t'width'    =&gt; $atts['width'],\n\t\/\/'width'    =&gt; absint( $atts['width'] ),\n\t\/\/'height'   =&gt; absint( $atts['height'] ),\n\t'poster'   =&gt; esc_url( $atts['poster'] ),\n\t'loop'     =&gt; wp_validate_boolean( $atts['loop'] ),\n\t'autoplay' =&gt; wp_validate_boolean( $atts['autoplay'] ),\n\t'preload'  =&gt; $atts['preload'],\n);<\/code><\/pre>\n<p>At around line 2565, comment out the following and add code:<\/p>\n<pre><code>if ( ! empty( $atts['width'] ) ) {\n\/\/\t$width_rule = sprintf( 'width: %dpx; ', $atts['width'] );\n\t$width_rule = '';\n}<\/code><\/pre>\n<p>Added additional CSS styles to make it work.<\/p>\n<pre><code>video {\n  width: 100%    !important;\n  height: auto   !important;\n}<\/code><\/pre>\n<p>Source: https:\/\/css-tricks.com\/NetMag\/FluidWidthVideo\/Article-FluidWidthVideo.php<br \/>\nhttps:\/\/coolestguidesontheplanet.com\/videodrome\/youtube\/<\/p>\n<p>While we&#8217;re at it, also centralize the video with this CSS<\/p>\n<pre><code>.wp-video { display:block; margin: 0 auto; }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Changed the wordpress wp-includes\/media.php file. Probably not the best way to do this. Ref: https:\/\/codex.wordpress.org\/Video_Shortcode At around line 2504, comment out the following: $html_atts = array( &#8216;class&#8217; =&gt; $atts[&#8216;class&#8217;], &#8216;id&#8217; =&gt; sprintf( &#8216;video-%d-%d&#8217;, $post_id, $instance ), &#8216;width&#8217; =&gt; $atts[&#8216;width&#8217;], \/\/&#8217;width&#8217; =&gt; absint( $atts[&#8216;width&#8217;] ), \/\/&#8217;height&#8217; =&gt; absint( $atts[&#8216;height&#8217;] ), &#8216;poster&#8217; =&gt; esc_url( $atts[&#8216;poster&#8217;] ), &#8216;loop&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[122,131],"class_list":["post-367","post","type-post","status-publish","format-standard","hentry","category-cms","tag-video","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/comments?post=367"}],"version-history":[{"count":0,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/367\/revisions"}],"wp:attachment":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/media?parent=367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/categories?post=367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/tags?post=367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}