JW Player Quick Start Guide
Getting Started
Embedding the JW Player on your website is a simple, 3-step process:
1. Upload the jwplayer.js and player.swf files from the download ZIP to your server. All other files in the
download (documentation, source code, etc) are optional.
2. Include the jwplayer.js somewhere in the head of your webpage:
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
3. Call the player setup somewhere in the body of your website. Here's a basic example:
<div id="container">Loading the player ...</div>
<script type="text/javascript">
jwplayer("container").setup({
flashplayer: "/jwplayer/player.swf",
file: "/uploads/video.mp4",
height: 270,
width: 480
});
</script>
When the page is loading, the JW Player is automatically instantiated on top of the <div>. By default, the player is
rendered in Flash. If Flash is not supported (e.g. on an iPad), the player is rendered in HTML5.
The flashplayer option (to tell the JavaScript where the SWF resides) is just one of many configuration
options available for configuring the JW Player.
Here's another setup example, this time using a <video> tag instead of a generic div:
<video
src="/videos/video.mp4"
height="270"
id="container"
poster="/thumbs/image.jpg"
width="480">
</video>
<script type="text/javascript">
jwplayer("container").setup({
flashplayer: "/jwplayer/player.swf"
});
</script>
In this case, the JW Player is actually inspecting <video> tag and loading its attributes as configuration options. It's a
useful shortcut for setting up a basic player.
Quick Embed
If you've uploaded your player.swf and jwplayer.js files to a folder called "jwplayer" in the root of your website, you
can embed the player by using two simple lines of HTML:
- 1
- 2
- 3
前往页