TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/262989

Change subject: Output width and height attribs for <video>
......................................................................

Output width and height attribs for <video>

Since we are slowly moving to more proper html <video> output, add the
width and height attribs to <video> element. Not removing the style
base width and height yet, because it breaks the kalture player.

Change-Id: I0c3712a6677efffa12cf95283c9010bc2e7c42eb
---
M TimedMediaTransformOutput.php
1 file changed, 21 insertions(+), 21 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/89/262989/1

diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index 011aaa5..12bbd9c 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -321,13 +321,6 @@
                        }
                }
 
-               $width = $sizeOverride ? $sizeOverride[0] : 
$this->getPlayerWidth();
-               if ( $this->fillwindow ) {
-                       $width = '100%';
-               } else {
-                       $width .= 'px';
-               }
-
                if ( $wgTmhWebPlayer === 'videojs' ) {
                        // Build the video tag output:
                        $s = Html::rawElement( $this->getTagName(), 
$this->getMediaAttr( $sizeOverride, $autoPlay ),
@@ -344,6 +337,13 @@
                        );
                        return $s;
                } // else mwEmbed player
+
+               $width = $sizeOverride ? $sizeOverride[0] : 
$this->getPlayerWidth();
+               if ( $this->fillwindow ) {
+                       $width = '100%';
+               } else {
+                       $width .= 'px';
+               }
 
                // Build the video tag output:
                $s = Xml::tags( 'div', array(
@@ -404,14 +404,6 @@
                // The poster url:
                $posterUrl = $this->getUrl( $sizeOverride );
 
-               if ( $this->fillwindow ) {
-                       $width = '100%';
-                       $height = '100%';
-               } else {
-                       $width .= 'px';
-                       $height .= 'px';
-               }
-
                $mediaAttr = array(
                        'id' => self::PLAYER_ID_PREFIX . 
TimedMediaTransformOutput::$serial++,
                        // Get the correct size:
@@ -423,6 +415,9 @@
                        // Since we will reload the item with javascript,
                        // tell browser to not load the video before
                        'preload'=>'none',
+
+                       'width' => intval( $width ),
+                       'height' => intval( $height ),
                );
 
                if ( $autoPlay === true ) {
@@ -431,10 +426,7 @@
 
                if ( $wgTmhWebPlayer === 'videojs' ) {
                        $mediaAttr['class'] = 'video-js ' . $wgVideoPlayerSkin;
-                       $mediaAttr['width'] = $width;
-                       if ( $this->isVideo ) {
-                               $mediaAttr['height'] = $height;
-                       } else {
+                       if ( !$this->isVideo ) {
                                unset( $mediaAttr['height'] );
                                unset( $mediaAttr['poster'] );
                        }
@@ -443,10 +435,18 @@
                                $mediaAttr[ 'controls' ] = false;
                        }
                } else {
-                       $mediaAttr['style'] = "width:{$width}";
+                       if ( $this->fillwindow ) {
+                               $width = '100%';
+                               $height = '100%';
+                       } else {
+                               $width .= 'px';
+                               $height .= 'px';
+                       }
 
+                       // Yuck inline styles.. but fixing the script is too 
much work
+                       $mediaAttr['style'] = "width:{$width};";
                        if ( $this->isVideo ) {
-                               $mediaAttr['style'] .= ";height:{$height}";
+                               $mediaAttr['style'] .= ";height:{$height};";
                        }
 
                        // MediaWiki uses the kSkin class

-- 
To view, visit https://gerrit.wikimedia.org/r/262989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c3712a6677efffa12cf95283c9010bc2e7c42eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to