> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# JW Player

> Play single videos, playlists, and JW Player playlist URLs in a native full-screen player with the JW Player plugin and the JavaScript Bridge.

JW Player is a video platform for hosting and playing video. Median's JW Player plugin integrates the [JW Player iOS SDK](https://docs.jwplayer.com/players/docs/ios-overview) and [Android SDK](https://docs.jwplayer.com/players/docs/android-overview) into your app to provide native video playback with support for single videos, playlists, and adaptive streaming.

> [!TIP]
>
> **Test  with our demo page**
>
> We host a ready-made demo page at
>
> that calls the  features through the Median JavaScript Bridge.
> Load it inside your Median app during development, either by setting it
> as your app's website URL in App Studio or by navigating to it from your
> own site, and use it to confirm  works on a real device before
> you add it to your own pages.
>
> The demo page only works inside a Median app with  enabled.
> Opened in a regular mobile or desktop browser, the native features
> won't respond. Remember to switch your app back to your own URL before
> release.

## Why use JW Player?

* **Native SDK playback**: The plugin uses JW Player's native iOS and Android SDKs for video playback.
* **Flexible input formats**: Play a single video file, an array of video files as a playlist, or load a playlist directly from a JW Player playlist URL.
* **Cross-platform support**: One Median JavaScript Bridge API works across iOS and Android with platform-appropriate behavior.
* **Chromecast on iOS**: When you configure an App ID, Chromecast initializes automatically at app launch on iOS.

## Prerequisites

Before you begin, ensure you have the following:

* A Median app with the JavaScript Bridge enabled.
* A valid JW Player license key (`licenseKey` is a required configuration field).
* Access to **App Studio** to configure the plugin in the **Native Plugins** section.

## Implementation guide

### App configuration

1. Open **App Studio** and navigate to the **Native Plugins** section.
2. Locate the JW Player plugin and enable it.
3. Enter your JW Player Android and iOS License Keys.
4. If you want to enable Chromecast on iOS, enter your Google Cast App ID in the `appId` field.
5. Save your configuration.

