public function indexAction() { $url = $this->params()->fromQuery('url'); $this->changeviewmodel('json'); $video = LinkParser::factory($url); if (!$video->isValid()) { return new JsonModel(array('remoteId' => null)); } $view = new JsonModel(array('remoteId' => $video->getRemoteId(), 'swf' => $video->getSwfUrl(), 'url' => $video->toString(), 'thumnail' => $video->getThumbnail())); return $view; }
public function indexAction() { $url = 'http://v.youku.com/v_show/id_XNDY2MDE0NzA0.html?f=18450607'; $url = 'http://www.youtube.com/watch?v=HDd55pneMUg&feature=g-all-esi'; $url = 'http://youtu.be/HDd55pneMUg'; $video = LinkParser::factory($url); if ($video->isValid()) { $video->getSwfUrl(); } $view = new ViewModel(array('video' => $video)); return $view; }
public function getVideos() { $this->parse(); if (!$this->links) { return $this->videos; } $videos = array(); foreach ($this->links as $url) { $video = LinkParser::factory($url); if ($video->isValid()) { $videos[] = array('url' => $video->toString(), 'swf' => $video->getSwfUrl(), 'thumbnail' => $video->getThumbnail(), 'width' => $video->getPlayerWidth(), 'height' => $video->getPlayerHeight(), 'remoteId' => $video->getRemoteId()); } } return $this->videos = $videos; }