how can handle jwplayer player actions with custom buttons?

时光毁灭记忆、已成空白 提交于 2020-01-15 09:47:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!