Options
All
  • Public
  • Public/Protected
  • All
Menu

Accurate Player HLS API

Accurate Player HLS

Accurate Player implementation using hls.js.

Installation

Install with npm.

npm install --save @accurate-player/accurate-player-core @accurate-player/accurate-player-hls

Required compiler flag

hls.js requires a namespace import which is uncallable in later typescript version. Thus you need to set esModuleInterop flag in your tsconfig.json.

{
  "compilerOptions": {
    "esModuleInterop": true
  }
}

See typescript release notes for details.

Example

Below is an example of how you use player in e.g. angular or react.

import { HlsPlayer } from "@accurate-player/accurate-player-hls";

const player = new HlsPlayer(videoElement);
player.api.loadVideoFile({
  src: "https://s3.eu-central-1.amazonaws.com/accurate-player-demo-assets/hls/sintel/sintel.m3u8",
  enabled: true,
  frameRate: { numerator: 24, denominator: 1 },
  dropFrame: false,
});

Control the player through player.api. E.g.

player.api.play();
player.api.pause();