HLS Plugin

Product(s)
Video Cloud
Brightcove Player
Role(s)
Player Developer
Topic(s)
Playback
Plugins

The HLS plugin is a Brightcove player plugin that relies on W3C's Media Source Extensions (MSE) to play HTTP Live Streaming (HLS) video on platforms that do not natively support it. The HLS plugin is automatically included in the player.

HLS plugin basics

The following points help you understand and use the HLS plugin:

  • As mentioned in the opening sentence of this document, the plugin relies on W3C's Media Source Extensions (MSE). MSE is a W3C specification that allows JavaScript to send byte streams to media codecs within web browsers that support HTML5 video. Among other possible uses, this allows the implementation of client-side prefetching and buffering code for streaming media entirely in JavaScript.
  • With the plugin you can then use HLS (m3u8) video content in the player. For instance you could create a player using this configuration for the media section:
    "media":{
        "sources": [{
            "src": "http://example.com/video.m3u8",
            "type": "application/x-mpegURL"
        }]
    }
  • Cross-origin resource sharing (CORS) can be an issue when using HLS. For more information about using CORS, see the CORS guide.
  • Flash will be used as a fallback to play HLS only on IE11 on Windows 7.
  • HLS is not supported on versions of IE earlier than IE11.

Overview

HTTP Live Streaming (HLS) has become a de-facto standard for streaming video on mobile devices thanks to its native support on iOS and Android. Although, there are a number of reasons independent of platform to recommend the format:

  • Supports (client-driven) adaptive bitrate selection
  • Delivered over standard HTTP ports
  • Simple, text-based manifest format
  • No proprietary streaming servers required

Unfortunately, all the major desktop browsers except for Safari are missing HLS support. That leaves web developers in the unfortunate position of having to maintain alternate renditions of the same video and potentially having to forego HTML-based video entirely to provide the best desktop viewing experience.

This plugin addresses the situation by providing a polyfill for HLS on browsers that have Media Source Extensions or Flash support. You can deploy a single HLS stream, code against the regular HTML5 video APIs, and create a fast, high-quality video experience across all the big web device categories.

Currently, at this time there is no support for:

  • Alternate audio and video tracks
  • Segment codecs other than H.264 with AAC audio
  • Internet Explorer < 11

Options

There are several options you can use to configure the HLS plugin.

withCredentials

Type: boolean

Can be used as:

  • a source option
  • an initialization option

When the withCredentials property is set to true, all XHR requests for manifests and segments would have withCredentials set to true as well. This enables storing and passing cookies from the server that the manifests and segments live on. This has some implications on CORS because when set, the Access-Control-Allow-Origin header cannot be set to *, also, the response headers require the addition of Access-Control-Allow-Credentials header which is set to true. See the HTML5Rocks's article for more info.

You can configure the plugin using the Player Management API using an HTTP PATCH method, as shown here:

curl \
    --header "Content-Type: application/json" \
    --user YOUR_EMAIL \
    --request PATCH \
    --data '{ "hls": { "withCredentials": true } }' \
https://players.api.brightcove.com/v2/accounts/YOUR_ACCOUNT_ID/players/YOUR_PLAYER_ID/configuration

You can also set the withCredentials option on a per source basis, rather than on a player basis as just shown. For instance, when setting the source you can include withCredentials, as shown here:

curl \
  --header "Content-Type: application/json" \
  --user $EMAIL \
  --request POST \
  --data '{
      "name": "MySamplePlayer",
      "configuration": {
        "media": {
          "sources": [{
            "src":"http://solutions.brightcove.com/bcls/assets/videos/Tiger.mp4",
            "type":"video/mp4",
            "withCredentials": true
          }]
        }
      }
    }' \
https://players.api.brightcove.com/v2/accounts/$ACCOUNT_ID/players

Runtime configuration

You can configure withCredentials at runtime. You will see below two implementations:

  • Using player.hls.xhr.beforeRequest
  • Using player.src()

In the following code you are using the player.hls.xhr.beforeRequest to assign a function that will be called with an object containing options that will be used to create the xhr request. In this example you see only withCredentials is being configured.

if (videojs.Hls) {
  videojs.Hls.xhr.beforeRequest = function (options) {
    options.withCredentials = true;
  }
}

You can also set the withCredentials options when setting the video source. You use the player.src() method, as shown here:

player.src({
  src: 'https://adomain.com/bipbop_16x9_variant.m3u8',
  type: 'application/x-mpegURL',
  withCredentials: true
});

enableLowInitialPlaylist

Type: boolean

Can be used as:

  • an initialization option

When enableLowInitialPlaylist is set to true, it will be used to select the lowest bitrate playlist initially. This helps to decrease playback start time. This setting is false by default.

You can configure the plugin using the Player Management API using an HTTP PATCH method, as shown here:

