Embed a 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 and code sample show how to play a single media asset 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>.
<div id="myElement"></div>

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

📘

TIP

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.


To learn more about adding content to and customizing content in the player, review the Content section.



Did this page help you?