Skip to main content
Version: v7 Alpha

Plugins Overview

The React Native Video library offers a robust plugin system to extend and customize video functionality on Android and iOS. With plugins, you can override source handling, implement custom DRM, modify media factories, and respond to player lifecycle events.

Use in Third Party Library Guide

If you are looking how to import React Native Video in your native code to use plugins, you can checkout Use in Third Party Library page.

What Are Plugins?

Plugins are modular extensions that hook into the video player's lifecycle and processing pipeline. They allow you to:

  • Customize video sources before playback
  • Implement custom DRM for protected content
  • Override media factories (Android only)
  • React to player lifecycle events for analytics, logging, or cleanup
  • Control caching behavior for performance

Architecture

The plugin system consists of three main components:

ComponentDescription
PluginsRegistrySingleton that manages plugin registration and coordinates plugin interactions
ReactNativeVideoPluginSpecInterface/protocol defining the contract all plugins must implement
ReactNativeVideoPluginBase implementation with convenient defaults; override only the methods you care about
tip

Plugins are automatically registered when you instantiate a class that extends ReactNativeVideoPlugin.

Core Concepts

Plugin Lifecycle

Plugins receive notifications for key events:

  • Player creation/destruction — react to player instance lifecycle
  • Video view creation/destruction — handle UI component lifecycle
  • Source processing — modify video sources before playback
  • DRM requests — provide custom DRM handling
  • Media factory overrides — customize ExoPlayer components (Android)
caution

All player and view references passed to plugins are weak references to prevent memory leaks.

Platform Differences

FeatureAndroid (Kotlin / ExoPlayer)iOS (Swift / AVFoundation)
Underlying playerExoPlayerAVFoundation
Media factory customizationExtensiveLimited
Cache controlSupportedLimited
Plugin method styleSynchronousAsync/await
Memory managementManual cleanupManual cleanup

Getting Started

Example: Android Plugin

// Android
class MyPlugin : ReactNativeVideoPlugin("MyPluginName") {
override fun onPlayerCreated(player: WeakReference<NativeVideoPlayer>) {
// Custom logic here
}
}

Example: iOS Plugin

// iOS
class MyPlugin: ReactNativeVideoPlugin {
init() {
super.init(name: "MyPluginName")
}

override func onPlayerCreated(player: Weak<NativeVideoPlayer>) {
// Custom logic here
}
}

Next Steps

We are TheWidlarzGroupPremium support →