Introducing ReactTVPlayer: An Open Source Media Player for TV Apps on Devices 📺 🖥️
Tags: ott, react, tv, showdev
Published: 2023-09-20 18:28:33

I'm excited to share **React TV Player** - a free to use open source React media player component designed for TV, aiming to lower the barrier to entry and simplify playback in big-screen web apps! 🙌

With a customizable UI and easy arrow-key navigation, it can play a variety of urls like Dash/HLS streams and it **even supports YouTube, Twitch & Vimeo videos** - saving the cost and hassle of additional media encoding 🎉

<hr>

### [Live demo](https://lewhunt.github.io/react-tv-player/) (for desktop browsers)
### [Github repo](https://github.com/lewhunt/react-tv-player) (full readme info and source code)

<hr>

## Installation
It has been built as an npm package for easy install:
```bash
npm install react-tv-player
```
<hr>

## Usage
Then just import the player and render it in your App/Page
```jsx
import React from "react";
import { TVPlayer } from "react-tv-player";
function App() {
  return (
    <>
      <TVPlayer url="https://www.youtube.com/watch?v=SkVqJ1SGeL0" />
    </>
  );
}
```
<hr>

The demo's source code <a href='https://github.com/lewhunt/react-tv-player/blob/main/src/App.tsx'>App.tsx</a> illustrates how the component can be initialised with more props such as metadata, custom buttons, preview images and multiple media...

```jsx
<TVPlayer
  title={mediaList[mediaIndex].title}
  subTitle={mediaList[mediaIndex].subTitle}
  url={mediaList[mediaIndex].url}
  light={mediaList[mediaIndex].preview}
  customButtons={customButtons}
  mediaCount={mediaList.length}
  onLikePress={handleLike}
/>
```

The [Github readme](https://github.com/lewhunt/react-tv-player#props) details the props available plus the more advanced methods and hooks available to you.

<hr>

## Why Another Player?
In the dynamic landscape of the OTT TV industry, I've dedicated years working with various players. During this journey, two persistent challenges surfaced time and again: performant UI and compatible media encodings. These hurdles often forced us to heavily customise players and tackle streaming difficulties, leading to added costs and frustrating delays. 😫

Enter ReactTVPlayer, an open-source component that seamlessly integrates with your React applications...

## What Sets It Apart?

It's designed for TV experiences out of the box, complete with customisable UI buttons and intuitive arrow key plus cursor navigation. 🎮 In addition to handling HLS and Dash streams effortlessly, it tackles the formidable challenge of playing YouTube and Vimeo urls directly on TV. Supporting YouTube/Vimeo eliminates the need for custom media encoding when it's not always necessary or even affordable. 🎉

## How Does It Work?
Under the hood, this component harnesses the power of open-source libraries like Norigin Media's spatial navigation hook. It builds upon the excellence of React Player, which utilises hls.js and dash.js. Powered by React TypeScript (although you don't need to use TypeScript to make the most of it), this library is packaged efficiently using Vite, making integration a breeze. 💪

From Amazon FireTV sticks and Samsung Tizen Smart TVs to Xbox, LG webOS and even desktop-based web apps, ReactTVPlayer aims to cover a vast landscape of devices, especially those post-2018 with modern Chromium browsers. 📺 🖥️ 💻

<hr>

I hope this post has given you a good intro to the component and how it can help simplify and enhance the playback experiences in your next big-screen web apps! 🙌

<hr>

### [Live demo](https://lewhunt.github.io/react-tv-player/) (for desktop browsers)
### [Github repo](https://github.com/lewhunt/react-tv-player) (full readme info and source code)

<hr>

[![https://github.com/lewhunt/react-tv-player](https://repository-images.githubusercontent.com/688997852/cc39ebd0-f663-4715-b502-eccb06cc4e57)](https://github.com/lewhunt/react-tv-player)