Mdale has uploaded a new change for review. https://gerrit.wikimedia.org/r/66551
Change subject: Pop up videos set the autoplay attribute to true ...................................................................... Pop up videos set the autoplay attribute to true Change-Id: If0ee932c49946e7040aa46ca76e2fffb6d2acb0a --- M TimedMediaTransformOutput.php 1 file changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler refs/changes/51/66551/1 diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php index 17a21e8..2d89919 100644 --- a/TimedMediaTransformOutput.php +++ b/TimedMediaTransformOutput.php @@ -150,12 +150,14 @@ * @return string */ function getImagePopUp(){ + // pop up videos set the autoplay attribute to true: + $autoPlay = true; return Xml::tags( 'div' , array( 'id' => self::PLAYER_ID_PREFIX . TimedMediaTransformOutput::$serial++, 'class' => 'PopUpMediaTransform', 'style' => "width:" . $this->getPlayerWidth() . "px;height:" . $this->getPlayerHeight() . "px", - 'data-videopayload' => $this->getHtmlMediaTagOutput( $this->getPopupPlayerSize() ), + 'data-videopayload' => $this->getHtmlMediaTagOutput( $this->getPopupPlayerSize(), $autoPlay ), ), Xml::tags( 'img', array( 'alt' => $this->file->getTitle(), @@ -192,9 +194,10 @@ * Call mediaWiki xml helper class to build media tag output from * supplied arrays * @param $sizeOverride array + * @param $autoPlay boolean sets the autoplay attribute * @return string */ - function getHtmlMediaTagOutput( $sizeOverride = array() ){ + function getHtmlMediaTagOutput( $sizeOverride = array(), $autoPlay = false ){ // Try to get the first source src attribute ( usually this should be the source file ) $mediaSources = $this->getMediaSources(); $firstSource = current( $mediaSources ); @@ -233,7 +236,7 @@ 'class' => 'mediaContainer', 'style' => 'position:relative;display:block;width:'. $width ), - Html::rawElement( $this->getTagName(), $this->getMediaAttr( $sizeOverride ), + Html::rawElement( $this->getTagName(), $this->getMediaAttr( $sizeOverride, $autoPlay ), // The set of media sources: self::htmlTagSet( 'source', $mediaSources ) . @@ -283,7 +286,7 @@ * @param $sizeOverride Array|bool of width and height * @return array */ - function getMediaAttr( $sizeOverride = false ){ + function getMediaAttr( $sizeOverride = false, $autoPlay = false ){ global $wgVideoPlayerSkin ; // Normalize values $length = floatval( $this->length ); @@ -316,6 +319,10 @@ // tell browser to not load the video before 'preload'=>'none', ); + if( $autoPlay === true ){ + $mediaAttr['autoplay'] = 'true'; + } + // MediaWiki uses the kSkin class $mediaAttr['class'] = 'kskin'; -- To view, visit https://gerrit.wikimedia.org/r/66551 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If0ee932c49946e7040aa46ca76e2fffb6d2acb0a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: Mdale <md...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits