28 lines
736 B
PHP
28 lines
736 B
PHP
<?php
|
|
|
|
class MediaYoutube extends MediaRenderer{
|
|
private $link;
|
|
|
|
public function __construct($model){
|
|
$this->link = $model->link;
|
|
}
|
|
|
|
public function asText(array $opt = array()){
|
|
// return $this->link;
|
|
return '<iframe itemprop="video" 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>';
|
|
}
|
|
|
|
public function render(array $opt = array()){
|
|
echo $this->asText($opt);
|
|
}
|
|
|
|
public function getThumbnailLink(){
|
|
return 'http://i.ytimg.com/vi/'.$this->link.'/2.jpg';
|
|
}
|
|
|
|
public function getVideoLink(){
|
|
return 'https://www.youtube.com/embed/'.$this->link.'?autoplay=0';
|
|
}
|
|
}
|
|
?>
|