Replacing thumbnail with embedded player
I'm trying to add a feature where clicking an image thumbnail (with a button that has id "feature-play") will swap out the image for an embedded JWPlatform video. Code looks something like this:
<script type="text/javascript">
$("#feature-play").click(function() {
$( "div.video-content").empty();
$.getScript("http://content.jwplatform.com/players/<?php echo $videoid; ?>-iqSlSRbk.js",
function(data){
$('div.video-content').html(data);
});
});
</script>
It looks like it's loading the script and trying to run it, but the console reports an error: "TypeError: undefined is not a function (evaluating 'jwplayer("botr_[redacted video ID]_div").setup')"
Does anyone know a better way of loading a JWPlatform video dynamically into a div?