Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

How to use javascript control play,stop..etc., when using jwplayer "modes" setting?


Hello,

My jwplayer version is 5.9.2118.

When I use javascript to control player to start or stop...etc.,and use "modes setting" to setup jwplayer.

Browser will report error:
Uncaught Error: Error in Actionscript. Use a try/catch block to find error.
Uncaught Error: Error calling method on NPObject.

My code :
bc.. <script type="text/javascript">
jwplayer("mediaplayer").setup({
width: "300",
height: "150",
controlbar: "bottom",
skin: "https://aaa.bbb.ccc.ddd/player/skins/beelden/beelden.zip",
image: "https://aaa.bbb.ccc.ddd/player/preview.jpg",
modes: [
{ type: "flash",
src: "https:/aaa.bbb.ccc.ddd/player/player.swf",
config: {
file: "/990113/01.mp4",
streamer: "rtmp://aaa.bbb.ccc.ddd/vod/_definst_/",
provider: "rtmp"
}
},
{ type: "html5",
config: {
file: "http://aaa.bbb.ccc.ddd/vod/_definst_/mp4:990113/01.mp4/playlist.m3u8",
provider: "audio"
}
},
{ type: 'download',
config: {
'file': 'rtsp://aaa.bbb.ccc.ddd/vod/_definst_/990113/01.mp4',
'provider': 'audio'
}
}
]
});
</script>
<a href="javascript:jwplayer().play(true);"><input type="button" value="Play" title="Play"></a>
<a href="javascript:jwplayer().pause(true);"><input type="button" value="Pause" title="Pause"></a>
<a href="javascript:jwplayer().stop(true);"><input type="button" value="Stop" title="Stop"></a>
<a href="javascript:jwplayer().setMute(true);"><input type="button" value="Mute" title="Mute"></a>




8 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Can I see where you tried that?

JW Player

User  
0 rated :

Hello Ethan,

This is sample page:

http://59.120.194.166/jwplayer/01.html


Thanks.

Ethan Feldman

JW Player Support Agent  
0 rated :

I think you just need to try something like this, instead, for example:

<a href="#" onclick="jwplayer().play();"><input type="button" value="PLAY" title="PLAY"></a>

If that doesn’t work, try to put the onclick into the input.

JW Player

User  
0 rated :

Hello Ethan,

It's not work !!

http://59.120.194.166/jwplayer/02.html
or
http://59.120.194.166/jwplayer/03.html <-- put the onclick into the input.

please check browser's javascript console , it report

Uncaught Error: Error in Actionscript. Use a try/catch block to find error.
Uncaught Error: Error calling method on NPObject.

Ethan Feldman

JW Player Support Agent  
0 rated :

How about not using an input.

So like:

<a href="#" onclick="jwplayer().setMute();">Click Here</a>

JW Player

User  
0 rated :

Hello Ethan,

It's not work too. ><

JW Player

User  
0 rated :

http://59.120.194.166/jwplayer/04.html

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you update to 5.10? – http://www.longtailvideo.com/order/view

This question has received the maximum number of answers.