![JW Player plugin settings in App Studio with fields for the Android and iOS license keys and the Google Cast App ID](https://mintcdn.com/median-co/yvThAkXSLqPa6nzP/images/docs/e57fa87ad7ee523bbc5d214f8a9deaa293bd18b41341d2d87036b1d67f6262ba-Screenshot_2026-06-17_at_10.15.48.png?fit=max\&auto=format\&n=yvThAkXSLqPa6nzP\&q=85\&s=641ab27e1feb2773ea4d23ab7933de7e)

JW Player plugin configuration

#### Plugin configuration options

| Setting | Description | Required |
| - | - | - |
| Android License Key | The license key connects your Android app to your JW Player account. To get your key, open your [JW Player dashboard](https://dashboard.jwplayer.com/login). On the Properties page, click the name of a property. Under Network & setup files, click Player setup files. Under Android SDK, copy the License key. | Yes, for Android support |
| iOS License Key | The license key connects your iOS app to your JW Player account. To get your key, open your [JW Player dashboard](https://dashboard.jwplayer.com/login). On the Properties page, click the name of a property. Under Network & setup files, click Player setup files. Under iOS SDK, copy the License key. | Yes, for iOS support |
| Google Cast App ID (iOS) | This key enables your iOS app to cast media to Google Chrome Cast compatible devices. You can obtain this key in your [Google Cast SDK Developer Console](https://cast.google.com/publish). | Optional |

> [!NOTE]
>
> **Rebuild after configuration**
>
> Plugin settings take effect only in new builds. After changing credentials or uploading new Firebase configuration files, rebuild your app and test on a real device or simulator before releasing.

### JavaScript Bridge functions

#### Initialize the JW Player SDK

> [!NOTE]
>
> **Auto-initialization**
>
> On iOS and Android, the JW Player plugin auto-initializes at runtime using the license key uploaded in the app configuration. Alternatively, you can manually initialize the SDK using the `median.jwplayer.initialize()` command.

Median JavaScript Bridge

```javascript JavaScript theme={null}
const result = await median.jwplayer.initialize({
  licenseKey: 'YOUR_JW_PLAYER_LICENSE_KEY'
});

// result.success is true or false
// On failure only, result.error is set, for example:
// { code: "NOT_INITIALIZED", message: "Invalid license key" }
console.log(result);
```

##### Parameters

| Parameter | Type | Description |
| - | - | - |
| licenseKey | `string` | **Required**. Your JW Player license key. |

#### Play a video

Present a full-screen native player and begin video playback. You can provide a single video file, an array of video files (playlist), or a JW Player playlist URL.

To play a video:

Median JavaScript Bridge

```javascript JavaScript theme={null}
// Play a single video
const singleResult = await median.jwplayer.play({
  file: 'https://example.com/video.mp4',
  startTime: 30             // optional: start at 30 seconds
});

// Play a playlist
const playlistResult = await median.jwplayer.play({
  files: [
    'https://example.com/video1.mp4',
    'https://example.com/video2.mp4'
  ]
});

// Play from a JW Player playlist URL
const playlistUrlResult = await median.jwplayer.play({
  playlistUrl: 'https://cdn.jwplayer.com/v2/playlists/abc123'
});
```

Median JavaScript Bridge

```javascript JavaScript theme={null}
// Callback example
median.jwplayer.play({
  file: 'https://example.com/video.mp4',
  callback: function(result) {
    if (result.success) {
      console.log('Playback started');
    }
  }
});
```

##### Optional parameters

| Parameter | Type | Description |
| - | - | - |
| file | `string` | URL of a single video file. Takes priority over `files`. |
| files | `string[]` | Array of video URLs played as a playlist. |
| playlistUrl | `string` | URL to a JW Player JSON playlist feed. |
| startTime | `number` | Starting position in seconds (default: `0`). |

**At least one of `file`, `files`, or `playlistUrl` must be provided.**

##### Return values

The callback data differs between platforms:

**iOS** returns when the player has been configured:

```javascript iOS theme={null}
{
  success: true
}
```

**Android** returns when the player is closed, including playback state:

```javascript Android theme={null}
{
  success: true,
  position: 120,            // playback position in seconds at close time
  state: "playing",         // "playing", "paused", "idle", or "complete"
  file: "https://...",      // URL of the current playlist item
  isMute: false,            // whether the player was muted
  currentQuality: {},       // current video quality
  currentAudioTrack: {},    // current audio track
  currentCaptions: {}       // current captions track
}
```

##### Error response

```javascript Error theme={null}
{
  success: false,
  error: {
    code: "NOT_INITIALIZED", // or "INTERNAL_ERROR"
    message: "..."
  }
}
```

#### Chromecast support (iOS)

On iOS, Chromecast support is automatically initialized at app launch when the `appId` is configured in the server configuration. No additional JavaScript calls are required.

To enable Chromecast, add your Google Cast application ID to the JW Player configuration in App Studio as shown in [App configuration](#app-configuration).

## Testing checklist

Use this checklist to ensure JW Player is working correctly in your iOS or Android app:

* [ ] The SDK auto-initializes or manually initializes using `median.jwplayer.initialize()`

* [ ] Using `median.jwplayer.play()` launches the player

* [ ] Chromecast works using an iOS appID or Android Google Cast application ID.

## Troubleshooting

### JW Player JavaScript Bridge functions do nothing or throw errors

Ensure the JavaScript Bridge is enabled in App Studio. Manually initialize the SDK or enter license keys in the plugin configuration in App Studio.

### `initialize()` returns `NOT_INITIALIZED` or `INTERNAL_ERROR`

Check that the `licenseKey` value in your plugin configuration is valid and matches the key from JW Player.


## Related topics

- [Native media player](https://docs.median.co/docs/native-media-player.md)
- [Kaltura media player](https://docs.median.co/docs/kaltura-media-player.md)
- [Changelog archive](https://docs.median.co/docs/changelog-archive.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.