Newer
Older
<?php
namespace App\Items;
class Video implements Item
{
private $url;
public function __construct($url)
{
$this->url = $url;
}
public function getWidget()
{
return '<iframe width="100%" height="400" src="//www.youtube.com/embed/' . $this->getId() . '" frameborder="0" allowfullscreen></iframe>';;
}
public function getId()
{
preg_match('/^https:\/\/www\.youtube\.com\/watch\?v=(.*)/', $this->url, $matches);
return $matches[1];