Videojs Warn Player.tech--.hls Is Deprecated. Use Player.tech--.vhs Instead -
The Video.js core team issues deprecation warnings for two primary reasons:
In short: The warning does not mean tech_.hls is gone; it means it will be removed in a future major version.
The warning
videojs warn player.tech--.hls is deprecated. use player.tech--.vhs instead
is more of a friendly nudge than an emergency. However, ignoring it means your code relies on a deprecated alias that could vanish without notice in a next major Video.js release.
Fix summary:
By migrating to player.tech_.vhs, you ensure your custom HLS logic remains compatible, performant, and ready for the future of Video.js.
Have additional questions about VHS migrations? Check the official Video.js Slack or the @videojs/http-streaming GitHub issues page.
Here are a few options for the text, depending on where you need to use it (e.g., a developer release note, a console error explanation, or a support ticket).
If you did not write this code yourself, the warning is likely coming from a plugin (such as a quality selector, an analytics tracker, or a chromecast plugin).
API Changes: While the property name has changed, the available methods on the VHS object are largely similar, but you should consult the Video.js VHS documentation for specific method changes.
Summary:
Replace .hls with .vhs in your codebase to ensure compatibility with future versions of Video.js.
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 The Video
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
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
The warning videojs warn player.tech().hls is deprecated. use player.tech().vhs instead 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?
Protocol Neutrality: While the original engine (videojs-contrib-hls) was built specifically for HLS, developers realized the same core logic could handle multiple formats.
VHS Successor: VHS is the official successor that supports both HLS and DASH content within a single, unified codebase.
Better Integration: VHS has been bundled into Video.js by default since version 7.0, providing a more consistent experience across browsers by overriding native HLS playback where necessary. How to Fix the Warning
To resolve the deprecation warning, update your code to reference the vhs property instead of hls.
Accessing Runtime Properties:If you previously accessed properties like playlists or representations through player.tech().hls, switch to vhs: javascript
// Old (Deprecated) var hls = player.tech().hls; // New (Recommended) var vhs = player.tech().vhs; Use code with caution. Copied to clipboard In short: The warning does not mean tech_
Updating Initialization Options:When setting up your player, update your options object to use the vhs key: javascript
// Old (Deprecated) var player = videojs('my-video', hls: overrideNative: true ); // New (Recommended) var player = videojs('my-video', vhs: overrideNative: true ); Use code with caution. Copied to clipboard
Handling "Undefined" Errors:The vhs object is only attached to the tech when an HLS or DASH stream is actively in use. Ensure your media has loaded or use the player's ready callback before attempting to access it. videojs-http-streaming (VHS) - GitHub
This warning indicates that your implementation is using an outdated method to access HLS (HTTP Live Streaming) functionality . Since the release of Video.js 7, the videojs-contrib-hls plugin was replaced by VHS (Video.js HTTP-Streaming) 🛑 What the Warning Means The player is telling you that the property on the tech object is legacy. Old property: player.tech().hls (linked to the retired videojs-contrib-hls New property: player.tech().vhs (linked to the modern videojs-http-streaming 🛠️ How to Fix It
To resolve the warning, you must update your code wherever you are programmatically accessing HLS options, stats, or request hooks. 1. Update Property Access Search your codebase for player.tech().hls and replace it with Before (Deprecated): javascript // This will trigger the console warning
hlsObject = player.tech().hls; console.log(hlsObject.playlists.master); Use code with caution. Copied to clipboard After (Recommended): javascript // Use vhs instead vhsObject = player.tech().vhs; (vhsObject) console.log(vhsObject.playlists.master); Use code with caution. Copied to clipboard 2. Update Initialization Options
If you are passing HLS-specific configurations during player setup, move them under the javascript 'my-video' , { html5: { hls: { overrideNative: Use code with caution. Copied to clipboard javascript 'my-video' , { html5: { vhs: { overrideNative: Use code with caution. Copied to clipboard 💡 Why This Changed Better Support: VHS supports both Integration:
It is built directly into Video.js (v7+) so you no longer need to include external HLS plugins manually. Consistency:
Using VHS provides a more uniform experience across browsers by overriding unreliable native implementations when possible. ⚠️ Special Case: Safari and Mobile Note that on Safari (macOS/iOS) , Video.js often defaults to the browser's native HLS engine rather than VHS. In these cases, player.tech().vhs may return
. 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.
if your current version of Video.js is fully compatible with VHS. Let me know which part of your implementation you'd like to look at next!
player.tech().hls is deprecated. Use player.tech().vhs instead #2
Deprecation Warning: Using player.tech_.hls is Deprecated, Please Use player.tech_.vhs Instead
Introduction
Video.js is a popular JavaScript library used for video and audio playback on the web. Recently, a deprecation warning has been raised regarding the use of player.tech_.hls in Video.js. This report aims to provide an overview of the issue, its implications, and recommendations for mitigation.
Background
HLS (HTTP Live Streaming) is a widely used protocol for live and on-demand video streaming. In Video.js, HLS playback is facilitated through the hls tech. However, with the introduction of VHS (Video.js HLS Shim), a more efficient and feature-rich solution for HLS playback, the hls tech has been marked as deprecated.
The Deprecation Warning
When using Video.js with the hls tech, a warning is logged to the console:
WARN: player.tech_.hls is deprecated. Use player.tech_.vhs instead.
This warning indicates that the player.tech_.hls property is no longer recommended and will be removed in future versions of Video.js.
Implications
Using the deprecated player.tech_.hls property may lead to:
Recommendations
To ensure continued support and compatibility with future versions of Video.js:
player.tech_.hls and replace them with player.tech_.vhs.Example Code
Here's an example of how to initialize a Video.js player using the VHS tech:
const player = videojs('my-player',
techOrder: ['vhs'],
sources: [
src: 'https://example.com/hls-stream.m3u8',
type: 'application/x-mpegURL',
],
);
Conclusion
The deprecation of player.tech_.hls in Video.js is a necessary step towards maintaining a stable and feature-rich playback solution. By migrating to player.tech_.vhs, you can ensure continued support, compatibility, and access to the latest features and bug fixes. We recommend updating your code to use the VHS tech to avoid potential issues and ensure a seamless playback experience. By migrating to player
Change those occurrences to:
player.tech_.vhs
// or
player.tech().vhs
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet" />
<script src="https://unpkg.com/video.js/dist/video.min.js"></script>
<script src="https://unpkg.com/videojs-http-streaming/dist/videojs-http-streaming.min.js"></script>
<video id="player" class="video-js vjs-default-skin" controls></video>
<script>
const player = videojs('player',
techOrder: ['html5'],
html5:
vhs:
overrideNative: true,
withCredentials: false,
maxBufferLength: 30
);
player.src( src: 'https://example.com/stream.m3u8', type: 'application/x-mpegURL' );
</script>