fix size video con poster

This commit is contained in:
Lorenzo Giacomelli
2017-04-03 15:30:02 +02:00
parent 1a21975a55
commit 5118587dc0
8 changed files with 46 additions and 19 deletions
+4
View File
@@ -61,6 +61,10 @@ GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_USER,"photoswipe-ui-default.
GUIHandlerMobile::addJavascriptLib(GUIHandlerMobile::JAVASCRIPT_USER,"photoswipe.min.js");
GUIHandlerMobile::addJavascriptLib(GUIHandlerMobile::JAVASCRIPT_USER,"photoswipe-ui-default.min.js");
GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_GENERAL,"calls.js");
GUIHandlerMobile::addJavascriptLib(GUIHandlerMobile::JAVASCRIPT_USER,"calls.js");
/*
____ _ _ ____ _ ___ ____
| _ \| | | | __ )| | |_ _/ ___|
@@ -8,14 +8,17 @@ class MediaLocalVideo extends MediaRenderer{
}
public function asText(array $opt = array()){
$size = MediaRendererInterface::SIZE_ORIGINAL;
if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES)){
$size = self::$SIZES[self::SIZE_BIG];
if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES) && $opt["size"] != self::SIZE_ORIGINAL){
$size = self::$SIZES[$opt["size"]];
}
return '<div style="display:inline-block;" class="videoContainerForImageAppend"><video width="'.$size["width"].'" height="'.$size["height"].'" poster="data:image/gif,AAAA" preload="auto" controls >'.
'<source src="'.$this->getVideoLink($size).'" type=\'video/'.$this->getExtension().'; codecs="avc1.4D401E, mp4a.40.2"\'>'.
'</video></div>';
$loaderSize = self::$SIZES[self::SIZE_BIG];
return '<div style="position:relative;" class="videoContainerForImageAppend"><img class="poster" src="'.GUIHandler::getBaseUrl().'/images/loading.gif" style="width:'.$loaderSize["width"].'px;height:'.$loaderSize["height"].'px;background-color:black;position:absolute;top:0;left:0;" />'.
'<video width="'.$size["width"].'" preload="auto" controls style="visibility:hidden;">'.
'<source src="'.$this->getVideoLink($size).'" type=\'video/'.$this->getExtension().'; codecs="avc1.4D401E, mp4a.40.2"\'>'.
'</video></div>';
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

+15
View File
@@ -0,0 +1,15 @@
$(document).ready(function(event){
$("video").on('loadstart',function (event){
$(".poster").show();
});
$("video").on('canplay',function (event){
$(this).parent().find(".poster").hide();
$(this).css({"visibility":"visible"});
});
});
-14
View File
@@ -2,18 +2,4 @@ Highcharts.setOptions({
global : {
useUTC : false
}
});
$(document).ready(function(event){
$("video").on('loadstart',function (event){
var wid = $(this).innerWidth();
$(".videoContainerForImageAppend").append('<img src="images/loading.gif" class="poster" style="width:'+ wid +'px;background-color:black;"/>')
$(this).hide();
});
$("video").on('canplay',function (event){
$(".poster").hide();
$(this).show();
// $(this).get(0).play();
});
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

+14
View File
@@ -0,0 +1,14 @@
$(document).ready(function(event){
$("video").on('loadstart',function (event){
$(".poster").show();
});
$("video").on('canplay',function (event){
$(this).parent().find(".poster").hide();
$(this).css({"visibility":"visible"});
});
});
+5
View File
@@ -0,0 +1,5 @@
Highcharts.setOptions({
global : {
useUTC : false
}
});