Embed a player (Web Player)

Learn how to embed a player with content.

After adding the player library to your site, you can instantiate the player and play content.



Basic content playback

The following steps to play media assets with the player:

  1. Create a named <div> in the <body> of your page in the location where the player should appear.
  2. Call setup() with the playlist property to instantiate the player in the named <div>.

    πŸ’‘

    If you are embedding a self-hosted player, the player uses a default CDN.

    You can add the base property to the player setup to override loading the default CDN and specify a different base URL to prepend to scripts.

<div id="myElement"></div>

<script>
    jwplayer("myElement").setup({
        "playlist": "{json_or_rss_url}"
    });
</script>
<div id="myElement"></div>

<script>
    jwplayer("myElement").setup({ 
        "playlist": [{
            "file": "{media_resource_url}"
        }]
    });
</script>


πŸ“˜

In addition to instantiating an instance of a player, setup() allows you to enable and configure player features. setup() is one of several methods that can be used to interact with the player.



What’s Next