curl \
    --header "Content-Type: application/json" \
    --user YOUR_EMAIL \
    --request PATCH \
    --data '{ "hls": { "enableLowInitialPlaylist": true } }' \
https://players.api.brightcove.com/v2/accounts/YOUR_ACCOUNT_ID/players/YOUR_PLAYER_ID/configuration

Runtime properties

In general, you can access the HLS object this way:

  • Brightcove Player v5: player.hls
  • Brightcove Player v6: player.tech().hls

player.hls.playlists.master

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 created.

player.hls.playlists.media

Type: function

A function that can be used to retrieve or modify the currently active 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 will kick off an asynchronous load of the specified media playlist. Once it has been retrieved, it will become the active media playlist.

player.hls.bandwidth

Type: number

The number of bits downloaded per second in the last segment download. This value is used by the default implementation of selectPlaylist to select an appropriate bitrate to play. Before the first video segment has been downloaded, it's hard to estimate bandwidth accurately. The HLS tech uses a heuristic based on the playlist download times to do this estimation by default. If you have a more accurate source of bandwidth information, you can override this value as soon as the HLS tech has loaded to provide an initial bandwidth estimate.

player.hls.stats.bytesReceived

Type: number

The total number of content bytes downloaded by the HLS tech.

player.hls.selectPlaylist

Type: function

A function that returns the media playlist object to use to download the next segment. It is invoked by the plugin 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.hls.playlists.master.

Events

loadedmetadata

Fired after the first media playlist is downloaded for a stream.

loadedplaylist

Fired immediately after a new master or media playlist has been downloaded. By default, the plugin only downloads playlists as they are needed.

mediachange

Fired when a new playlist becomes the active media playlist. Note that the actual rendering quality change does not occur simultaneously with this event; a new segment must be requested and the existing buffer depleted first.

Reload source on error

When using the HLS plugin there is a method you can call that will reload the source at its current time when an error is emitted by the player. To turn on this feature you need to call the reloadSourceOnError() method. The following short video shows the method in action. All the code shown in the video is described later in this section.

The syntax for the reloadSourceOnError() method is as follows:

reloadSourceOnError(optionsObject)

The optional optionsObject has the following properties:

