Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

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?

1 Community Answers

Todd

JW Player Support Agent  
0 rated :

My suggestion would be to load the player using a custom embed so the player is already queued up and ready with the height and width set to 0, then clicking the image would resize the player and start playback. Please see http://support.jwplayer.com/customer/portal/articles/1891931 for more details on how to create a custom JW Platform embed starting with the player library URL.

This question has received the maximum number of answers.