@zezosoft/react-player
Version:
A lightweight and customizable video player by Zezosoft, built for seamless streaming with advanced controls, adaptive playback, and modern UI. Perfect for web and React applications.
53 lines (51 loc) • 1.96 kB
TypeScript
import Hls from "hls.js";
import * as dashjs from "dashjs";
import { StreamType } from "../../store/types/StoreTypes";
export declare class QualityManager {
/**
* Set video quality for HLS streams with OTT-grade smoothness
*
* Best practices implemented:
* 1. Use currentLevel for immediate quality change
* 2. Use autoLevelCapping to prevent ABR from switching back
* 3. Use nextLevel to ensure next segment uses selected quality
* 4. Handle edge cases and errors gracefully
*
* @param hlsInstance HLS.js instance (null for native HLS, undefined when not available)
* @param levelIndex Quality level index (-1 for auto)
*/
static setHlsQuality(hlsInstance: Hls | null | undefined, levelIndex: number): void;
/**
* @param dashInstance DASH.js instance
* @param qualityId Quality level ID (undefined/null for auto)
*/
static setDashQuality(dashInstance: dashjs.MediaPlayerClass | undefined | null, qualityIndex: number | null | undefined): void;
/**
* @param hlsInstance HLS.js instance
* @returns Array of quality level objects
*/
static getHlsQualityLevels(hlsInstance: Hls): Array<{
height: number;
bitrate?: number;
originalIndex: number;
}>;
/**
* @param dashInstance DASH.js instance
* @returns Array of quality level objects
*/
static getDashQualityLevels(dashInstance: dashjs.MediaPlayerClass): Array<{
height: number;
bitrate?: number;
id: string;
}>;
/**
* @param streamType Type of stream (hls, dash, etc.)
* @param qualityIdentifier Quality level identifier (index for HLS, ID for DASH)
*/
static setQuality(streamType: StreamType, qualityIdentifier: string): void;
/**
* @param streamType Type of stream (hls, dash, etc.)
*/
static setAutoQuality(streamType: StreamType): void;
}
export default QualityManager;