Skip to content

Commit

Permalink
feat: rename many things to main (#1309)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: rename PlaylistController
BREAKING CHANGE: rename HAVE_MASTER to HAVE_MAIN_MANIFEST
BREAKING CHANGE: playlist loaders updateMain and .main prop rename
BREAKING CHANGE: manifest.js exports mainForMedia and addPropertiesToMain
BREAKING CHANGE: rename media groups prop to isMainPlaylist
BREAKING CHANGE: rename property to mainPlaylistLoader_
BREAKING CHANGE: rename to PlaylistController#main()
  • Loading branch information
gkatsev authored Aug 17, 2022
1 parent 206f099 commit 54cbab3
Show file tree
Hide file tree
Showing 60 changed files with 2,612 additions and 2,846 deletions.
8 changes: 4 additions & 4 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Afterwards, you want to push the commit and the tag to the repo.
It's necessary to do this before running `npm publish` because our GitHub release automation relies on the commit being available on GitHub.

```sh
git push --follow-tags origin master
git push --follow-tags origin main
```

Publish to npm.
Expand All @@ -90,15 +90,15 @@ Publish to npm.
npm publish
```

After it's done, [create a release in github](https://github.com/videojs/http-streaming/releases/new) with latest tag, no title, description copied from [the changelog](https://github.com/videojs/http-streaming/blob/master/CHANGELOG.md), and the .min.js and .js dist files attached.
After it's done, [create a release in github](https://github.com/videojs/http-streaming/releases/new) with latest tag, no title, description copied from [the changelog](https://github.com/videojs/http-streaming/blob/main/CHANGELOG.md), and the .min.js and .js dist files attached.

If it's a large enough release, consider writing a blog post as well.

## Doc credit

This collaborator guide was heavily inspired by [node.js's guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md) and [video.js's guide](https://github.com/videojs/video.js/blob/master/COLLABORATOR_GUIDE.md)
This collaborator guide was heavily inspired by [node.js's guide](https://github.com/nodejs/node/blob/main/COLLABORATOR_GUIDE.md) and [video.js's guide](https://github.com/videojs/video.js/blob/main/COLLABORATOR_GUIDE.md)

[conventions]: https://github.com/videojs/conventional-changelog-videojs/blob/master/convention.md
[conventions]: https://github.com/videojs/conventional-changelog-videojs/blob/main/convention.md

[vjs npm]: http://npmjs.com/org/videojs

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Testing is a crucial part of any software project. For all but the most trivial

[karma]: http://karma-runner.github.io/
[local]: http://localhost:9999/test/
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/main/docs/conventions.md
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Included in video.js 7 by default! See the [video.js 7 blog post](https://blog.v

Maintenance Status: Stable

Video.js Compatibility: 6.0, 7.0
Video.js Compatibility: 7.x, 8.x

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
Expand Down Expand Up @@ -61,7 +61,7 @@ Video.js Compatibility: 6.0, 7.0
- [Format](#format)
- [Example](#example)
- [Runtime Properties](#runtime-properties)
- [vhs.playlists.master](#vhsplaylistsmaster)
- [vhs.playlists.main](#vhsplaylistsmain)
- [vhs.playlists.media](#vhsplaylistsmedia)
- [vhs.systemBandwidth](#vhssystembandwidth)
- [vhs.bandwidth](#vhsbandwidth)
Expand Down Expand Up @@ -172,7 +172,7 @@ This plugin does not support Flash playback. Instead, it is recommended that use

DRM is supported through [videojs-contrib-eme](https://github.com/videojs/videojs-contrib-eme). In order to use DRM, include the videojs-contrib-eme plug, [initialize it](https://github.com/videojs/videojs-contrib-eme#initialization), and add options to either the [plugin](https://github.com/videojs/videojs-contrib-eme#plugin-options) or the [source](https://github.com/videojs/videojs-contrib-eme#source-options).

Detailed option information can be found in the [videojs-contrib-eme README](https://github.com/videojs/videojs-contrib-eme/blob/master/README.md).
Detailed option information can be found in the [videojs-contrib-eme README](https://github.com/videojs/videojs-contrib-eme/blob/main/README.md).

## Documentation
[HTTP Live Streaming](https://developer.apple.com/streaming/) (HLS) has
Expand Down Expand Up @@ -522,11 +522,11 @@ work across all the media types that video.js supports. If you're
deploying videojs-http-streaming on your own website and want to make a
couple tweaks though, go for it!

#### vhs.playlists.master
#### vhs.playlists.main
Type: `object`

An object representing the parsed master playlist. If a media playlist
is loaded directly, a master playlist with only one entry will be
An object representing the parsed main playlist. If a media playlist
is loaded directly, a main playlist with only one entry will be
created.

#### vhs.playlists.media
Expand All @@ -537,7 +537,7 @@ media playlist. The active media playlist is referred to when
additional video data needs to be downloaded. Calling this function
with no arguments returns the parsed playlist object for the active
media playlist. Calling this function with a playlist object from the
master playlist or a URI string as specified in the master playlist
main playlist or a URI string as specified in the main playlist
will kick off an asynchronous load of the specified media
playlist. Once it has been retreived, it will become the active media
playlist.
Expand Down Expand Up @@ -577,7 +577,7 @@ A function that returns the media playlist object to use to download
the next segment. It is invoked by the tech immediately before a new
segment is downloaded. You can override this function to provide your
adaptive streaming logic. You must, however, be sure to return a valid
media playlist object that is present in `player.tech().vhs.master`.
media playlist object that is present in `player.tech().vhs.main`.

Overridding this function with your own is very powerful but is overkill
for many purposes. Most of the time, you should use the much simpler
Expand Down Expand Up @@ -691,7 +691,7 @@ This object contains a summary of HLS and player related stats.
| currentSource | object | The source object. Has the structure `{src: 'url', type: 'mimetype'}` |
| currentTech | string | The name of the tech in use |
| duration | number | Duration of the video in seconds |
| master | object | The [master playlist object](#vhsplaylistsmaster) |
| main | object | The [main playlist object](#vhsplaylistsmain) |
| playerDimensions | object | Contains the width and height of the player |
| seekable | array | List of time ranges that the player can seek to |
| timestamp | number | Timestamp of when `vhs.stats` was accessed |
Expand Down Expand Up @@ -732,7 +732,7 @@ player.on('ready', () => {
```

Note that these events are triggered as soon as a case is encountered, and often only
once. For example, the `vhs-demuxed` usage event will be triggered as soon as the master
once. For example, the `vhs-demuxed` usage event will be triggered as soon as the main
manifest is downloaded and parsed, and will not be triggered again.

#### Presence Stats
Expand All @@ -741,11 +741,11 @@ Each of the following usage events are fired once per source if (and when) detec

| Name | Description |
| ------------- | ------------- |
| vhs-webvtt | master manifest has at least one segmented WebVTT playlist |
| vhs-webvtt | main manifest has at least one segmented WebVTT playlist |
| vhs-aes | a playlist is AES encrypted |
| vhs-fmp4 | a playlist used fMP4 segments |
| vhs-demuxed | audio and video are demuxed by default |
| vhs-alternate-audio | alternate audio available in the master manifest |
| vhs-alternate-audio | alternate audio available in the main manifest |
| vhs-playlist-cue-tags | a playlist used cue tags (see useCueTags(#usecuetags) for details) |
| vhs-bandwidth-from-local-storage | starting bandwidth was retrieved from local storage (see useBandwidthFromLocalStorage(#useBandwidthFromLocalStorage) for details) |
| vhs-throughput-from-local-storage | starting throughput was retrieved from local storage (see useBandwidthFromLocalStorage(#useBandwidthFromLocalStorage) for details) |
Expand Down
8 changes: 4 additions & 4 deletions design/media-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ These are used to represent:

Currently, [MediaGroups][mg] interacts with several different classes, which can be difficult to follow and has cause bugs in the past. These components are:
- multiple [DashPlaylistLoaders][dpl] or [PlaylistLoaders][pl]
- [MasterPlaylistController][mpc]
- [PlaylistController][PC]
- multiple [SegmentLoaders][sl]

[MediaGroups][mg] are **setup** by the `loadedmetadata` handler for the `masterPlaylistLoader` (video playlist loader) of a source; contained in the [MasterPlaylistController][mpc] (MPC). The [MPC] will pass in an `audioSegmentLoader` and `subtitleSegmentLoader` to be shared by the `AUDIO` and `SUBTITLE` mediaGroups respectively.
[MediaGroups][mg] are **setup** by the `loadedmetadata` handler for the `mainPlaylistLoader` (video playlist loader) of a source; contained in the [PlaylistController][PC] (PC). The [PC] will pass in an `audioSegmentLoader` and `subtitleSegmentLoader` to be shared by the `AUDIO` and `SUBTITLE` mediaGroups respectively.

This **setup** includes creating either [DashPlaylistLoaders][dpl] or [PlaylistLoaders][pl] for each track described in the manifest and a corresponding HTML Track (either audio or text).

Expand All @@ -34,10 +34,10 @@ Currently, videojs-http-streaming (VHS) does not support multiple video tracks.

## Future Ideas

Considering that we could have multiple tracks of all media types, it may be the most accurate to **always** use MediaGroups for all content. This would include HLS without alternate audio tracks and DASH for all cases. In this way, the MasterPlaylistController could delegate much of the interaction handling for the PlaylistLoaders and SegmentLoaders to the MediaGroups class which would act as a specialized controller.
Considering that we could have multiple tracks of all media types, it may be the most accurate to **always** use MediaGroups for all content. This would include HLS without alternate audio tracks and DASH for all cases. In this way, the PlaylistController could delegate much of the interaction handling for the PlaylistLoaders and SegmentLoaders to the MediaGroups class which would act as a specialized controller.

[dpl]: ../src/dash-playlist-loader.js
[mg]: ../src/media-groups.js
[pl]: ../src/playlist-loader.js
[mpc]: ../src/master-playlist-controller.js
[PC]: ../src/playlist-controller.js
[sl]: ../src/segment-loader.js
15 changes: 13 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Overview](#overview)
- [HTTP Live Streaming](#http-live-streaming)
- [Dynamic Adaptive Streaming over HTTP](#dynamic-adaptive-streaming-over-http)
- [Further Documentation](#further-documentation)
- [Helpful Tools](#helpful-tools)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Overview
This project supports both [HLS][hls] and [MPEG-DASH][dash] playback in the video.js player. This document is intended as a primer for anyone interested in contributing or just better understanding how bits from a server get turned into video on their display.

Expand All @@ -7,11 +18,11 @@ This project supports both [HLS][hls] and [MPEG-DASH][dash] playback in the vide
- Delivered over HTTP(S): it uses the standard application protocol of the web to deliver all its data
- Segmented: longer videos are broken up into smaller chunks which can be downloaded independently and switched between at runtime

A standard HLS stream consists of a *Master Playlist* which references one or more *Media Playlists*. Each Media Playlist contains one or more sequential video segments. All these components form a logical hierarchy that informs the player of the different quality levels of the video available and how to address the individual segments of video at each of those levels:
A standard HLS stream consists of a *Main Playlist* which references one or more *Media Playlists*. Each Media Playlist contains one or more sequential video segments. All these components form a logical hierarchy that informs the player of the different quality levels of the video available and how to address the individual segments of video at each of those levels:

![HLS Format](images/hls-format.png)

HLS streams can be delivered in two different modes: a "static" mode for videos that can be played back from any point, often referred to as video-on-demand (VOD); or a "live" mode where later portions of the video become available as time goes by. In the static mode, the Master and Media playlists are fixed. The player is guaranteed that the set of video segments referenced by those playlists will not change over time.
HLS streams can be delivered in two different modes: a "static" mode for videos that can be played back from any point, often referred to as video-on-demand (VOD); or a "live" mode where later portions of the video become available as time goes by. In the static mode, the Main and Media playlists are fixed. The player is guaranteed that the set of video segments referenced by those playlists will not change over time.

Live mode can work in one of two ways. For truly live events, the most common configuration is for each individual Media Playlist to only include the latest video segment and a small number of consecutive previous segments. In this mode, the player may be able to seek backwards a short time in the video but probably not all the way back to the beginning. In the other live configuration, new video segments can be appended to the Media Playlists but older segments are never removed. This configuration allows the player to seek back to the beginning of the stream at any time during the broadcast and transitions seamlessly to the static stream type when the event finishes.

Expand Down
Loading

0 comments on commit 54cbab3

Please sign in to comment.