You should be able to use the jPlayer "ended" event -
jplayer.org/latest/developer-guide/#jPlayer-event-type
So, something like this for the script (untested):
So, something like this for the script (untested):
<script type="text/javascript">
$(document).ready(function(){
var thisQuestion = $('#question{QID}');
function resizePlayer() {
var playerWidth = $('#jquery_jplayer_{QID}').width();
var aspectRatio = {
'width': 16,
'height': 9
};
var playerHeight = (playerWidth*aspectRatio.height)/aspectRatio.width;
$('#jquery_jplayer_{QID}').css('height', playerHeight+'px');
$('#jquery_jplayer_{QID} img').css('height', playerHeight+'px');
$('#jp_container_{QID} .jp-video-play').css({
'height': playerHeight+'px',
'margin-top': '-'+playerHeight+'px'
});
}
$(window).resize(function() {
resizePlayer();
});
$('#jquery_jplayer_{QID}').jPlayer({
ready: function () {
resizePlayer();
$(this).jPlayer("setMedia", {
title: "Big Buck Bunny Trailer",
m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v",
ogv: "http://www.jplayer.org/video/ogv/Big_Buck_Bunny_Trailer.ogv",
poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png"
});
},
ended: function () {
$(this).jPlayer("destroy");
$('#jp_container_{QID}').hide;
},
cssSelectorAncestor: "#jp_container_{QID}",
swfPath: "{TEMPLATEURL}scripts/jPlayer-2.9.2/dist/jplayer",
supplied: "m4v, ogv",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: true,
toggleDuration: true,
size: {
'width': '100%',
'height': 'auto',
'cssClass': 'jp-video-ls' // Custom class for LimeSurvey
}
});
});
</script>