jwplayer-react-native
⚠️ This README is for jwplayer-react-native version 1.0.0 and higher, for previous versions from the original author, Chaim Paneth via Orthodox Union, see react-native-jw-media-player. Beginning with version 0.2.0, this library uses JWX's JWPlayerKit (iOS) and SDK 4 (Android).
Prerequisites | Installation | Usage | Advanced Topics | Contributions | Issues
The jwplayer-react-native library is a bridge that enables using the native JWX Android and iOS SDKs in React Native applications.

Prerequisites
Before installing and using the library, you need the following items:
Installation
Android | iOS
Android
Follow these steps to add the library to your Android project:
From the project directory in terminal, add the jwplayer-react-native library. You can use npm or yarn.
npm: npm i @jwplayer/jwplayer-react-native --save
yarn: yarn add @jwplayer/jwplayer-react-native
In android/build.gradle, add the JWX Maven repository inside the allprojects block.
allprojects {
repositories {
...
maven {
url 'https://mvn.jwplayer.com/content/repositories/releases/'
}
If you are using EXPO, then an alternative way to the above
so that you don't have to re-add it to android/build.grade every time you do:
```npx expo prebuild --clean``
Install expo-build-properties plugin:
npx expo install expo-build-properties
and then add to app.json
"plugins": [
... (your other plugins go here)
[
"expo-build-properties",
{
"android": {
"extraMavenRepos": [
{
"url": "https://mvn.jwplayer.com/content/repositories/releases/"
}
]
}
}
]
],
For more details and guidance regarding configuration and requirements, see the JWX Android SDK documentation.
iOS
Follow these steps to add the library to your iOS project:
From the project directory in terminal, add the jwplayer-react-native library. You can use npm or yarn.
npm: npm i @jwplayer/jwplayer-react-native --save
yarn: yarn add @jwplayer/jwplayer-react-native
Change the directory to the iOS folder of your React Native project.
cd ios/
Set the minimum iOS version to 15.6 or later. In ios/Podfile, set the platform line:
platform :ios, '15.6'
A new React Native app defaults to a lower version, and pod install fails with "required a higher minimum deployment target" until you raise it. With Swift Package Manager instead of CocoaPods, the minimum is 16.0 (see below).
Install the iOS dependencies with CocoaPods.
pod install
[!IMPORTANT]
iOS is moving from CocoaPods to Swift Package Manager. JWPlayerKit 4.28.2 is the final iOS SDK version published to CocoaPods. Wrapper 1.10.1 uses JWPlayerKit 4.28.3 with Swift Package Manager. With CocoaPods it still installs, but stays on JWPlayerKit 4.28.2 and does not get the 4.28.3 fixes. Later iOS SDK versions are published only through Swift Package Manager, so wrapper releases that move to them will require it. If your iOS app still uses CocoaPods for this wrapper, plan to migrate to Swift Package Manager.
Migrating to Swift Package Manager (React Native 0.88+)
React Native 0.88 can build iOS apps with Swift Package Manager instead of CocoaPods. From 1.10.0, the wrapper ships an ios/Package.swift for React Native's SPM autolinking. The Example app in this repo is built this way and can be used as a reference.
- Upgrade your app to React Native 0.88 or later.
- In your
ios/ folder, run npx react-native spm --deintegrate (React Native's migration command), then build from the .xcodeproj.
- Keep the stub
ios/Podfile the migration leaves behind; the React Native CLI uses it to find the iOS project.
- Community libraries that don't ship a
Package.swift need one generated with npx react-native spm scaffold and kept with patch-package (see Example/patches).
On this path Google IMA and Google Cast are always included, which adds to your app's size, and the minimum iOS version is 16.0 (Google Cast's Swift package requires it). Because Cast is always linked, add the Info.plist values listed under iOS Casting. React Native's Swift Package Manager support is still marked experimental by React Native.
The dependency paths in ios/Package.swift assume React Native's standard autolinking layout, with this package installed at node_modules/@jwplayer/jwplayer-react-native directly under your app root (next to the app's ios/ folder). A monorepo, hoisted, or otherwise non-standard node_modules location changes that depth and the package will not resolve React Native.
For more details and guidance regarding configuration and requirements, see the JWX iOS SDK documentation.
Usage
The following example shows how you can enhance your React Native application by seamlessly integrating the multimedia playback functionalities of the JWX mobile SDKs.
Follow these steps to configure the media playback experience in your app:
- Use the following example as a guide to configure the media playback experience. Be sure to remove all instances of
... from the code.
...
import JWPlayer, { JWPlayerState } from '@jwplayer/jwplayer-react-native';
...
const styles = StyleSheet.create({
container: {
flex: 1,
},
player: {
flex: 1,
},
});
...
const playlistItem = {
title: 'Track',
mediaId: -1,
image: 'http://image.com/image.png',
description: 'My beautiful track',
startTime: 0,
file: 'http://file.com/file.mp3',
tracks: [
{
file: 'http://file.com/english.vtt',
label: 'en',
default: true
},
{
file: 'http://file.com/spanish.srt',
label: 'es'
}
],
sources: [
{
file: 'http://file.com/file.mp3',
label: 'audio'
},
{
file: 'http://file.com/file.mp4',
label: 'video',
default: true
}
]
}
const config = {
license:
Platform.OS === 'android'
? 'YOUR_ANDROID_SDK_KEY'
: 'YOUR_IOS_SDK_KEY',
backgroundAudioEnabled: true,
autostart: true,
styling: { // only (mostly) compatible with iOS
colors: {
timeslider: {
rail: "0000FF",
},
},
},
playlist: [playlistItem],
}
...
async isPlaying() {
const playerState = await this.JWPlayer.playerState();
return playerState === JWPlayerState.JWPlayerStatePlaying;
}
...
render() {
...
<View style={styles.container}>
<JWPlayer
ref={p => (this.JWPlayer = p)}
style={styles.player}
config={config}
onBeforePlay={() => this.onBeforePlay()}
onPlay={() => this.onPlay()}
onPause={() => this.onPause()}
onIdle={() => console.log("onIdle")}
onPlaylistItem={event => this.onPlaylistItem(event)}
onSetupPlayerError={event => this.onPlayerError(event)}
onPlayerError={event => this.onPlayerError(event)}
onBuffer={() => this.onBuffer()}
onTime={event => this.onTime(event)}
onLoaded={event => this.onLoaded(event)}
onFullScreen={() => this.onFullScreen()}
onFullScreenExit={() => this.onFullScreenExit()}
/>
</View>
...
}
- Define
config.license with your Android or iOS JWX license key.
- Define
config.playlist with the media to play in the player.
- (Optional) Define the other values of the
config prop.
ℹ️ See Props for all the available config prop fields.
ℹ️ See Legacy Readme for all the available config prop fields when using a legacy configuration.
Example Project
This repository contains the Example project. This project showcases several basic implementations of the <JWPlayer> view and can be used as a resource while working with the jwplayer-react-native library:
- Test pull requests (PRs) or modifications
- Experiment with the available media playback features
- Validate your configurations in a known, working application
- Demonstrate issues within a sanitary environment when submitting bugs
Follow these steps to run the example project:
Checkout this repository.
From the Example directory, run yarn. Use Yarn, not npm: the Example links this library with Yarn's link: protocol. Node 22.11.0 or later is required.
Create Example/.env with your JWX SDK license keys before you start Metro. The example screens read them through @env (see Example/app/jsx/components/Player.js). If you edit the file later, restart Metro with yarn start --reset-cache.
IOS_API_KEY=<your iOS license key>
ANDROID_API_KEY=<your Android license key>
iOS only: from the Example/ios directory, set up the iOS dependencies. The Example builds with Swift Package Manager, not CocoaPods: Example/ios/Podfile is a stub, so do not run pod install.
npx react-native spm update
If your checkout was previously built with CocoaPods, first delete Example/ios/build, Example/ios/Pods, Example/ios/RNJWPlayer.xcworkspace, Example/ios/Podfile.lock and the RNJWPlayer-* folders in ~/Library/Developer/Xcode/DerivedData.
iOS only: to build from Xcode, open Example/ios/RNJWPlayer.xcodeproj (not a workspace).
Build and run the app for your preferred platform.
yarn android
OR
yarn ios
iOS only: with Xcode 27, yarn ios fails because the React Native CLI tries to open Simulator.app from inside Xcode.app, where it no longer ships. Start Metro with yarn start from Example, then build and launch with Xcode directly, or from Example/ios:
xcrun simctl boot <SIMULATOR_UDID>
xcodebuild -project RNJWPlayer.xcodeproj -scheme RNJWPlayer -configuration Debug -destination id=<SIMULATOR_UDID> build
xcrun simctl install <SIMULATOR_UDID> ~/Library/Developer/Xcode/DerivedData/RNJWPlayer-*/Build/Products/Debug-iphonesimulator/RNJWPlayer.app
xcrun simctl launch <SIMULATOR_UDID> com.jwplayer.RNJWPlayer
ℹ️ You can also build and run the app with specific react-native commands.
Configuration
The library now features a unified configuration system that provides consistent, type-safe configuration across both iOS and Android platforms.
📚 Documentation