//$size=$_FILES['uploadvideo']['size']; $cname = str_replace(" ", "_", $name); if (empty($contestId)) { //echo "<script>alert('Select contest name')</script>"; $error = "Select contest name"; } elseif (empty($url) && empty($name)) { //echo "<script>alert('You must input url or file name')</script>"; $error = "You must input url or file name for video"; } elseif (empty($title)) { //echo "<script>alert('You must input video title')</script>"; $error = "You must input video title"; } if (!empty($url) && !empty($title)) { $videoHost = videoType($url); if ($videoHost == 'youtube') { $videoId = parse_youtube($url); } elseif ($videoHost == 'vimeo') { $videoId = parse_vimeo($url); } else { $videoId = ''; } $sql = "INSERT INTO tblvideo(name,type,videourl,title,description,length,ratings,add_date,aprove,userid,contestid) VALUE('" . $cname . "','" . $videoHost . "','" . $videoId . "','" . $title . "','" . $description . "','none','',now(),'no','" . $userId . "','" . $contestId . "')"; $result = mysqli_query($db_conx, $sql); //echo "Your video has been successfully uploaded"; if ($result) { //echo "<script>alert('One New Video Inserted Succesful')</script>"; $success = "Your video has been successfully added"; } } elseif (!empty($name) && empty($url) && !empty($title)) { $tmp_name = $_FILES['uploadvideo']['tmp_name']; $target_path = "video/";
<?php if (stristr($urlvid, 'youtube.com') === FALSE) { ?> <iframe id="player" src="https://player.vimeo.com/video/<?php echo parse_vimeo($urlvid); ?> ?api=1&player_id=player" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <?php } else { ?> <div id="playeryt"></div> <script> var tag = document.createElement('script'); var videourl="<?php echo parse_youtube($urlvid); ?> "; tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var playeryt; function onYouTubeIframeAPIReady() { playeryt = new YT.Player('playeryt', { height: '100%', width: '100%', videoId: videourl, }); } </script>