Custom Players

If you have your own player that is compatible with ReactPlayer’s internal architecture, you can add it using the static method addCustomPlayer.

Usage

import YourOwnPlayer from './YourPlayer';
import ReactPlayer from 'react-player';

ReactPlayer.addCustomPlayer(YourOwnPlayer);

Your custom player component must have a static canPlay method that returns true if it can play a given URL.

Example Custom Player

import React from 'react';

class CustomPlayer extends React.Component {
  static canPlay(url) {
    // Logic to determine if this player can play the given URL
    return /example\.com\/video/.test(url);
  }

  // Your player logic here...
  render() {
    return <div>My Custom Player for {this.props.src}</div>;
  }
}

export default CustomPlayer;

Removing Custom Players

Use removeCustomPlayers to clear all custom players that have been added.

ReactPlayer.removeCustomPlayers();

Note: It is your responsibility to ensure that custom players are compatible with ReactPlayer's internal architecture and to keep them updated with any internal changes in future versions of ReactPlayer.