Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Adding ?enablejsapi=1 to YouTube iframe Code

$
0
0

I have a Wordpress site and I have a custom field which holds YouTube iframe codes. There is a string holding these iframe codes named $embed. Videos are displayed in the theme with code:

<?php print($embed); ?>

I want to convert my standard YouTube embed codes such that:

Standard Youtube Embed Code:

<iframe width="560" height="315" src="https://www.youtube.com/embed/uxpDa-c-4Mc" frameborder="0" allowfullscreen></iframe>

Converted Format:

<iframe width="560" height="315" src="https://www.youtube.com/embed/uxpDa-c-4Mc?enablejsapi=1&html5=1" frameborder="0" allowfullscreen id="video"></iframe>

Simply, I want to add ?enablejsapi=1&html5=1 to end of URL and add id="video".

How can i obtain this iframe code by manipulating the parameter $embed?

Tnx.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>