Vimeo or YouTube ID ? + Responsive Video Wrapper for IFRAME

<?php $video_id = '{vimeo/youtube}'; if(strlen($video_id) == 11 && !is_numeric($video_id)): ?> <div class="video"> <iframe id="ytplayer" type="text/html" width="1920" height="1080" src="https://www.youtube-nocookie.com/embed/<?php echo $video_id; ?>?rel=0&showinfo=0&color=white&theme=light&autoplay=false" frameborder="0" allowfullscreen></iframe> </div> <? elseif: ?> <div class="video"> <iframe src="//player.vimeo.com/video/<?php echo $video_id; ?>?portrait=0&title=0&byline=0&badge=0&color=#ffffff" width="1920" height="1080" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div>'; <? endif; ?> <style> /* 16:9 - 1920x1080 */ .video { position: relative; width: 100%; padding-bottom: 56.25%; height: 0; overflow: hidden; } .video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>
Is this ID from YouTube or Vimeo? Decision depends on length and characters

"youtube-nocookie" mobile fix -> Open Video in Browser (tested on mobile Safari)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.