JWplayer Javascript interaction not working

怎甘沉沦 提交于 2019-12-25 02:08:10

问题


this problem is going to make me bald. Save my hair plz.

i have been trying every possible way to stop and pause and play the JWplayer latest version using its JavaScript API and nothing works.

here is the code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>JW Player 5 playlist</title>
    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jwplayer.js"></script>
    <script type="text/javascript" src="swfobject.js"></script>



</head>
<body>

<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
<div id="mediaplayer">JW Player goes here</div>


<script type="text/javascript">
    jwplayer("mediaplayer").setup({
        flashplayer: "player.swf",
        file: "lounge warmup.3gp",
        skin: "simple/simple.zip",
        image: "http://content.bitsontherun.com/thumbs/nPripu9l-480.jpg",
        controlbar: "bottom",
        width: "400",
        height: "8"
    });
</script>
<!-- END OF THE PLAYER EMBEDDING -->
<br>

<a href="#" onclick="jwplayer().stop(); return false;">Stop playback</a>

</body>
</html>

why this is not working??


回答1:


Your code works for me (after I adjusted the "file" to something I had locally). Some possibilities:

  1. Are you loading this with a "file://" URL, or are you loading it from an actual web server? (If from a file:// URL, there might be Flash security restrictions.)

  2. Do you intend to have a height of 8px as you've currently specified? I don't know what your custom skin looks like. In order to see things using default skin I had to specify a larger height.

  3. I'm not very familiar with JWPlayer, but is it possible the file parameter needs to be URL encoded? (If not sure, maybe trying removing the space from the file name and renaming it on the server as well.)

In any case, your code works for me using default skin and different media file. I can play and then click your "stop" link to stop playback. If ideas above don't help, then you'll need to specify exactly what is not working for you.



来源:https://stackoverflow.com/questions/6493287/jwplayer-javascript-interaction-not-working

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