<div style="height:100vh;overflow:auto;">
<?php
	$path="../../"; include("../../map.php"); include("../../scripts.php");
	error_reporting(0);
    $apikey = 'AIzaSyA06iwaI8kBBnqr1pJp0RMM3j1196kiVFk';
	$playlist='PLOMx_qNRGW0NG5-Q6cpAlLPz-p-gzGCSQ';
    $googleApiUrl = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=".$playlist."&maxResults=30&key=".$apikey;
	
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $googleApiUrl);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $response = curl_exec($ch);
    curl_close($ch);
    $data = json_decode($response);
    $value = json_decode(json_encode($data), true);
	echo "<div class=\"\">";
    for ($i = 0; $i < 99; $i++) {
        $videoId = $value['items'][$i]['snippet']['resourceId']['videoId'];
        $title = $value['items'][$i]['snippet']['title'];
        $description = $value['items'][$i]['snippet']['description'];
		$channel = $value['items'][$i]['snippet']['channelTitle'];
		$image = $value['items'][$i]['snippet']['thumbnails']["medium"]["url"];
		$ts = $value['items'][$i]['snippet']['publishedAt'];
if($videoId<>""){
?> 
	<div class="v3-col-md-4 v3-col-sm-4 v3-col-xs-12 video" style="margin-bottom: 30px; cursor:pointer;" data-url="https://youtube.com/embed/<?php echo $videoId; ?>?rel=0&loop=0&autoplay=1&modestbranding=1&showinfo=0">
		<div class="">
			<i class="fa fa-play" style="position: absolute; font-size: 80px; margin-left: 40%; margin-top: 10%; opacity: 0.5; color: red;"></i>
			<img src="<?php echo $image; ?>" style="width:99%;">
		</div>
		<h1 style="font-size: 18px; font-weight: 400; color:white; background: #fe7e7e; padding: 5px; position: absolute; width: 90%; margin-top: -15px;"><?php echo $title; ?></h1>
	</div>
<?php }}?>
	</div>
<div id="videodiv" style="display:none;position: absolute; top: 0px; left: 0px; width: 100%; border: 1px solid rgb(204, 204, 204); z-index: 99; height: 100vh; background: black;">
	<i class="fa fa-times" style="cursor:pointer;position: absolute; top: 10px; right: 10px; background: white; padding: 10px; border-radius: 15px;"></i>
	<object id="videobj" data='' style="height: 83vh; width:100%;"></object>
</div>
<script>
	function toggle(id){
		jQuery(id).toggle("slow", function() {
		// Animation complete.
		});
	}
	jQuery('.video').click(function(){
		var url = jQuery(this).attr('data-url');
		toggle('#videodiv');
		jQuery('#videobj').attr('data',url);
		jQuery("html, body").animate({ scrollTop: 0 }, "slow"); return false;
	});
	jQuery('.fa-times').click(function(){
		toggle('#videodiv');
		jQuery('#videobj').attr('data','about:blank');
	});
</script>
</div>