Videojs Warn Player.tech--.hls Is Deprecated. Use Player.tech--.vhs Instead

If you recently updated Video.js or your browser console is suddenly flooded with the warning player.tech().hls is deprecated. use player.tech().vhs instead , you aren't alone. This is a common transition point for developers moving toward more modern streaming standards. ⚡ The Quick Fix

The warning occurs because Video.js transitioned its underlying streaming engine from a dedicated HLS library to the more versatile Video.js HTTP Streaming (VHS) engine. Why the Change?

yourself, a plugin like a quality selector or resolution switcher may be outdated. Check for updates for those specific libraries on 4. Critical Considerations Native vs. VHS : In some browsers like Safari, player.tech().vhs If you recently updated Video

// OLD: manually registering HLS tech videojs.registerTech('Hls', videojs.getTech('Hls'));

Not necessarily. You must also replace videojs-contrib-hls with @videojs/http-streaming or ensure your Video.js distribution includes VHS (the CDN versions do after v7.0.0). ⚡ The Quick Fix The warning occurs because Video

player.textTracks().on('addtrack', (e) => console.log('Track added:', e.track); );

The engine was renamed to VHS (Video.js HTTP Streaming). Check for updates for those specific libraries on 4

const player = videojs('my-player', techOrder: ['vhs'], sources: [

videojs('my-player', html5: vhs: overrideNative: true ); Use code with caution. Key Benefits of VHS

// Get available representations (qualities) const representations = player.tech_.vhs.representations(); // Switch to a specific representation (by ID) player.tech_.vhs.representation(representations[2].id); // Or use the simpler level API player.tech_.vhs.currentLevel(2); // Get current level index const currentLevel = player.tech_.vhs.currentLevel();

Here's an example of how to initialize a Video.js player using the VHS tech:

Ads
Clay Creatures by Esther Goldbreikh
Beautiful hand-made ceramics from Armenia