30 lines
766 B
PHP
30 lines
766 B
PHP
<?php
|
|
|
|
class MediaLocalVideo extends MediaRenderer{
|
|
private $id;
|
|
|
|
public function __construct($model){
|
|
$this->id = $model->id;
|
|
}
|
|
|
|
public function asText(array $opt = array()){
|
|
$size = MediaRendererInterface::SIZE_ORIGINAL;
|
|
if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES)){
|
|
$size = $opt["size"];
|
|
}
|
|
|
|
return '<video width="'.$size["width"].'" height="'.$size["height"].'" controls >'.
|
|
'<source src="'.$this->getPath().'" type="video/'.$this->extension.'" >'.
|
|
'</video>';
|
|
}
|
|
|
|
public function render(array $opt = array()){
|
|
echo $this->asText($opt);
|
|
}
|
|
|
|
public function getPath(){
|
|
$basepath = GlobalVariables::get("config")->paths->media;
|
|
return $basepath."/".$this->id.".".$this->extension;
|
|
}
|
|
}
|
|
?>
|