How could I rewrite this php code to load my youtube video in an HTML container rather than a flash container like now?

I have a working PHP code that loads a youtube video inside an iframe which contains a flash player unfortunately.
This is not a desirable situation as I don't want to use flash.

How could I change this code to load the video but inside an HTML5 container that works across all devices?

thanks

<div id="vendor_video" class="cmsms_post_cont col-lg-6 col-sm-6 col-xs-12">

    <h1>Video</h1>
    
    <?php $parsed = parse_url($gallery_link); //echo "<pre>"; print_r($parsed['host']); exit; ?>
    
    <?php if($parsed['host'] == 'www.youtube.com') { ?>
    <?php  $gallery_link = substr($gallery_link, -11); ?>
    <?php $link =  "https://www.youtube.com/v/"."$gallery_link"; ?>			
        <div class="cmsms_video_wrap">				
            <iframe width="522" height="284" src="<?php echo $link; ?>"></iframe>
            <!--<iframe  width="522" height="284" src="http://www.youtube.com/embed/XGSy3_Czz8k?autoplay=0"></iframe>	-->				
        </div>
    <?php } else { ?>
            <div class="cmsms_video_wrap">				
                <iframe width="522" height="284" src="<?php echo $gallery_link; ?>"></iframe>						
            </div>
    <?php }  ?>
</div>

Open in new window

badwolfffAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Firstly, the solution will only work across all devices that support html5 and specifically the <video> tag. If the device does not support it then you have to use flash. Video.js (http://www.videojs.com) provides a seamless library to do this.

Otherwise have you read this page

https://www.youtube.com/html5

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skijCommented:
The link should be in this format, with ?html5=1 or &html5=1 at the end:
https://www.youtube.com/embed/9RY5Z8qwdqs?html5=1

Like this:
<iframe src="https://www.youtube.com/embed/9RY5Z8qwdqs?html5=1"></iframe>

<div id="vendor_video" class="cmsms_post_cont col-lg-6 col-sm-6 col-xs-12">
    <h1>Video</h1>
    <?php $parsed = parse_url($gallery_link) . "&html5=1"; ?>
    
    <?php if($parsed['host'] == 'www.youtube.com') { ?>
    <?php  $gallery_link = substr($gallery_link, -11); ?>
    <?php $link =  "https://www.youtube.com/embed/". $gallery_link . "?&html5=1"; ?>			
        <div class="cmsms_video_wrap">				
            <iframe width="522" height="284" src="<?php echo $link; ?>"></iframe>
        </div>
    <?php } else { ?>
            <div class="cmsms_video_wrap">				
                <iframe width="522" height="284" src="<?php echo $gallery_link; ?>"></iframe>						
            </div>
    <?php }  ?>
</div>

Open in new window

badwolfffAuthor Commented:
I sorted it out myself using video.js
badwolfffAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for badwolfff's comment #a40805507

for the following reason:

I sorted it out myself using video.js
Julian HansenCommented:
I sorted it out myself using video.js
Video.js was suggested in my first post.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.