HLS#

The HLS module enhances KWIKplayer by supporting HLS playback in browsers that lack native support (all except Safari).

Initialization#

To enable HLS support need to add in following options:

window.initPlayer('my-video', {
  hlsPlugin: {
    hlsjsConfig: {
      levelSwitchStrategy: 'smooth'
    }
  }
})

Events#

The HLS module triggers events for tracking playback and stream state:

  • codecsknown - Fired when audio and video codecs are identified.

Options#

OptionTypeDefaultDescription
levelSwitchStrategysmooth | instant"smooth"Determines how quality levels switch during playback.
isChromiumAndroidbooleanAutomatically checks via the user agentOptimizes buffer management for Chromium-based browsers on Android devices.

HLS Tech Interface#

OptionDescription
durationReturns the duration of the current media.
seekableProvides the seekable range as a TimeRange object.
disposeCleans up resources used by the HLS tech.

Example: Accessing the Seekable Range

const tech = player.tech();
const seekable = tech.hls?.seekable();
if (seekable) {
  console.log('Seekable Start:', seekable.start(0));
  console.log('Seekable End:', seekable.end(0));
}