If you are seeing the warning "VIDEOJS: WARN: player.tech().hls is deprecated. Use player.tech().vhs instead," it is because your code is still using the older videojs-contrib-hls naming convention.
Since Video.js 7, the player uses a unified engine called VHS (Video.js HTTP Streaming) to handle both HLS and DASH streams. This change ensures a more consistent API regardless of the streaming protocol being used. How to Fix the Deprecation Warning
To resolve this, you need to update how you access the streaming technology object and how you configure your player options. 1. Update Programmatic Access
If your JavaScript code manually accesses the HLS object to change quality levels, tracks, or metadata, change hls to vhs. Old (Deprecated): javascript
var player = videojs('my-video'); player.ready(function() // This triggers the warning var hls = player.tech().hls; console.log(hls.playlists.master); ); Use code with caution. New (Correct): javascript
var player = videojs('my-video'); player.ready(function() // Use .vhs instead var vhs = player.tech().vhs; if (vhs) console.log(vhs.playlists.master); ); Use code with caution. 2. Update Configuration Options
If you are passing options to the player during initialization, update the key from hls to vhs within the html5 object. Old (Deprecated): javascript
var player = videojs('my-video', html5: hls: overrideNative: true ); Use code with caution. New (Correct): javascript
var player = videojs('my-video', html5: vhs: overrideNative: true ); Use code with caution. Why the Change Happened
Unified Engine: Video.js HTTP Streaming (VHS) replaced the separate videojs-contrib-hls and DASH plugins. If you are seeing the warning "VIDEOJS: WARN: player
Protocol Agnostic: Because VHS handles multiple formats, calling it .hls was technically inaccurate when the player was actually playing a DASH stream.
Better Support: VHS is bundled by default in Video.js 7 and 8, offering improved cross-browser compatibility and features like low-latency HLS. Potential "Undefined" Issues
If you switch to .vhs and it returns undefined, check the following: videojs-http-streaming (VHS) - GitHub
This warning appears because Video.js has replaced the old videojs-contrib-hls plugin with Video.js HTTP Streaming (VHS). Starting with Video.js 7, VHS is the default engine for handling HLS and DASH playback.
To resolve this warning and ensure your code is future-proof, you should update how you access the HLS tech properties in your JavaScript: 1. Update Property Access
If you are accessing the HLS object via code, change your reference from hls to vhs. Old (Deprecated): player.tech().hls or player.hls New (Recommended): player.tech().vhs 2. Update Initialization Options
If you are passing options specifically for HLS during player setup, rename the hls key to vhs. Old: javascript
videojs('my-player', html5: hls: overrideNative: true ); Use code with caution. Copied to clipboard New: javascript
videojs('my-player', html5: vhs: overrideNative: true ); Use code with caution. Copied to clipboard Why this changed ✅ New (recommended):
let seekable = player
player.tech().hls is deprecated. Use player.tech().vhs instead #2
The warning "VIDEOJS: WARN: player.tech().hls is deprecated. Use player.tech().vhs instead" appears because Video.js has replaced its older HLS-specific library (videojs-contrib-hls) with Video.js HTTP Streaming (VHS).
VHS is the modern successor that handles both HLS and DASH streams using a single engine. While HLS is still supported, the specific API property hls has been renamed to vhs to reflect this multi-format capability. Why the Change?
Unified Engine: VHS was created when developers realised the HLS engine could also play DASH content with minimal changes.
Broad Support: VHS is built into Video.js 7 by default, abstracting away browser-specific differences in streaming technology.
Future-Proofing: Renaming the property to vhs allows Video.js to add support for new streaming formats without needing separate "tech" objects for each. How to Fix the Warning
To resolve the warning, update your JavaScript code to reference vhs instead of hls. 1. Update Runtime References
If you are accessing HLS properties at runtime (e.g., for bitrate switching or quality levels), change your references: javascript
// Deprecated var hls = player.tech().hls; // Correct var vhs = player.tech().vhs; Use code with caution. Copied to clipboard 2. Update Initialization Options function()
console.log('Quality changed')
If you are passing options to the HLS source handler during setup, update the key in your options object: javascript
// Deprecated var player = videojs('my-video', html5: hls: withCredentials: true ); // Correct var player = videojs('my-video', html5: vhs: withCredentials: true ); Use code with caution. Copied to clipboard Quick Troubleshooting
Persistent Warnings: If you haven't manually added hls to your code but still see the warning, it may be coming from a third-party plugin (like Mux Data) that hasn't been updated to the latest Video.js API.
Silencing Logs: For certain edge cases where you must use the older reference, calling player.tech(true).hls may stop the large volume of console logs in some environments. videojs-http-streaming (VHS) - GitHub
.hls with .vhsChange those occurrences to:
player.tech_.vhs
// or
player.tech().vhs
.vhsChange those lines to use player.tech_.vhs.
❌ Old (deprecated):
let seekable = player.tech_.hls.seekable();
player.tech_.hls.on('mediaqualitychange', function()
console.log('Quality changed');
);
✅ New (recommended):
let seekable = player.tech_.vhs.seekable();
player.tech_.vhs.on('mediaqualitychange', function()
console.log('Quality changed');
);
.hls in your code?Don’t panic. The warning could be coming from:
Try updating Video.js and http-streaming to the latest versions:
npm install video.js@latest @videojs/http-streaming@latest