Does JWplayer support javascript plugins?
Hi guys,
I've got a very simple js plugin there basically come from helloworld.js in jwplugin sdk.
HTML:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Video Test Page</title>
<script src="http://jwpsrv.com/library/your key"></script>
</head>
<body class="page-empty cms-page-view cms-on-demand-test">
<div>
<div class="std">
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
file: 'your file',
width: '940',
height: '529',
controlbar: 'bottom',
plugins: {
'helloworld.js': {
text: "helloworld"
}
},
});
jwplayer().onBeforePlay(function() {
});
</script>
</div>
</div>
<button type="button" onclick="alert(jwplayer().getPlugin('helloworld').showalert())">click me</button>
</body>
</html>
----------------------------------------------------------------------------------------
hello world.js:
(function(jwplayer){
var template = function(player, config, div) {
function setup(evt) {
div.style.color = 'white';
div.innerHTML = config.text;
};
player.onReady(setup);
this.resize = function(width, height) {};
};
function showalert(){
alert("alert alert!!!");
}
jwplayer().registerPlugin('helloworld','',template);
})(jwplayer);
----------------------------------------------------------
The text can be displayed on the top of the player successfully, when i hit the button, the alert is never show up, and it keep showing me 'undefined function' error.
I'm a web starter, can someone give me some help about it?
Regards,
Jasen