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#
Option | Type | Default | Description |
---|---|---|---|
levelSwitchStrategy | smooth | instant | "smooth" | Determines how quality levels switch during playback. |
isChromiumAndroid | boolean | Automatically checks via the user agent | Optimizes buffer management for Chromium-based browsers on Android devices. |
HLS Tech Interface#
Option | Description |
---|---|
duration | Returns the duration of the current media. |
seekable | Provides the seekable range as a TimeRange object. |
dispose | Cleans 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)); }