Property Data Type Default Value Description
errorInterval Number 30 The minimum amount of time (in seconds) that has to pass between two errors for the reload to trigger. For example, if you set the time to 10, each time an error occurs the function will check to see if a reload has happened less than 10 seconds ago. If less than the time interval has passed, it will NOT reload the source. (This is to ensure that content with an error doesn't reload constantly.) If more time than the interval specified has passed, the video is reloaded at the point when the error occurred.
getSource() Function Retrieves current source A function that is called to get a source object to load or reload. By default it gets the current source of the player.

The following details the code used in the video demonstration above:

  • Lines 1-9: Standard in-page embed code with a player id added.
  • Line 11: Button to manually create errors.
  • Lines 22-24: Function called on button click to dispatch an error.
  • Line 19: Create an object in which to place configuration options.
  • Line 20: In the configuration object, create an errorInterval property and assign it a value.
  • Line 21: Call the reloadSourceOnError() method, passing the configuration object as an argument.
<video-js id="myPlayerID"
  data-video-id="4607746980001"
  data-account="1507807800001"
  data-player="HJLp3Hvmg"
  data-embed="default"
  data-application-id
  class="video-js"
  controls
></video-js>

<p><button onclick="createError()">createError</button></p>

<script src="https://players.brightcove.net/1507807800001/HJLp3Hvmg_default/index.min.js"></script>

<script type="text/javascript">
  var createError;
  videojs.getPlayer('myPlayerID').ready(function() {
    var myPlayer = this,
      reloadOptions = {};
    reloadOptions.errorInterval = 10;
    myPlayer.reloadSourceOnError(reloadOptions);
    createError = function(){
      myPlayer.error({code:'2'});
    }
  });
</script>

In-Manifest WebVTT

The HLS plugin supports in-manifest WebVTT. There is nothing you need to do to enable this feature as it is standard in the plugin. Videos need to be ingested with in-manifest WebVTT considered. For instance, the Brightcove Dynamic Ingest API can ingest videos and configure captions as in-manifest. See the Overview: Dynamic Ingest API for Dynamic Delivery document for more details.

The player below is playing a video with in-manifest WebVTT captions. You can select the captions via the captions icon, as shown here:

display captions icon

After you start the video you will be able to choose the captions you wish to see.

Simply to see, as this is something you would not build yourself, here is the manifest for the video shown in the player above:

#EXTM3U
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Woofer",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",URI="subtitles/en/index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Woofer (Forced)",DEFAULT=NO,AUTOSELECT=NO,FORCED=YES,LANGUAGE="en",URI="subtitles/en_forced/index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Spanish",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="es",URI="subtitles/es/index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Spanish (Forced)",DEFAULT=NO,AUTOSELECT=NO,FORCED=YES,LANGUAGE="es",URI="subtitles/es_forced/index.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=865000,CODECS="mp4a.40.2, avc1.42001e",RESOLUTION=640x360,SUBTITLES="subs"
865/prog_index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=12140000,CODECS="mp4a.40.2, avc1.42001e",RESOLUTION=1280x720,SUBTITLES="subs"
12140/prog_index.m3u8

In it you can see references to the captions file.

Adaptive switching

MP4 Rendition Selection

Generally, if viewing a video on a mobile device and playing an MP4, the player will choose the MP4 that has a bitrate closest to .5 Mbit/s. If on a desktop or laptop device it will choose one that is closest to 3 Mbit/s.

HLS Rendition Selection

HLS video is broken into segments. These are typically about 10 seconds in duration but can be longer or shorter. The player always starts with the rendition closest to .5 Mbit/s. On segment boundaries it will switch to a higher or lower rendition described in the text and images below.

The HLS tech tries to ensure the highest-quality viewing experience possible, given the available bandwidth and encodings. This doesn't always mean using the highest-bitrate rendition available. For instance, if the player is 300px by 150px, it would be a waste of bandwidth to download a 4k stream.

By default, the player attempts to load the highest-bitrate variant that is less than the most recently detected segment bandwidth, with one condition: if there are multiple variants with dimensions greater than the current player size, it will only switch up one size greater than the current player size.

The process is illustrated below:

  1. Whenever a new segment is downloaded, the download bitrate is calculated based on the size of the segment and the time it took to download:
    HLS rendition1
  2. All the renditions that have a higher bitrate than the new measurement are filtered out:
    HLS rendition2
  3. Any renditions that are bigger than the current player's dimensions are filtered out:
    HLS rendition3
  4. A significant quality drop is not wanted just because your player is one pixel too small, so we add back in the next highest resolution. The highest bitrate rendition that remains is the one that gets used:
    HLS rendition4

If it turns out no rendition is acceptable based on the filtering described above, the first encoding listed in the master playlist will be used.

If you'd like your player to use a different set of priorities, it's possible to completely replace the rendition selection logic. For instance, you could always choose the most appropriate rendition by resolution, even though this might mean more stalls during playback. See the documentation on player.hls.selectPlaylist for more details.

In-band metadata

Brightcove Player will recognize certain types of ID3 tag information embedded in an HLS video stream. The ID3 standard was originally used to provide metadata about MP3 audio tracks. (The acronym is from IDentify MP3.) When a stream is encountered with embedded metadata, an in-band metadata text track will automatically be created and populated with cues as they are encountered in the stream. A common use case is the ID3 data would direct when advertisements should be shown in a live stream.

The ID3 standard defines many frame types, but only the following two UTF-8 encoded frames will be mapped to cue points and their values set as cue text:

  • WXXX - User defined URL link frame
  • TXXX - User defined text information frame

Cues are created for all other frame types and the data is attached to the generated cue:

cue.frame.data

For more information about text tracks in general see Getting Started With the Track Element. For information on Brightcove Player and cue points see Using Cue Points.

Debugging

The information in this section is supplied for you to gather information that can then be passed to Brightcove Support to help resolve any HLS issues. That being said, some of the data reported could be of interest to you.

Two methods and one property will be detailed that assist in HLS debugging.

Method: videojs.log.level()

The videojs.log.level() method gets or sets the current logging level. To turn on debugging you use:

videojs.log.level('debug');

Method: videojs.log.history()

The history() method returns an array containing everything that has been logged to the history.

Any message that gets logged through the videojs.log API will be appended to the history array. What information is placed into that array is dependent on what plugins are in use that use the API, and the state of the player. This means that the history can easily contain non-HLS information. An example display from the console of the history array follows:

console display of history array

If you need to send the history array to support, the best thing to do is at the console type the following:

JSON.stringify(videojs.log.history())

You will get information similar to what is shown here:

console display of history stringified

Copy the JSON that is generated and that can then be sent to support.

Property: player.tech().hls.stats

This object contains a summary of HLS and player related stats. The available properties are shown in the following table:

Property Name Type Description
bandwidth number Rate of the last segment download in bits/second
buffered array List of time ranges of content that are in the SourceBuffer
currentSource object The source object; has the structure {src: 'url', type: 'mimetype'}
currentTech string The name of the tech in use
currentTime number The current position of the player
duration number Duration of the video in seconds
master object The master playlist object
mediaBytesTransferred number Total number of content bytes downloaded
mediaRequests number Total number of media segment requests
mediaRequestsAborted number Total number of aborted media segment requests
mediaRequestsErrored number Total number of errored media segment requests
mediaRequestsTimeout number Total number of timedout media segment requests
mediaSecondsLoaded number Total number of content seconds downloaded
mediaTransferDuration number Total time spent downloading media segments in milliseconds
playerDimensions object Contains the width and height of the player
seekable array List of time ranges to which the player can seek
timestamp number Timestamp of when hls.stats was accessed
videoPlaybackQuality object Media playback quality metrics as specified by the W3C's Media Playback Quality API

An example display from the console of the stats object follows:

console display of stats object

Code example

If you wish to experiment with these debugging features, code based on the following can server as a starting point:

<video-js id="myPlayerID" data-video-id="5622718636001"
  data-account="1507807800001"
  data-player="SkxERgnQM"
  data-embed="default"
  data-application-id
  class="video-js"
  controls
  width="640"
  height="360"></video-js>
<script src="https://players.brightcove.net/1507807800001/SkxERgnQM_default/index.min.js"></script>

<script type="text/javascript">
  videojs.getPlayer('myPlayerID').ready(function() {
    var myPlayer = this;

    videojs.log.level('debug');

    myPlayer.on('ended', function(){
      console.log('videojs.log.history(): ', videojs.log.history());
      console.log('videojs.log.level(): ', videojs.log.level());
      console.log('videojs.hls.stats: ', player.tech().hls.stats);
    });
  });
</script>

608 captions

Brightcove's HLS plugin has support for 608 captions. 608 captions, also known as CEA-608 captions, EIA-608 captions and Line 21 captions, are a standard for closed captioning for NTSC TV analog broadcasts in the United States and Canada. The 608 captions can be inserted into a live stream where they are mixed into the HLS' ts (transport stream) files.

Hosting issues

Unlike a native HLS implementation, the HLS plugin has to comply with the browser's security policies. That means that all the files that make up the stream must be served from the same domain as the page hosting the video player or from a server that has appropriate CORS headers configured. Easy instructions are available for popular webservers and most CDNs should have no trouble turning CORS on for your account.

Errors

Errors during HLS playback will be reported using the type APPEND_BUFFER_ERR. The message will be what is retrieved from the browser's native error. For instance, The quota has been exceeded.

Changelog

14 Nov 2018

v5.15.0

  • Added redirect support for manifest and media requests

21 Mar 2018

v5.14.1

  • Fixed the minified dist file
    • Updated webwackify to 0.1.6
    • Updated videojs-contrib-media-sources to 4.7.2

15 Mar 2018

v5.14.0

  • Updated videojs-contrib-media-sources to 4.7.1 and webwackify to 0.1.5
  • More useful info in segment-metadata cue (bandwidth/resolution/codecs/byte-length)

7 Mar 2018

v5.13.0

  • Use webwackify for webworkers to support webpack bundle
  • Fix tech.play() throwing unresolved promise errors on Chrome
  • update url-toolkit to version 2.1.3
  • Add jsDelivr link
  • Update karma reconnect configuration to match video.js
    • Increase karma's browserDisconnectTolerance to 3
  • Add nvmrc and update travis' chrome reference
    • Update karma-chrome-launcher to version 2.2.0
    • Update karma to version 1.7.1 and remove firefox from travis configuration
    • enable node_modules caching on travis
    • Update videojs-contrib-quality-levels to version 2.0.4
    • Fix test for event handler cleanup on dispose by calling event handling methods

6 Nov 2017

v5.12.2

  • Remove unused expected manifest JavaScript files
  • Remove extraneous methods from PlaylistLoader
    • Move isLowestEnabledRendition to Playlist module
  • Update contrib-media-sources to 4.6.2
    • Update mux.js to 4.3.2
      • Flush pes packets when there is enough data

24 Oct 2017

v5.12.1

  • Update contrib-media-sources to 4.6.1
    • Update mux.js to 4.3.1
      • Set active data channel per-field instead of globally for CEA-608
      • Fixed an issue with captions being placed in the wrong CC

19 Oct 2017

v5.12.0

  • Use lastSegmentDuration + 2 * targetDuration for safe live point instead of 3 segments
    • Do not let back buffer trimming remove within target duration of current time
    • Increase threshold for stuck playlist checking
  • Fix video corruption on rendition switches in IE11 Win 8.1+ and Edge
    • segment-time-mapping event
    • Update contrib-media-sources to 4.6.0
  • Prioritize user enabled playlists over blacklist
    • Never allow playlist selector to select a playlist that has been permanently blacklisted due to incompatible configuration
    • When filtering playlists within the playlist selectors, if there are no enabled playlists (i.e. not blacklisted internally AND not disabled by the user) available, then fall back to using the list of playlists not disabled by the user regardless of blacklist state.
    • Make sure playlists blacklisted from an illegal media switch is permanently blacklisted, as there is no reason to try it again at a later time.
    • The representation api will return a list that filters out just incompatible playlists instead of both incompatible playlists and temporary blacklisted playlists.

11 Oct 2017

v5.11.1

  • update videojs-contrib-media-sources to 4.5.3
    • update mux.js to 4.2.2
      • Use the first audio and video tracks in the PMT
  • fix InvalidStateError for live playback in IE11

20 Sep 2017

v5.11.0

  • Update videojs-contrib-media-sources to 4.5.2
    • Let video.js remoteTextTrack auto cleanup take care of text track cleanup
  • Blacklist incompatible playlists on probe if codec information not in master manifest
  • Seek to seekable start when seeking before the seekable window
  • MediaGroups: various bug fixes and refactor
    • Removes the Firefox 48 check for for supporting a change in audio info
    • Fix delayed switching between audio tracks and intermittent desync

28 Aug 2017

v5.10.1

  • Fixed: FLV metadata tags now appended when audio info changes

22 Aug 2017

v5.10.0

  • Implemented CEA608: support for cc2-cc4, special/extended characters, formatting
    • All four CC tracks are now available
    • If CLOSED-CAPTIONS are specified in the master manifest, the corresponding CC text tracks will be labled appropriately, otherwise will be labled CC1 - CC4
    • Underline and italics will now be rendered
    • Special thanks to @squarebracket

16 Aug 2017

v5.9.0

  • Added option to select lowest bitrate video rendition available on startup
  • Always activate loading in segment loaders after a seek
  • Wait for canplay event from tech before PlaybackWatcher begins monitoring
    • Fixed InvalidStateError in Win10 IE11
  • Blacklisted playlist for 2 minutes on early abort to prevent cache loop
    • Prevented rendition switch loop due to inconsistent network/caching
    • Don't fire bandwidthupdate when aborting early
  • Made sure text tracks added by HLS are properly disposed
  • Fixed Backward Seeking in IE11 Win8.1

7 Aug 2017

v5.8.3

  • Fixed double caption issue
  • Now attach attributes property to playlist objects in cases the m3u8-parser does not
    • Added warning log when missing attribute for stream-inf

12 Jul 2017

v5.8.2

  • Fixed processing of segments when mediaSource is closed

12 Jul 2017

v5.8.1

  • Fixed: Audio only playlists with videojs-contrib-media-sources v4.4.7

6 Jul 2017

v5.8.0

  • ABR Improvements
    • Use a starting bandwidth value of 0.0625 MB/s on Android devices
    • Do not allow an up-switch in quality until a certain amount of forward buffer has been filled, BUFFER_LOW_WATER_LINE
    • Dynamically increase the BUFFER_LOW_WATER_LINE and GOAL_BUFFER_LENGTH from 0 - > 30 and 30 -> 60 respectively during the first 30 seconds of playback
    • Abort segment requests before completion if bandwidth reported by the XHR progress event shows that network conditions are not fast enough to complete the request without causing rebuffering

27 Jun 2017

v5.7.0

  • Update mux.js to 4.1.5 and videojs-contrib-media-sources to 4.4.6
    • Only flush PES packets from TS parsing front end when they are complete
      • Complete is defined as any time PES_packet_length matches the data’s length OR is a video packets
      • Works around an issue with incomplete packets getting sent down the pipeline when the source has audio PES packets split between segments
  • Add HLS usage tracking events
    • Usage tracking events are fired when we detect a certain HLS feature, encoding setting, or API is used. Note that although these usage events are listed in the README, they may change at any time without a major version change.
  • Fix endOfStream for demuxed audio and video

20 Jun 2017

v5.6.0

  • Do not reset segmentloaders when switching media groups
    • Set loader state to ready on aborts even when loader is paused
  • Prevents crash when segment metadata cues can't be created
  • Allow overrideNative to be set as a player-level option
  • Create a moving-average playlist selector
    • Define a variant of the standard playlist selector that calculates a moving average of bandwidth and uses that to select a playlist.
  • Trigger bandwidthupdate events on the tech

16 May 2017

v5.5.3

  • Updated mux.js to 4.1.4 and videojs-contrib-media-sources to 4.4.5
    • ts probe searches packets for first it can successfully parse
    • Fixed an issue that could cause updateend events to fire more than once per append or remove under very specific conditions on Firefox
  • Trigger error events when received empty response

10 May 2017

v5.5.2

  • Fixed playback stalls when everything appears okay
    • Add playback watcher check for unknown player waiting
    • Do not do unknownwaiting check when the tech fires a native waiting event
    • Don't track current time waiting when at the end of the buffer
    • Call techWaiting_ when we detect a stall at the end of buffer

4 May 2017

v5.5.1

  • Use specified mediasequence for VOD expired sync instead of assuming 0
    1. Used synccontroller for expired
  • Fixed: CODEC to mime-type conversion now takes into account all possible scenarios

25 Apr 2017

v5.5.0

  • Update mux.js to 4.1.3 and media-sources to 4.4.4
  • Trigger an event when a playlist is blacklisted or retried
  • Triggers blacklistplaylist when a playlist is blacklisted
  • Triggers retryplaylist when retrying to load an errored playlist
  • Added option to modify blacklist duration

10 Apr 2017

v5.4.1

  • Updated contrib-media-sources to 4.4.3
  • Fixed: Exceptions from calling endOfStream when the media source isn't ready
  • Fixed: Segment time mapping for fmp4 playback
  • If beforeRequest is set, reuse it on source changes
    • Allow changing global xhr beforeRequest at runtime
    • Always use latest beforeRequest instead of setting it when creating hls object

3 Apr 2017

v5.4.0

  • Added support for in-manifest WebVTT
  • Fixed: Minor SegmentLoader Fixed: es
  • Fixed: Enable fast quality change for alternate audio
  • Added feature: Blacklist live playlists that have stopped being updated
    • Never blacklist final available final rendition
  • Refactored all the XHR handling code and related state out of SegmentLoader and into a single mediaSegmentRequest function
  • Added a segment-metadata TextTrack that contains cues for the segments currently in the buffer
  • Added support for description audio tracks in HLS
    • Added support for description audio tracks (marked with characteristics of public.accessibility.describes-video)
    • Added test for correctly setting alternative audio kinds

3 Mar 2017

v5.3.3

  • Updated videojs-contrib-media-sources to v4.4.2 and mux.js to 4.1.1
    • Fixed silence insertion to not insert extra frames when audio is offset
    • Fixed metadata cue mapping so that it considers group cues with the same startTime and remaps them collectively to the same endTime
    • Added fudge factor to Flash tag trim target
    • Feature Video.js 6 compatibilbity
    • Fixed Flash tag trimming for misaligned audio and video
    • Reverted "Revert flash transmuxing in a web worker"
  • Fixed do not timeout segment requests for non-master playlist source

22 Feb 2017

v5.3.2

  • Fixed a bug with the combination of seek-to-live and resync-on-a-poor-guess behaviors

22 Feb 2017

v5.3.1

  • Updated locking url-toolkit to 1.0.9 to support relative URLs
  • Resynced on poor initial segment choice
  • Fixed resuming live playback after long pauses

16 Feb 2017

v5.3.0

  • Reset segment loaders on all Flash seeks
    • Updated mux.js to 4.1.0
    • Updated videojs-contrib-media-sources to 4.4.0
  • Reorganized the functions in SegmentLoader to better follow the flow of execution from top-down
  • Removed ad-hoc logging in favor of a config-enabled logging like playback-watcher
  • isLowestEnabledRendition worked with redundant streams
  • Renamed Worker to DecrypterWorker

9 Feb 2017

v5.2.1

  • Support for Akamai-style Redundant HLS
    • Stable sorting and always pick primary first
  • Fixed routing of decrypter messages intended for audio segment loader

8 Feb 2017

v5.2.0

  • Updated dependencies for 4.3.0 mediasources
  • Removed HLS object events from README

3 Feb 2017

v5.1.1

  • Introduced Video.js 6 forward compatibility while maintaining backward compatibilty
    • Swap to use getTech and null-check Flash tech
    • Only registerComponent HLS in older Video.js
    • Use registerPlugin if it exists
    • addTrack cross compatibility
  • Added events for underflow and live resync
    • For QoS measurement purposes, it may be useful to know how often the playback watcher is activating. Add new events for when the player falls off the back of the live window or stalls due to a video buffer gap.

31 Jan 2017

v5.1.0

  • Updated videojs-contrib-media-sources to v4.2.0
    • Added support for inserting silence when appending a new segment will introduce a gap in the audio SourceBuffer
  • Remove hls-audio-track.js as this file was no longer being used
  • Stop blacklisting audio codecs as there is now wide support for switching between audio codecs on-the-fly among all modern browsers
  • Fix qualityLevels setup for videos with a source element
  • Error early for misconfigured overrideNative

25 Jan 2017

v5.0.0

  • Updated issue template to use unpkg for latest versions
  • Used a snapshot of the issue template JSBin to protect from changes by owner
  • Fixed any possible fillBuffer_ race conditions by debouncing all fillBuffers_
    • Converted all calls to fillBuffer_ to calls to monitorBuffer_
    • Renamed monitorBuffer_ to monitorBufferTick_ which becomes the 500ms buffer check timer loop
    • Made monitorBuffer_ schedule an immediate timer for monitorBufferTick_
  • Made it possible for processing segment reachable even after playlist update removes it
    • Changed processing segment reference on playlist refresh
    • Tested for correct segment references on pending segments
    • Fixed unreachable segment tests after rebase on async monitor buffer change
    • Updated media index on playlist refreshes for all requests (including syncs)
  • Made progress events bubble
    • If the segment request triggers progress events (that is, XHR2 is supported), bubble those up to the tech. This makes it clearer that buffering is happening even on very slow connections.
  • Running decryption in a webworker no longer supported for IE10
  • Fixed mediaIndex tracking so that it is consistent when the playlist updates during a live stream
    • Fixed mediaIndex tracking so that it is consistent when the playlist updates during a live stream
    • Removed any code in SegmentLoader#handleUpdateEnd_ that changed the mediaIndex
    • Reordered SegmentLoader#playlist to make it easier to follow
    • All changes to both mediaIndexes (SegmentLoader's and segmentInfo's) now happen in SegmentLoader#playlist
    • Added tests for proper mediaIndex tracking with live playlists

20 Jan 2017

v4.1.1

  • Fixed the m3u8-parser to support ES3

13 Jan 2017

v4.1.0

23 Dec 2016

v4.0.3

  • Fix a segment hop in live
  • Map legacy AVC codecs to their modern equivalents when excluding incompatible playlists
  • Update video.js to 5.15.1

29 Nov 2016

v4.0.2

  • Fixed excessive segment loads on seeks
    • Fixed a few cases where seeking caused the player to load too many segments

23 Nov 2016

v4.0.1

  • Reverted Upgrade aes-decrypter to use webcrypto for HLSe decryption where available
    • WebCrypto's subtle-crypto was failing to decrypt segments that worked previously with the JavaScript-only implementation

21 Nov 2016

v4.0.0

  • Simplified the algorithm at the heart of SegmentLoader as much as possible
  • Updated videojs-contrib-media-sources to 4.1.2
    • Started using remote TextTracks because they can be properly removed
    • Handled remove cues from track properly if cues is null
  • Updated mux.js to 3.0.3
    • Stopped applying the compositionTimestamp of the first frame to the baseMediaDecodeTime for the fragment
    • Fixed coalesce stream to account for missing audio data in pending tracks

17 Nov 2016

v3.6.13

  • Added the concept of systemBandwidth - a measure of the bandwidth (in mb/s) of the entire system from download through transmuxing and appending data to a flash or native media source
    • Adaptive bitrate selection is now based on the performance of the entire system

14 Nov 2016

v3.6.12

  • Changed resolveUrl to use JavaScript only

11 Nov 2016

v3.6.11

  • Updated the reloadSourceOnErrors plugin: Don't try to set the source if getSource returns undefined or null
  • resolve-url.js now uses an iframe to contain the base and anchor elements used to resolve relative urls

10 Nov 2016

v3.6.10

  • Updated the reloadSourceOnErrors plugin
    • Option to pass a getSource function that can be used to provide a new source to load on error
    • Added the ability to override the default minimum time between errors in seconds
    • Plugin now cleans up event bindings when initialized multiple times
  • Fixed trimBuffer to compare correct segments and correctly trim in the live case

9 Nov 2016

v3.6.9

  • Added a plugin that can be used to automatically reload a source if an error occurs
  • Fixed an error when checking if the lowest quality level is currently in use

9 Nov 2016

v3.6.8

  • Enhanced gap skipper to seek back into the live window if playback slips out of it; renamed GapSkipper to PlaybackWatcher

3 Nov 2016

v3.6.7

  • Updated videojs-contrib-media-sources to 4.0.5
    • Fixed an issue with ID3 and 608 cue translation

21 Oct 2016

v3.6.6

  • Use setTimeout in gap skipper instead of relying on timeupdate events
  • Updated videojs-contrib-media-sources to 4.0.4
    • Append init segment to video buffer for every segment

18 Oct 2016

v3.6.4

  • Fix 'ended' event not firing after replay
  • Updated videojs-contrib-media-sources to 4.0.2
    • Only trim FLV tags when seeking to prevent triming I frames
    • Updated Mux.js to 3.0.2
      • Set h264Frame to null after we finish the frame

18 Oct 2016

v3.6.3

  • Update videojs-contrib-media-sources to 4.0.1
    • Fix flash fallback

17 Oct 2016

v3.6.2

  • Update videojs-contrib-media-sources to 4.0.0
    • Append init segment data on audio track changes
    • Normalize ID3 behavior to follow Safari's implementation

14 Oct 2016

v3.6.1

  • Allow for initial bandwidth option of 0
  • Added support for MAAT in Firefox 49
  • Corrected deprecation warning for player.hls

27 Sep 2016

v3.6.0

  • Updated Mux.js to 2.5.0
    • Added support for generating version 1 TFDT boxes
    • Added TS inspector
  • Added bundle-collapser to create smaller dist files
  • Added fMP4 support
  • Fixed a bug that resulted in us loading the first segment on a live stream

24 Aug 2016

v3.5.3

  • Updated videojs-contrib-mediasources to 3.1.5
    • Updated Mux.js to 2.4.2
      • Fixed caption-packet sorting to be stable on Chromium

17 Aug 2016

v3.5.2

  • Changes to the underflow-detection in the gap-skipper to remove restrictions on the size of the gaps it is able to skip

16 Aug 2016

v3.5.1

  • Fixes an issue where playback can stall when going in/out of fullscreen

15 Aug 2016

v3.5.0

  • Updated support for #ext-x-cue-out, #ext-x-cue-in, and #ext-x-cue-out-cont to create a single cue spanning the range of time covered by the ad break
  • Updated to videojs-media-sources 3.1.4 to increase the values of the FlashConstants to push more data into flash per chunk-interval

29 Jul 2016

v3.4.0

  • Added support for #ext-x-cue-out, #ext-x-cue-in, and #ext-x-cue-out-cont via a special TextTrack
  • Added the ability to skip gaps caused by video underflow behavior in Chrome

25 Jul 2016

v3.3.0

  • No longer timeout segment requests if there is only one playlist left or if we are on the lowest rendition available
  • Fixed a bug where sometimes the first segment was not fetched when it should have been

15 Jul 2016

v3.2.0

  • Added an algorithm to seek over gaps in the video element's buffer when they are created because of missing video or audio frames
  • Moved the AES decryption logic to it's own project

9 Jun 2016

v3.1.0

  • Added manual rendition selection API via the representations() function on each instance of the HlsHandler class
  • Pulled out and moved m3u8 parsing functionality into it's own project at https://github.com/videojs/m3u8-parser

2 Jun 2016

v3.0.5

  • Fixed a bug where the adaptive bitrate selection algorithm would not switch to media playlists that had already been fetched from the server previously

31 May 2016

v3.0.4

  • Added support for multiple alternate audio tracks
  • New class SegmentLoader contains all buffer maintenence and segment fetching logic
  • New class SourceUpdater tracks the state of asynchronous operations on a SourceBuffer and queues operations for future execution if the SoureBuffer is busy
  • New class MasterPlaylistController now encapsulates operations on the master playlist and coordinates media playlists and segment loaders
  • Bug fixes related to fetching and buffer maintenance

11 Mar 2016

v2.0.1

  • First release of the ES6 version of the SourceHandler
  • All new lint/build/test setup via the generator-videojs-plugin project

4 Mar 2016

v1.13.1

  • Converted from a Tech to a SourceHandler for Video.js 5.x compatibility
  • Implemented a Media Source Extensions-based playback engine with a Flash-based fallback
  • Rewrote the Transmuxer and moved it into it's own project mux.js
  • Added support for 608/708 captions

29 Jul 2015

v0.17.6

  • autoplay at the live point. fix live id3 cue insertion. (view)

14 Jul 2015

v0.17.5

  • do not assume media sequence starts at zero (view)
  • fix error with audio- or video-only streams (view)

12 Jul 2015

v0.17.4

  • Fix seeks between segments. Improve duration calculation. (view)

29 Jun 2015

v0.17.3

  • Improved video duration calculation. (view)
  • Clamp seeks to the seekable range (view)
  • Use getComputedStyle for player dimensions when filtering variants (view)
  • Add a functional test that runs in SauceLabs (view)

15 Jun 2015

v0.17.2

  • Fix seeking in live streams (view)

8 Jun 2015

v0.17.1

  • Do not preload live videos (view)

5 Jun 2015

v0.17.0

  • Implement seekable for live streams. Fix in-band metadata timing for live streams. (view)

29 May 2015

v0.16.1

  • Do not unnecessarily reset to the live point when refreshing playlists. Clean up playlist loader timeouts. (view)
  • Ensure segments without an initial IDR are not displayed in 4:3 initially (view)
  • Wait for an SPS to inject metadata tags. (view)
  • Trim whitespace in playlist. (view)
  • Allow playback of TS files with NITs. Don't warn about PCR PIDs. (view)
  • Quicker quality switches when bandwidth changes. (view)
  • Fix temporary warped display after seeking. (view)

v0.16.0

  • support preload=none

v0.15.0

  • expose all ID3 frames and handle tags larger than 188 bytes

v0.14.0

  • performance improvements for HLSe

v0.13.0

  • Improved audio/video synchronization
  • Fixes for live, HLSe, and discontinuities
  • Rename internal methods to clarify their intended visibility

v0.12.0

  • support for custom IVs with AES-128 encryption

v0.11.0

  • embedded ID3 tags are exposed as an in-band metadata track

v0.10.0

  • optimistic initial bitrate selection

v0.9.0

  • support segment level AES-128 encryption

v0.8.0

  • support for EXT-X-DISCONTINUITY

v0.7.0

  • convert the HLS plugin to a tech

v0.6.0

  • Refactor playlist loading
  • Add testing via karma

v0.5.0

  • cookie-based content protection support (see withCredentials)

v0.4.0

  • Live stream support

v0.3.0

  • Performance fixes for high-bitrate streams

v0.2.0

  • Basic playback and adaptive bitrate selection

v0.1.0

  • Initial release