Hey everyone.
I have some pretty basic code:
[code]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/jwplayer.js"></script>
<style type="text/css">
#frame{ height:270px; width:480px;}
#controls{ background:#003366; border:#BBBBBB 2px solid; padding:3px 10px;}
.control{border:2px solid #777777; height:20px; width:100px;}
.db{display:block}
.dib{display:inline-block;}
</style>
<title>JWPlayer Demo</title>
<script type="text/javascript"> //Executed at launch
var vidPlayer=null;
function tcu(){
jwplayer().stop()
jwplayer().remove();
vidPlayer=null
setTimeout(function(){djp();}, 500);
}
function djp(){
rightNow= new Date();
vidPlayer=jwplayer("frame").setup({ //jwplayer setup
allowScriptAccess:'always',
"controlbar.position":"bottom",
flashplayer: "http://www.filemobile.com/static/videoplayer/player.swf",
file: "http://bb.c/mp5.8/video.mp4",
height: 270,
//"ova.json" : "{ "debug": { "debugger": "firebug","levels": "fatal, config, vast_template" },"overlays":{"closeButton": {"type": "custom","image":"http://www.theweathernetwork.com/common/images/global/mylocationdelete.png","width":16,"height":16},"regions":[{"id":"bottom","verticalAlign":"bottom","horizontalAlign":"center","backgroundColor":"#000000","padding":"-10 -10 -10 -10","width":480,"height":60}]},"ads": { "pauseOnClickThrough": true, "schedule": [ { "zone": "5","position": "pre-roll", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=pre_roll;vidlen=;vidbr=;vidr..."+rightNow.getTime() +"" } }, { "zone": "5","position": "post-roll", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=post_roll;vidlen=;vidbr=;vid..."}},{ "position": "bottom","starttime": "00:00:03","duration": "15", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=post_roll;vidlen=;vidbr=;vid..." }, } ] } } }",
//plugins:{'http://filemobile.com/static/videoplayer/ova.swf' : {},},
skin:"http://www.filemobile.com/static/videoplayer/filemobileSkin.zip",
width: 480,
wmode:"transparent"
});
}
$(document).ready(function(){ //jQuery launch code
djp();
//Controls setup
$('#c1').mouseup(function(){
tcu();
});
//End controls setup
}); //end jQuery launch Code
</script> <!-- End Launch js -->
</head>
<body>
<div id="frame"><div id="container"></div></div>
<div id="controls">
<div id="c1" class="control dib"></div>
</div>
</body>
</html>
[/code]
This code should cause the button to remove the player and draw a new instance. Typically, it works with a small amount of memory usage. However, if I uncomment the ova.json and plugins properties of the setup object, it causes the IE9 memory usage to skyrocket. Stopping/removing the player no longer releases the player from memory and a couple refreshes can cause the application to crash.
I am doing this because I need to use a new ova.json for each video played (There will eventually be numerous videos to choose from). If I knew how to alter that at runtime, I'd use it in parallel with jwplaer().load in the hopes that that could curb resource usage. Unfortunately, reloading the page and pulling the relevant video information from the URL is not an option
Can anyone help me get memory usage under control while using the ova plugin?
Reposting the code properly formatted:
<!DOCTYPE html><html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/jwplayer.js"></script>
<style type="text/css">
#frame{ height:270px; width:480px;}
#controls{ background:#003366; border:#BBBBBB 2px solid; padding:3px 10px;}
.control{border:2px solid #777777; height:20px; width:100px;}
.db{display:block}
.dib{display:inline-block;}
</style>
<title>JWPlayer Demo</title>
<script type="text/javascript"> //Executed at launch
var vidPlayer=null;
function tcu(){
jwplayer().stop()
jwplayer().remove();
vidPlayer=null
setTimeout(function(){djp();}, 500);
}
function djp(){
rightNow= new Date();
vidPlayer=jwplayer("frame").setup({ //jwplayer setup
allowScriptAccess:'always',
"controlbar.position":"bottom",
flashplayer: "http://www.filemobile.com/static/videoplayer/player.swf",
file: "http://bb.c/mp5.8/video.mp4",
height: 270,
//"ova.json" : "{ "debug": { "debugger": "firebug","levels": "fatal, config, vast_template" },"overlays":{"closeButton": {"type": "custom","image":"http://www.theweathernetwork.com/common/images/global/mylocationdelete.png","width":16,"height":16},"regions":[{"id":"bottom","verticalAlign":"bottom","horizontalAlign":"center","backgroundColor":"#000000","padding":"-10 -10 -10 -10","width":480,"height":60}]},"ads": { "pauseOnClickThrough": true, "schedule": [ { "zone": "5","position": "pre-roll", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=pre_roll;vidlen=;vidbr=;vidr..."+rightNow.getTime() +"" } }, { "zone": "5","position": "post-roll", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=post_roll;vidlen=;vidbr=;vid..."}},{ "position": "bottom","starttime": "00:00:03","duration": "15", "server":{ "type": "AdTech","apiAddress": "http://adserver.adtechus.com/?advideo/3.0/5152.1/123456/0/-1/cc=2;vidas=post_roll;vidlen=;vidbr=;vid..." }, } ] } } }",
//plugins:{'http://filemobile.com/static/videoplayer/ova.swf' : {},},
skin:"http://www.filemobile.com/static/videoplayer/filemobileSkin.zip",
width: 480,
wmode:"transparent"
});
}
$(document).ready(function(){ //jQuery launch code
djp();
//Controls setup
$('#c1').mouseup(function(){
tcu();
});
//End controls setup
}); //end jQuery launch Code
</script> <!-- End Launch js -->
</head>
<body>
<div id="frame"><div id="container"></div></div>
<div id="controls">
<div id="c1" class="control dib"></div>
</div>
</body>
</html>