fix size youtube video piccoli

prove con local video ristabilito preload auto
This commit is contained in:
Lorenzo Giacomelli
2017-03-29 12:40:56 +02:00
parent 9b9675304c
commit ac76651553
3 changed files with 8 additions and 3 deletions
@@ -13,7 +13,7 @@ class MediaLocalVideo extends MediaRenderer{
$size = self::$SIZES[$opt["size"]]; $size = self::$SIZES[$opt["size"]];
} }
return '<video width="'.$size["width"].'" height="'.$size["height"].'" controls >'. return '<video width="'.$size["width"].'" height="'.$size["height"].'" preload="auto" controls >'.
'<source src="'.$this->getVideoLink($size).'" type="video/'.$this->getExtension().'" >'. '<source src="'.$this->getVideoLink($size).'" type="video/'.$this->getExtension().'" >'.
'</video>'; '</video>';
} }
@@ -8,8 +8,12 @@ class MediaYoutube extends MediaRenderer{
} }
public function asText(array $opt = array()){ 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[$opt["size"]];
}
// return $this->link; // return $this->link;
return '<iframe itemprop="video" src="'.$this->getVideoLink().'" frameborder="0"></iframe>'; return '<iframe itemprop="video" width='.$size["width"].' height='.$size["height"].' src="'.$this->getVideoLink().'" frameborder="0"></iframe>';
// return '<iframe width="560" height="315" src="https://www.youtube.com/embed/4qkv-iy_MaQ" frameborder="0" allowfullscreen></iframe>'; // return '<iframe width="560" height="315" src="https://www.youtube.com/embed/4qkv-iy_MaQ" frameborder="0" allowfullscreen></iframe>';
} }
+2 -1
View File
@@ -15,7 +15,8 @@ if (array_key_exists("id",$_GET)) {
$videoPath= $basepath."/".$video->id.".".$video->extension; $videoPath= $basepath."/".$video->id.".".$video->extension;
$lenght = filesize($videoPath); $lenght = filesize($videoPath);
header('Content-type: '.mime_content_type($videoPath));
header('Content-Type: '.mime_content_type($videoPath));
header('Content-Lenght: '.$lenght); header('Content-Lenght: '.$lenght);
readfile($videoPath); readfile($videoPath);
} }