|
| 1 | +--- |
| 2 | +title: Video.js 8 and Video.js HTTP Streaming 3 |
| 3 | +author: |
| 4 | + name: Pat O'Neill |
| 5 | + github: misteroneill |
| 6 | +date: 2022-08-22 14:49:43 |
| 7 | +tags: |
| 8 | +--- |
| 9 | + |
| 10 | +<div class="note"> |
| 11 | + <p><b>NOTE:</b> For details on migrating from Video.js 7.x to 8.x, please see <a href="/guides/videojs-7-to-8/">our migration guide</a>!</p> |
| 12 | +</div> |
| 13 | + |
| 14 | +We are very excited to announce that Video.js 8.0 and Video.js HTTP Streaming (VHS) 3.0 are available! |
| 15 | + |
| 16 | +While these releases are constituted of a lot of housecleaning tasks, there are some changes of interest to users of the Video.js platform. |
| 17 | + |
| 18 | +## Contributors |
| 19 | + |
| 20 | +Before we dive into the software changes, open source doesn't work without _people_. Huge thanks to everyone who contributed pull requests to these releases! |
| 21 | + |
| 22 | +* [@alex-barstow](https://github.com/alex-barstow) |
| 23 | +* [@Essk](https://github.com/Essk) |
| 24 | +* [@gesinger](https://github.com/gesinger) |
| 25 | +* [@gjanblaszczyk](https://github.com/gjanblaszczyk) |
| 26 | +* [@gkatsev](https://github.com/gkatsev) |
| 27 | +* [@harisha-swaminathan](https://github.com/harisha-swaminathan) |
| 28 | +* [@hugorogz](https://github.com/hugorogz) |
| 29 | +* [@KangXinzhi](https://github.com/KangXinzhi) |
| 30 | +* [@kchang-brightcove](https://github.com/kchang-brightcove) |
| 31 | +* [@mister-ben](https://github.com/mister-ben) |
| 32 | +* [@misteroneill](https://github.com/misteroneill) |
| 33 | +* [@phloxic](https://github.com/phloxic) |
| 34 | +* [@roman-bc-dev](https://github.com/roman-bc-dev) |
| 35 | + |
| 36 | +## What's Changed? |
| 37 | +### Video.js |
| 38 | + |
| 39 | +The [complete CHANGELOG is available](https://github.com/videojs/video.js/blob/c8fd5bbcdebacdb2e1f46ae8be02ef6c91797262/CHANGELOG.md), but here are some highlights: |
| 40 | + |
| 41 | +* No longer transpiled into ES5 for compatibility with older browsers like Internet Explorer |
| 42 | +* Updated to VHS 3.0 |
| 43 | +* Enabled the `sourceset` event by default, `enableSourceset: false` can be used to turn this off. |
| 44 | +* Added new `TitleBar` component, which is not visible in the UI by default _([see below for details](#new-videojs-titlebar-component))_. As a result, we moved the `BigPlayButton` component to the center of the player by default |
| 45 | +* `addClass` and `removeClass` methods can now be given multiple class names |
| 46 | +* Clicking the playback rate button now opens the menu rather than changing the playback rate |
| 47 | +* Deprecated many old top-level utility methods in favor of utility methods stored on objects _([see below for details](#new-videojs-utility-objects))_ |
| 48 | +* Invalid event types will now throw errors instead of log warnings |
| 49 | +* Change `addRemoteTextTrack`'s `manualCleanup` option to default to `false` |
| 50 | +* Removed the `videojs.extend()` function |
| 51 | +* Removed the `firstplay` event |
| 52 | +* Removed the `retryOnError` option and made this behavior the default |
| 53 | +* Removed the ability to set `aria-*`, `role`, and `type` attributes via the `props` argument of `createEl` methods |
| 54 | +* Removed remaining references and logic related to Flash and SWF |
| 55 | +* Remove fallbacks for missing flexbox support |
| 56 | +* Removed IE-specific code |
| 57 | + |
| 58 | +Overall, the minfied and gzipped size of Video.js is **reduced by around 3%**. We will continue to look for ways to optimize the size of Video.js. |
| 59 | + |
| 60 | +### VHS |
| 61 | + |
| 62 | +The [complete CHANGELOG is available](https://github.com/videojs/http-streaming/blob/afb1ff700e490d131df4aea66d746cf72794caae/CHANGELOG.md), but here are some highlights: |
| 63 | + |
| 64 | +* No longer transpiled into ES5 for compatibility with older browsers like Internet Explorer. |
| 65 | +* Naming changes for more inclusive language (e.g. "master" becomes "main", "blacklist" becomes "exclude", "whitelist" becomes "include"). |
| 66 | +* Skip detected gaps immediately instead of waiting the duration of the gap before skipping. |
| 67 | +* Removed the deprecated `smoothQualityChange` method. |
| 68 | +* Improved behavior when encountering `output-restricted` event handling. |
| 69 | +* Cleaned up parameters of `excludePlaylist`. |
| 70 | + |
| 71 | +Overall, the minfied and gzipped size of VHS is **reduced by around 4%**. We will continue to look for ways to optimize the size of VHS. |
| 72 | + |
| 73 | +### Browser/Device Support |
| 74 | + |
| 75 | +With these releases, our new browser/device targets are generally focused on the last 3 major versions of so-called "evergreen" browsers: |
| 76 | + |
| 77 | +* Chrome |
| 78 | +* Firefox |
| 79 | +* Safari |
| 80 | +* Edge (Chromium, not Legacy) |
| 81 | + |
| 82 | +However, with Video.js being used in more contexts than just desktop and mobile web, like Smart TVs or OTT devices, we have an additional minimum support threshold for _Chromium-based browsers version 53 and newer_. This grants support for: |
| 83 | + |
| 84 | +* [webOS TV](https://webostv.developer.lge.com/develop/specifications/web-engine/) 4.x and newer |
| 85 | +* [Tizen](https://developer.samsung.com/smarttv/develop/specifications/web-engine-specifications.html) 2018 models and newer |
| 86 | + |
| 87 | +## New Video.js `TitleBar` Component |
| 88 | + |
| 89 | +The new `TitleBar` component will show a UI element across the top of the player which displays the title and/or description of the current media in the player. The `TitleBar` will not show if no title or description is provided. |
| 90 | + |
| 91 | +### Using `loadMedia` to Populate the `TitleBar` |
| 92 | + |
| 93 | +The easiest way to provide a title and/or description is to use your player's `loadMedia` method: |
| 94 | + |
| 95 | +```js |
| 96 | +player.loadMedia({ |
| 97 | + artist: 'Disney', |
| 98 | + album: 'Oceans', |
| 99 | + title: 'Oceans', |
| 100 | + description: 'Journey in to the depths ... and race with dolphins at play.', |
| 101 | + poster: 'https://vjs.zencdn.net/v/oceans.png', |
| 102 | + src: [{ |
| 103 | + src: 'https://vjs.zencdn.net/v/oceans.mp4', |
| 104 | + type: 'video/mp4' |
| 105 | + }, { |
| 106 | + src: 'https://vjs.zencdn.net/v/oceans.webm', |
| 107 | + type: 'video/webm' |
| 108 | + }] |
| 109 | +}) |
| 110 | +``` |
| 111 | + |
| 112 | +If you're not familiar with the `loadMedia` method, it's a way to provide additional metadata for your media beyond what is available through the `src` method alone. As you see in the above example, the `title` and `description` are provided and will be used to populate the title bar. |
| 113 | + |
| 114 | +### Populating the `TitleBar` Directly |
| 115 | + |
| 116 | +The `TitleBar` can also be populated through direct input using the component's `update` method: |
| 117 | + |
| 118 | +```js |
| 119 | +player.titleBar.update({ |
| 120 | + title: 'Oceans', |
| 121 | + description: 'Journey in to the depths ... and race with dolphins at play.' |
| 122 | +}); |
| 123 | +``` |
| 124 | + |
| 125 | +The title and/or description can be removed by passing an empty string for one or both of these values: |
| 126 | + |
| 127 | +```js |
| 128 | +player.titleBar.update({ |
| 129 | + title: '', |
| 130 | + description: '' |
| 131 | +}); |
| 132 | +``` |
| 133 | + |
| 134 | +If both are removed, the `TitleBar` will no longer be visible. |
| 135 | + |
| 136 | +## New Video.js Utility Objects |
| 137 | + |
| 138 | +Over time, the `videojs` namespace has become cluttered with a wide variety of utility functions. One of the changes we are introducing is a more deliberately designed interface for these utility functions. |
| 139 | + |
| 140 | +The guiding principle here was that if a function didn't feel like a core part of the library, but was still potentially useful to plugins and other integrations, we exposed it as part of a utility object instead of a top-level function. |
| 141 | + |
| 142 | +These are the utility objects attached to `videojs` in 8.0.0: |
| 143 | + |
| 144 | +Object | Description |
| 145 | +----------------------|-------------------------------------- |
| 146 | +`videojs.browser` | Various user-agent detection values (available previously) |
| 147 | +`videojs.dom` | DOM functions (available previously) |
| 148 | +`videojs.fn` | Function... functions |
| 149 | +`videojs.num` | Number functions |
| 150 | +`videojs.obj` | Object functions |
| 151 | +`videojs.str` | String functions |
| 152 | +`videojs.time` | Time-related functions |
| 153 | +`videojs.url` | URL-related functions |
| 154 | + |
| 155 | +<div class="note"> |
| 156 | + <p><b>NOTE:</b> For details on migrating from Video.js 7.x to 8.x, please see <a href="/guides/videojs-7-to-8/">our migration guide</a>!</p> |
| 157 | +</div> |
| 158 | + |
| 159 | +## Conclusion |
| 160 | + |
| 161 | +Thanks again to all our contributors and to the large community of developers who support Video.js by using it every day! |
| 162 | + |
| 163 | +If you'd like to contribute to Video.js, the place to start is our [CONTRIBUTING](https://github.com/videojs/video.js/blob/main/CONTRIBUTING.md) guide on GitHub. |
| 164 | + |
| 165 | +_Be well and build great things!_ |
0 commit comments