/** * Video Detail Page action Ends Here * * Function for adding video ends * * @param unknown $youtube_media * @return void|unknown */ function hd_getsingleyoutubevideo($youtube_media) { /** Check YouTube video id is exist */ if ($youtube_media == '') { /** If not then return empty */ return; } /** Get YouTube Api key form settings */ $setting_youtube = getPlayerColorArray(); $youtube_api_key = $setting_youtube['youtube_key']; /** Check Api key is applied in settings */ if (!empty($youtube_api_key)) { /** Get URL to get Youtube video details */ $url = 'https://www.googleapis.com/youtube/v3/videos?id=' . $youtube_media . '&part=contentDetails,snippet,statistics&key=' . $youtube_api_key; /** Call function to get detila from the given URL */ $video_details = hd_getyoutubepage($url); /** Decode json data and get details */ $decoded_data = json_decode($video_details); /** return YouTube video details */ return get_object_vars($decoded_data); } else { /** If key is not applied, then dipslya error message */ render_error(__('Could not retrieve Youtube video information. API Key is missing', APPTHA_VGALLERY)); } exitAction(''); }
/** function for adding video ends * */ function hd_getsingleyoutubevideo($youtube_media) { if ($youtube_media == '') { return; } $url = 'http://gdata.youtube.com/feeds/api/videos/' . $youtube_media; $ytb = hd_parseyoutubedetails(hd_getyoutubepage($url)); return $ytb[0]; }