/** * Gets the video by it's url * @param {string} $url Vidyard Video URL to lookup * @return {array} Array in which the first key is a file instance and the second key is the url */ protected function getVideoByURL($url) { //Get the video id $videoID = Vidyard::getVidyardCode($url); if (empty($videoID)) { $exception = new SS_HTTPResponse_Exception('Could not get the Video ID from the URL', 400); $exception->getResponse()->addHeader('X-Status', $exception->getMessage()); throw $exception; } //Retrieve and Check the api key $apiKey = Vidyard::config()->api_key; if (empty($apiKey)) { $exception = new SS_HTTPResponse_Exception('Vidyard.api_key is not set, please configure your api key see http://support.vidyard.com/articles/Public_Support/Using-the-Vidyard-dashboard-API/ for how to get your API key.', 401); $exception->getResponse()->addHeader('X-Status', $exception->getMessage()); throw $exception; } return array(new File(array('Title' => $videoID, 'Filename' => trim($url))), trim($url)); }
/** * Gets the video id in use * @return {string} */ public function getVideoID() { if (empty($this->videoID)) { $this->videoID = Vidyard::getVidyardCode($this->url); } return $this->videoID; }