jwplayer(div).setup(options)

Creates a new JW Player on your web page.

When a player is set up, it must have a target <div> element to replace. In the following example, a <div> element named myElement has been created. The player will replace the <div> element when it appears on the page.

<div id="myElement">This text will be replaced with a player.</div>
<script>
    jwplayer("myElement").setup({
        "playlist": "https://cdn.jwplayer.com/v2/media/hWF9vG66"
    });
</script>
<div id="myElement">This text will be replaced with a player.</div>
<script>
    jwplayer("myElement").setup({
        "playlist": [{
            "file": "http://example.com/myVideo.mp4",
            "image": "http://example.com/myImage.png",
        }],
        "height": 360,
        "width": 640
    })
</script>
Attribute Description
div* string Target named div element that the web player replaces when it loads
options* JSON Configuration settings that control the appearance, behavior, rendinging, and loading of the player

⚠️ At minimum, the playlist property must be defined with one or several media items to play:

  • (Recommended) Use playlist when you have a single URL that contains a list of media items in a JSON file or RSS feed.

    By default, JWP uses this format for all media registered with your account. For example, https://cdn.jwplayer.com/v2/media/hWF9vG66. For each media item, JWP bundles metadata and assets for different playback environments

  • Use playlist[] to manually create a playlist that is an array of media items.

© 2007-2024 Longtail Ad Solutions, Inc.