<img src="https://img.shields.io/badge/%20-ENTERPRISE-B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/iOS-V4-009727?logo=apple" style="float:left"/><br /><img src="https://img.shields.io/badge/tvOS-BETA%20V1-green?logo=appletv" style="float:left"/><br />

The `JWPlayerItem` class enables you to add content to your player and define the unique characteristics of that content:

  • Title

  • Description

  • Poster Image

<br />

There are multiple ways to load and play content in your player. As best practice approaches, we recommend the following:

  • Use `JWPlayerConfigurationBuilder()` to create single-item or multiple-item playlists with media hosted in your JWP account.

  • Use `JWPlayerItemBuilder()` to create single-item or multiple-item playlists with self-hosted media.

  • Use `JWPlayerConfigurationBuilder()` to associate a playlist to a player and to initiate media playback.

  • All `JWPlayerItem` must have either a video source or a file set. If neither or both are set, the `JWPlayerItemBuilder` will throw an exception.

<br />

While you can use other approaches to create, associate, and play playlists, `JWPlayerItemBuilder()` and `JWPlayerConfigurationBuilder()` enable you to add functionality, such as, customization and advertising.

<br />

The following sections explain how to create a playlist with one or more items and to add multiple sources to a playlist item.

<br /> <hr />

## Creating a playlist

Use the following steps to add items to a playlist to a player:

  1. Use `JWPlayerItemBuilder()` to create one or more `JWPlayerItem` objects. All items **require** that a `file` be specified. This is the URL to the media file the `JWPlayerItem` will play.<br /><br />To increase user engagement, we strongly recommend defining the `title`, `description`, and `posterImage` for the `JWPlayerItem`.<br /><br />

  2. Use `JWPlayerConfigurationBuilder()` to add the `JWPlayerItem` objects to an array and set the player configuration.

  3. Hand your configuration to the `JWPlayer` object.

(Script tags will be stripped)
ο»Ώ