[wp-trac] [WordPress Trac] #40590: wp_video_shortcode always adds controls="controls"

WordPress Trac noreply at wordpress.org
Fri Apr 28 12:59:08 UTC 2017


#40590: wp_video_shortcode always adds controls="controls"
-----------------------------------+------------------------------
 Reporter:  paulschreiber          |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  General                |     Version:  4.7.4
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------

Comment (by subrataemfluence):

 @psiico First of all thank you so much for testing the patch. When we use
 `wp_video_shortcode` like this
 {{{#!php
 [video src="https://www.youtube.com/watch?v=NhheiPTdZCw"]
 }}}

 by default WordPress adds the controls attribute as per the function in
 media.php (if I have understood right) without the patch implemented. The
 patch worked for me for the above video URL in both occasions, i.e. by
 passing controls="false" and not adding this attribute at all. Anything
 else, e.g. controls="true" adds the attribute in markup.

 This is how the markup gets generated (with / without the attribute).
 `wp_video_shortcode` does not actually render a frame rather it creates a
 HTML5 markup.

 When I pass `controls="true"`, i.e.

 {{{#!php
 [video src="https://www.youtube.com/watch?v=NhheiPTdZCw" controls="true"]
 }}}

 the rendered output is like this:


 {{{
 <video class="wp-video-shortcode" id="video-802-1" width="640"
 height="360" preload="metadata" controls="controls"><source
 type="video/youtube"
 src="https://www.youtube.com/watch?v=NhheiPTdZCw&_=1" /><a
 href="https://www.youtube.com/watch?v=NhheiPTdZCw">https://www.youtube.com/watch?v=NhheiPTdZCw</a></video>
 }}}


 and when I pass `controls="false"`, i.e.

 {{{#!php
 [video src="https://www.youtube.com/watch?v=NhheiPTdZCw" controls="false"]
 }}}

 or just

 {{{#!php
 [video src="https://www.youtube.com/watch?v=NhheiPTdZCw"]
 }}}

 the output is:


 {{{
 <video class="wp-video-shortcode" id="video-802-1" width="640"
 height="360" preload="metadata" ><source type="video/youtube"
 src="https://www.youtube.com/watch?v=NhheiPTdZCw&_=1" /><a
 href="https://www.youtube.com/watch?v=NhheiPTdZCw">https://www.youtube.com/watch?v=NhheiPTdZCw</a></video>
 }}}

 In latter two cases the WordPress is not adding `controls="controls"` in
 the markup.

 Would you please tell me how I can reproduce your way of testing?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40590#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list