开发者

jwplayer just downloaded, setup followed, does not appear

I got great advice from folks on Stackoverflow to use the jwplayer on my site to 开发者_开发技巧playback uploaded short videos. I downloaded the player, followed their setup instructions, nothing.

Here is their simple 2-step process, and I followed it:

STEP #1 Upload Player Files to Website

Transfer the player.swf, jwplayer.js and swfobject.js file from the ZIP to your website. We recommend putting these files in a folder named "jwplayer" in the root of your site. Make sure that you've also uploaded all the necessary videos, songs and/or images to your site."

STEP #2 Embed Player Code into HTML

Embed the player in your HTML page with the lines of code below. Note: If you place the files in different directories, make sure to set the references in this code accordingly.

The jwplayer site provided the javascript code to use:

<script type='text/javascript' src='/jwplayer/jwplayer.js'></script>

<div id='mediaplayer'></div>

<script type="text/javascript">
  jwplayer('mediaplayer').setup({
   'flashplayer': 'player.swf',
   'id': 'playerID',
   'width': '480',
   'height': '270',
   'file': '/videos/video.mp4'
  });
</script>

What did they leave out in the above instructions? I put this exact code provided on their website at the end of my index.php file, outside of the php delimiters. I can't see where I'm doing anything wrong. I created the two folders 'videos' and 'jwplayer' under my website's folder then put the files they specified above inside these folders. I'm thinking there's more install steps they left out because the player does not even appear, just a blank.


Try changing the path of SWF in the code:

...
jwplayer('mediaplayer').setup({
 'flashplayer': '/jwplayer/player.swf',
...


Try waiting till the page has loaded with this code:

<script type='text/javascript' src='/jwplayer/jwplayer.js'></script>
<div id='mediaplayer'></div>
<script type="text/javascript">
function addEvent(el,t,fn){
  return !!el.attachEventListener?el.attachEventListener(t,fn,false):el.attachEvent("on"+t,fn);
}

addEvent(window,"load",function(){   jwplayer('mediaplayer').setup({    'flashplayer': 'player.swf',    'id': 'playerID',    'width': '480',    'height': '270',    'file': '/videos/video.mp4'   }); });

If that still doesn't work then use Firebug (Firefox) or the Web Inspector (Chrome and Safari) to check if there's a script error, and try to see if you can find and fix the error in the script yourself.

Ad@m

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