Player.tech--.hls Is Deprecated. Use Player.tech--.vhs Instead — Videojs Warn
// This uses the updated, unified engine syntax var currentPlaylist = player.tech().vhs.playlists.media(); Use code with caution. 2. Update Initialization Options
Most developers access the tech object to handle manual quality switching or to inspect manifest data. Here is how to do it the "new" way: 1. Accessing the Master Playlist javascript const masterPlaylist = player.tech().vhs.playlists.master; Use code with caution. Copied to clipboard 2. Listening for Quality Changes javascript
To silence the warning and ensure compatibility, replace any direct references to .hls with .vhs in your JavaScript code. javascript
// NEW (using VHS) const vhs = player.tech_.vhs; vhs.representations(); // Get available qualities vhs.currentLevel(2); // Set quality level (0-based index)
To resolve the warning and ensure future compatibility, you should update your code to reference vhs instead of hls . 1. Update Direct Property Access // This uses the updated, unified engine syntax
If you can't immediately fix the source, you can filter the warning:
<!-- VHS is included automatically in Video.js 7+ core --> <!-- No extra plugin needed -->
If you are manually loading videojs-contrib-hls via tags or npm , . It is no longer necessary. Step 3: Update techOrder or Source Configuration
If you are manually accessing the streaming tech object to check playlists or bandwidth, change your syntax: javascript Here is how to do it the "new" way: 1
. Always check if the object exists before accessing its properties: javascript tech = player.tech(); (tech.vhs) { // Apply VHS-specific logic here Use code with caution. Copied to clipboard If you'd like, I can help you: a specific plugin that is causing this warning. xhr.beforeRequest hooks to the new VHS format.
player.tech().hls is deprecated. Use player.tech().vhs instead #2
: References the new, unified engine that supports both HLS and DASH. How to Fix the Deprecation
Section 7: Benefits of Migrating to VHS. Listening for Quality Changes javascript To silence the
The player.tech--.hls is deprecated warning is a signal to update your video infrastructure to the modern standard. By ensuring you are using a modern version of Video.js and allowing it to utilize , you gain better performance, better support for adaptive streaming, and long-term compatibility.
);
const stats = player.tech_.hls.stats; console.log(stats.bandwidth);