var player = videojs('my-video'); player.ready(function() // Use vhs (VideoJS HTTP Streaming) instead var vhs = player.tech().vhs; if (vhs) console.log(vhs.playlists.master); ); Use code with caution. Copied to clipboard 🤔 Why is this happening?
Fixing this issue requires updating how you programmatically interact with the Video.js instance in your JavaScript files. 1. Update Direct Property Access
player.getTech().vhs.on('segmentloaderror', (e) => ... );
var representations = player.tech_.vhs.representations(); representations[2].enabled(true); var player = videojs('my-video'); player
If you are manually loading videojs-contrib-hls via tags or npm , . It is no longer necessary. Step 3: Update techOrder or Source Configuration
An underlying change in how Video.js handles HTTP Live Streaming (HLS) triggers the warning message . This occurs because the internal streaming engine has transitioned from the old Video.js HLS (HLS tech) to the modern VideoJS HTTP Streaming (VHS) engine [1].
: Replace instances where you directly access the HLS tech. Old : var hls = player.tech().hls; New : var vhs = player.tech().vhs; It is no longer necessary
. Unlike its predecessor, VHS supports both HLS and DASH formats. To reflect this unified engine, the property used to access runtime streaming data was renamed from 2. Comparison of Access Methods Old (Deprecated) New (Recommended) player.tech().hls player.tech().vhs player.hls (even older) player.tech().vhs 3. How to Resolve Direct Access
The VHS API is designed to be mostly compatible. Commonly used properties/methods:
Conclusion: Summary and best practices.
Given the slow-moving nature of major video player upgrades, you likely have after the v9 release notice. Nevertheless, fixing the warning today takes less than an hour for most codebases and eliminates a future bug.
If you are building or maintaining a web video platform, you may have recently opened your browser console and spotted this warning: [Warn] videojs: WARN: player.tech_.hls is deprecated. Use player.tech_.vhs instead .
const player = videojs('my-video', sources: [ src: 'stream.m3u8', type: 'application/x-mpegURL' ] ); checking playlists or quality levels)
The warning does not crash the page, but it clutters the console, and future Video.js updates may remove .hls altogether.
If you are programmatically interacting with the streaming tech (e.g., checking playlists or quality levels), change your accessors: javascript
Help support the project by making a contribution at OpenCollective.
These organizations support Owncast via non-monetary support and services.