jwplayer(div).setup(options)

Creates a new JW Player on your web page.

These API calls are used to create players and provide setup information.

jwplayer( div ).setup( options )

Creates a new JW Player on your web page.

AttributeDescription
div* string(Required) The target div that JW Player will replace
options* JSON(Required) Configuration options that will tell your player how to render itself

The only required option when setting up a JW Player embed is the file property. See the Configuration Options Reference for a full list of all JW Player configuration options.

Sample

<div id="myDiv">This text will be replaced with a player.</div>
<script>
jwplayer("myDiv").setup({
  "file": "http://example.com/myVideo.mp4",
  "image": "http://example.com/myImage.png",
  "height": 360,
  "width": 640
});
</script>

Clicking an HTML element can also instantiate and immediately begin playback. By calling setup() followed by play(), the user interaction on the element gets propagated through to the instantiated player. This eliminates the need to interact with the player to play media post setup.