GithubHelp home page GithubHelp logo

beaufortfrancois / rx-player Goto Github PK

View Code? Open in Web Editor NEW

This project forked from canalplus/rx-player

0.0 3.0 0.0 33.13 MB

Smooth/DASH HTML5 Video Player

License: Apache License 2.0

JavaScript 8.40% CSS 0.37% Shell 1.48% TypeScript 89.75%

rx-player's Introduction

Rx-player

Build Status npm version Gitter

The Rx-player is a library implementing a DASH and Microsoft Smooth Streaming video player directly on the browser, without plugins. It relies on HTML5 Media Source Extensions and Encrypted Media extensions and is written in TypeScript, a superset of JavaScript.

It is currently used in production for premium services and targets several devices, such as computers, phones, but also set-top-boxes, smart TVs and other peculiar environments.

Its main goals are:

  • To play live and On Demand Smooth and DASH contents for extended amounts of time, with or without DRM

  • To offer a first-class user experience (best quality without any buffering, low latency...)

  • To be configurable and extendable (e.g. for Peer-to-Peer streaming, STB integration...)

  • To be easy to integrate and use as a library in various codebases.

Latest release: v3.6.1

API

We documented the API in every little details in the API documentation.

This documentation is automatically generated from the content of the doc/api directory in this repository.

Demo

You can view our online Demo, built from our last version, here.

This demo is a small application written in React demonstrating a simple usage of the player.

How to use it?

The fastest way to use the player directly in your code is to add this repository as a dependency. You can do it via npm:

npm install --save rx-player

You can then directly import and use the Rx-Player in your code:

// import it ES6 style:
import RxPlayer from "rx-player";

// same in CommonJS style:
// const RxPlayer = require("rx-player");

// instantiate it
const player = new RxPlayer({
  videoElement: document.getElementById("my-video")
});

// play a video
player.loadVideo({
  url: "http://vm2.dashif.org/livesim-dev/segtimeline_1/testpic_6s/Manifest.mpd",
  transport: "dash",
  autoPlay: true
});

To reduce the size of the final code, you can now also import a minimal version of the player and only import the features you need. This is documented here :

import RxPlayer from "rx-player/minimal";
import { DASH, EME } from "rx-player/features";

// Allow to play encrypted DASH contents
RxPlayer.addFeatures([DASH, EME]);

Your questions

You can ask directly your questions about the project on our gitter. We will try our best to answer them as quickly as possible.

Contribute

You can help and contribute either by:

  • reporting bugs directly on the issues tab on top of this page.

  • adding new features / fixing bugs and doing a pull request (please open an issue first for that).

If you have any questions about contributing, you can ask it in our gitter room.

We also began to add a little architecture documentation here . Those pages are automatically generated from the content of the doc/architecture directory.

More is coming soon!

Dependencies

After cloning our repo, you should first install our dependencies via npm:

npm install

Build

We use npm scripts to bundle, lint and test the player. Here are some examples:

# build the player in dist/rx-player.js
npm run build

# lint the code with tslint
npm run lint

# launch the demo on a local server (http://127.0.0.1:8000)
npm run start

# launch our test suite on various browsers
npm run test

# list all available npm scripts
npm run info

Builds are included in the dist/ directory (builds based on the last version are already included there).

Why a new player? Why Rx?

Building a streaming video player for the web is a complex task due to the numerous interactions with the outside world it has to deal with. Whether they come from the user providing an input, network interactions or browser capabilities. If you also consider the multiplicity of browsers to support and the speed with which their APIs are changed and added, you end up with a really important (both in the significant and large sense) piece of software. The video player being the centerpiece of our applications, it needs to adapt very quickly and stay resilient to various errors.

Many current video player implementations rely mostly on classical object-oriented hierarchy and imperative event callbacks with shared mutable objects to manage all these asynchronous tasks and states. We found that we could profit a lot more from adding a reactive-programming approach, with most notably the help of the RxJS library.

RxJS provides gracious interfaces and operators to compose asynchronous tasks together by representating changing states as observable stream of values. It also comes with a cancelation contract so that every asynchronous side-effect can be properly disposed when discarded by the system. This change of paradigm answers gracefully to most of our needs.

Moreover, writing the RxPlayer in TypeScript instead of plain JavaScript gives us more tools and confidence in our codebase. All of these elements helps us to build what we think is a maintainable and evolutive codebase, allowing us to adapt quickly to changing environments.

Target support

Here is a basic list of supported platforms:

Chrome IE [1] Edge Firefox Safari Opera
Windows >= 30 >= 11 >= 12 >= 42 >= 8 >= 25
OSX >= 30 - - >= 42 >= 8 >= 25
Linux >= 37 - - >= 42 - >= 25
Android [2] >= 30 - - >= 42 - >= 15
iOS No - - No No No

[1] Only on Windows >= 8.

[2] Android version >= 4.2

And more. A good way to know if the browser should be supported by our player is to go on the page https://www.youtube.com/html5 and check support for MSE and H.264.

rx-player's People

Contributors

peaberberian avatar jinroh avatar grenault73 avatar alexduros avatar lukaszzdanikowski avatar kylekatarnls avatar

Watchers

François Beaufort avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.