caricamento fix video preload

This commit is contained in:
Lorenzo Giacomelli
2017-04-03 13:21:13 +02:00
parent ac76651553
commit 1a21975a55
6 changed files with 59 additions and 5 deletions
@@ -13,9 +13,10 @@ class MediaLocalVideo extends MediaRenderer{
$size = self::$SIZES[$opt["size"]];
}
return '<video width="'.$size["width"].'" height="'.$size["height"].'" preload="auto" controls >'.
'<source src="'.$this->getVideoLink($size).'" type="video/'.$this->getExtension().'" >'.
'</video>';
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>';
}
public function render(array $opt = array()){
+11
View File
@@ -409,7 +409,18 @@ if(sizeof($medias)>0){
?>
$(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();
// });
$("#submit").click(function (){
// $("form#commentoForm").submit(function (){
$.ajax({
+12
View File
@@ -446,3 +446,15 @@ catch (Exception $ex){
GUIHandler::generateGoogleAnalyticsScripts();
?>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("video").on('loadstart',function (event){
$(this).addClass("loading");
});
$("video").on('canplay',function (event){
$(this).removeClass("loading");
$(this).attr('poster','');
});
});
</script>
+14
View File
@@ -2,4 +2,18 @@ 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();
});
});
+15 -1
View File
@@ -283,4 +283,18 @@ CATEGORY SUMMARY
.middleBanner img {
height: 100%;
width: 100%;
}
}
/**
DISABILITAZIONE TASTO DOWNLOAD DAL PLAYER VIDEO
*/
video::-internal-media-controls-download-button {
display:none;
}
video::-webkit-media-controls-enclosure {
overflow:hidden;
}
video.loading{background:black url(../images/loading.gif) center center no-repeat;}
+3 -1
View File
@@ -621,4 +621,6 @@ video::-internal-media-controls-download-button {
video::-webkit-media-controls-enclosure {
overflow:hidden;
}
}
video.loading{background:yellow url(../images/loading.gif) center center no-repeat;}