I have a textbox where user enters the URLs of the you tube video’s (in the back-end of my custom plugin). Now what I want to do on the front end is to display that video using that URL.
I used both iframe and video tag but both do not plays the video.
Using Video tag I get this message :
‘No video with supported format and MIME type found’ in Firefox and in Chrome get only black screen and no audio.
Is there any solution that can be done without using JavaScript or Jquery.
Using Iframe nothing appears :
On inspecting I get iframe with src but nothing appears in body tag
This is the input type where video’s url is added:
<input id="video" name="video" type="text" style="width: 95%"
value="<?php echo esc_attr($item['video'])?>" size="50" class="code" >
And this is how I’m fetching it from db and passing it to the video and iframe tags :
<video width="320" height="240" controls>
<source src="<?php echo $video[0];?>" type="video">
Your browser does not support the video tag.
</video>
<iframe width="100%" height="315" src="<?php echo $video[0];?>" frameborder="0" allowfullscreen="1"></iframe>
I have taken multiple urls and exploded it using ‘,’ operator.
You have to share more code. Sounds like the input should only be clean youtube link and then you can echo out the youtube iframe interface with php wordpress.
EDIT:
youtube iframe should be like this:
I use this js for the size of the iframe on window resize: