This is probably a pretty simple thing. I am testing out several video hosting services where I host the videos and use their embed code to display on my site.
Now this embed code is stored in the database and is associated with each topic. So on a given page there could be 20 topics. So when a user clicks on any topic - using ajax I pull the embed code and display it in a given div.
This works fine for the embed code that uses or like in youtube and other services. But there are others that give you a javascript code to embed like shown below
<script type = "text/javascript" id = "vidyard_embed_code_BAKIQxxxxxxxxxxxx">//To resize this video, please login to your dashboard and edit your player settings
(function() {
var vidyardcontainer = document.createElement("div");
vidyardcontainer.id = 'vidyard_BAxxxxxxxxxxx';
var vidyardcontainer_s = document.getElementById('vidyard_embed_code_BAKIQyVKDjg_FeBoGkxr7A');
vidyardcontainer_s.parentNode.insertBefore(vidyardcontainer, vidyardcontainer_s);
var vidyard = document.createElement('script');
vidyard.type = 'text/javascript';
vidyard.async = false;
vidyard.src = ('https:' == document.location.protocol ? 'https://secure.' : 'http://embed.') + 'vidyard.com/embed/Bxxxxxxxxxxxxx/iframe/?';
var vidyard_s = document.getElementsByTagName('script')[0];
vidyard_s.parentNode.insertBefore(vidyard, vidyard_s);
})(); //embedcodev1.0
</script>
So this type of embed code cos its javascript. Is there anyway to get this working. Appreciate your input Thanks