问题
I downloaded 'JW-Player-5.2-Pro' and my files are shown in the picture. theres no 'jwplayer.js' file there so can't use javascript api. 'video.flv' is embeded on 'readme.html' as:
<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
<param name="movie" value="player.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=video.flv&image=preview.jpg" />
<embed
type="application/x-shockwave-flash"![enter image description here][1]
id="player2"
name="player2"
src="player.swf"
width="400"
height="315"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=video.flv&image=preview.jpg"
/>
</object>
but I want to handle the player actions by custom buttons. how can I do that ?
-thanks.
回答1:
The JavaScript API referenced is for JW Player version 6, not 5.2. You need to upgrade if you want to use that API.
回答2:
you can upgrade to jw player 6 and use the function jwplayer().load([{file:"/assets/myVideo.mp4"}]);
according to the jwplayer website
so if your html is something like
<button id="play">play </button>
then you can use some javascript like this (illustrating using jQuery).
$(document).ready(function(){
$("#play").click(function(){
jwplayer().load([{file:"/assets/myVideo.mp4"}]);
});
});
回答3:
If you are still on JW5 and don't want to use the JS API, you can always make a custom Flash plugin for custom buttons.
来源:https://stackoverflow.com/questions/19194796/how-can-handle-jwplayer-player-actions-with-custom-buttons