Here is how I handled it.
create a pseudo function whose sole purpose is to be a pointer. I was concerned with the onComplete event, so I wrote the code like so below:
function createJWPlayer(surl, stitle, autos, pw, ph) {
jwplayer("videocontainer").setup({
file: surl,
title: stitle,
width: pw,
height: ph,
autostart: autos,
stretching: "uniform",
skin: "/Scripts/JWPlayer/six.xml"
});
jwplayer().onComplete(function (e) {
jwcompleteevent(e);
});
}
function jwcompleteevent(e) {
// method to remain empty, sole purpose is to provide a pointer for the handler
}
Then in the function where I created it, I wrote this:
var mcomplete = (selobj.HasQ == false) ? InterActNoTimeAutoS : jwpCompleteInterA;
createJWPlayer(selobj.Upath, ti.TestTitle, true, "100%", "100%");
jwcompleteevent = mcomplete;
If I needed to load another video, I would do this
mcomplete = (selobj.HasQ == false) ? InterActNoTimeAutoS : jwpCompleteInterA;
jwcompleteevent = mcomplete;
loadJwPlayerUrl(selobj.Upath, true);
If anyone sees a problem with this, please tell me, it seems to be working as needed in the development environment
jwplayer('video-container').onTime(null);
?? – Readilyjwplayer.onTime()
is bindding a function to an event, I can't find a way to remove this bind... – Classieclassification