
What does remove() actually do?
Hi,
I suppose this is more of an informational question, but what does "remove()" actually do? My assumption has been that it completely destroys any reference to the player and removes it completely from memory. However, my testing shows otherwise. Here's the code:
<!DOCTYPE html>
<html>
<head>
<title>JWPlayer Test</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://jwpsrv.com/library/cloud-player-key.js"></script>
</head>
<body>
<div><a href="#" id="removebtn">Remove The Player</div>
<div id="videoplayer"></div>
<script type="text/javascript">
jQuery(document).ready( function (jQuery) {
var myplayer = jwplayer('videoplayer').setup({
width: '100%',
aspectratio:'16:9',
autostart: 'true',
file: 'path/to/video.mp4'
});
jQuery('#removebtn').on('click', function(evt) {
evt.preventDefault();
myplayer.remove();
console.log(myplayer);
});
});
</script>
</body>
</html>
When I click the #removebtn, the console.log() line spits out what looks to me like the full JWPlayer object, with methods like "getCaptionsList()" and "getCurrentQuality()" and about 100 other methods. The ID value of the object is "videoplayer", the "container" is listed as "div#videoplayer.jwplayer aspectMode playlist-none jw-user-inactive".
So is this the expected behavior? If not, then how soon until this is fixed? If so, then what's the best way to *really* destroy this object?