All Projects → clappr → hlsjs-playback

clappr / hlsjs-playback

Licence: BSD-3-Clause License
Clappr HLS Playback based on hls.js

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects
CSS
56736 projects

Projects that are alternatives of or similar to hlsjs-playback

P2P-CKPlayer
嵌入P2P引擎的CKPlayer,视频网站省流量&加速神器
Stars: ✭ 49 (+157.89%)
Mutual labels:  hlsjs
P2P-DPlayer
DPLayer powered by CDNBye P2P Engine
Stars: ✭ 63 (+231.58%)
Mutual labels:  hlsjs
scte35-threefive
threefive is the highest rated SCTE35 parser, ever. maybe.
Stars: ✭ 75 (+294.74%)
Mutual labels:  hls-stream
hls-live-thumbnails
A service which will generate thumbnails from a live HLS stream.
Stars: ✭ 49 (+157.89%)
Mutual labels:  hls-stream
hlsjs-upimg-wrapper
The upimg decoder module for hls.js
Stars: ✭ 19 (+0%)
Mutual labels:  hlsjs
cassandra-nginx-cdn
Some config files and POC code to use Apache Cassandra as distributed storage for HLS chunks accross multiple datacenters and scripts for converting/transcoding UDP MPEG-TS to HLS and vice versa. The idea is take from Globo.com’s Live Video Platform for FIFA World Cup ’14.
Stars: ✭ 24 (+26.32%)
Mutual labels:  hls-stream
tms
tms(toy media server) is a toy media server for myself learning media develop. Just for fun.
Stars: ✭ 29 (+52.63%)
Mutual labels:  hls-stream
v-clappr
👏🏻Vue.js wrapper for Clappr media player
Stars: ✭ 18 (-5.26%)
Mutual labels:  clappr
reactjs-player
基于 react hooks 的 video 播放组件,结构简单,代码简洁,扩展方便。
Stars: ✭ 32 (+68.42%)
Mutual labels:  hlsjs
orcanode
Software for live-streaming and recording lossy or lossless compressed audio (HLS, DASH, FLAC) via AWS S3 buckets. ⭐
Stars: ✭ 23 (+21.05%)
Mutual labels:  hls-stream
clappr-core
Core components of the Clappr player architecture
Stars: ✭ 41 (+115.79%)
Mutual labels:  clappr
clappr-vast-ad-plugin
Plugin for playing advertisements by VAST protocol
Stars: ✭ 14 (-26.32%)
Mutual labels:  clappr
zh-downloader
一个可以直接下载知乎视频的浏览器插件
Stars: ✭ 54 (+184.21%)
Mutual labels:  hls-stream
videojs-hlsjs
HLS playback plugin for videojs
Stars: ✭ 26 (+36.84%)
Mutual labels:  hlsjs
clappr-plugins
Main plugins for the Clappr project
Stars: ✭ 22 (+15.79%)
Mutual labels:  clappr
Clappr
🎬 An extensible media player for the web.
Stars: ✭ 5,436 (+28510.53%)
Mutual labels:  clappr
hls-downloader
Web Extension for sniffing and downloading HTTP Live streams (HLS)
Stars: ✭ 834 (+4289.47%)
Mutual labels:  hls-stream
Hls.js
HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
Stars: ✭ 10,791 (+56694.74%)
Mutual labels:  hlsjs

HlsjsPlayback

A Clappr playback to play HTTP Live Streaming (HLS) based on the hls.js.

jsDelivr hits (npm)

Usage

You can use it from JSDelivr:

https://cdn.jsdelivr.net/npm/@clappr/hlsjs-playback@latest/dist/hlsjs-playback.min.js

or as an npm package:

yarn add @clappr/hlsjs-playback

Then just add HlsjsPlayback into the list of plugins of your player instance:

var player = new Clappr.Player(
  {
    source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
    plugins: [HlsjsPlayback],
  });

Configuration

The options for this playback are shown below:

var player = new Clappr.Player(
  {
    source: 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8',
    plugins: [HlsjsPlayback],
    hlsUseNextLevel: false,
    hlsMinimumDvrSize: 60,
    hlsRecoverAttempts: 16,
    hlsPlayback: {
      preload: true,
      customListeners: [],
    },
    playback: {
      extrapolatedWindowNumSegments: 2,
      triggerFatalErrorOnResourceDenied: false,
      hlsjsConfig: {
        // hls.js specific options
      },
    },
  });

hlsUseNextLevel

Default value: false

The default behavior for the HLS playback is to use hls.currentLevel to switch current level. To change this behaviour and force HLS playback to use hls.nextLevel, add hlsUseNextLevel: true to embed parameters.

hlsMinimumDvrSize

Default value: 60 (seconds)

Option to define the minimum DVR size to active seek on Clappr live mode.

extrapolatedWindowNumSegments

Default value: 2

Configure the size of the start time extrapolation window measured as a multiple of segments.

Should be 2 or higher, or 0 to disable. It should only need to be increased above 2 if more than one segment is removed from the start of the playlist at a time.

E.g.: If the playlist is cached for 10 seconds and new chunks are added/removed every 5.

hlsRecoverAttempts

Default value: 16

The hls.js have recover approaches for some fatal errors. This option sets the max recovery attempts number for those errors.

triggerFatalErrorOnResourceDenied

Default value: false

If this option is set to true, the playback will triggers fatal error event if decrypt key http response code is greater than or equal to 400. This option is used to attempt to reproduce iOS devices behaviour which internally use html5 video playback.

hlsPlayback

Soon (in a new breaking change version), all options related to this playback that are declared in the scope of the options object will have to be declared necessarily within this new scope!

Groups all options related directly to HlsjsPlayback configs.

var player = new Clappr.Player(
  {
    ...
    hlsPlayback: {
      preload: true,
      customListeners: [],
    },
  });

hlsPlayback.preload

Default value: true

Configures whether the source should be loaded as soon as the HLS.JS internal reference is setup or only after the first play.

hlsPlayback.customListeners

An array of listeners object with specific parameters to add on HLS.JS instance.

var player = new Clappr.Player(
  {
    ...
    hlsPlayback: {
      ...
      customListeners: [
        // "hlsFragLoaded" is the value of HlsjsPlayback.HLSJS.Events.FRAG_LOADED constant.
        { eventName: 'hlsFragLoaded', callback: (event, data) => { console.log('>>>>>> data: ', data) }, once: true }
      ],
    },
  });

The listener object parameters are:

  • eventName: A valid event name of hls.js events API;
  • callback: The callback that should be called when the event listened happen.
  • once: Flag to configure if the listener needs to be valid just for one time.

hlsjsConfig

As HlsjsPlayback is based on hls.js, it's possible to use the available hls.js configs too. You can check them out here.

To use these settings, use the hlsjsConfig object.

Example:

var player = new Clappr.Player(
  {
    ...
    playback: {
      hlsjsConfig: {
        debug: true, // https://github.com/video-dev/hls.js/blob/master/docs/API.md#debug
        enableworker: false, // https://github.com/video-dev/hls.js/blob/master/docs/API.md#enableworker
        ...
      },
    },
  });

Development

Enter the project directory and install the dependencies:

yarn install

Make your changes and run the tests:

yarn test

Build your own version:

yarn build

Check the result on dist/ folder.

Starting a local server:

yarn start

This command will start an HTTP Server on port 8080. You can check a sample page with Clappr-core using the HlsjsPlayback on http://localhost:8080/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].