Files
shaka-player/lib/media/i_abr_manager.js
T
Timothy Drews 5e84b9bd39 Fail gracefully when all tracks are restricted.
* Fire an error event when all audio/video tracks are restricted
  during playback.
* Fire an error event and fail gracefully when all audio/video tracks
  are restricted before playback (requires calling player.unload() when
  the VideoSource's attach promise gets rejected).
* Rework AbrManager so that getInitialVideoTrack() can be called before
  starting bandwidth monitoring.

Closes #170
Issue #179

Change-Id: I4ac6cdf2a4c862e0d0560dff2f2d7bb6801bbc38
2015-09-15 21:12:39 +00:00

87 lines
2.2 KiB
JavaScript

/**
* @license
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
goog.provide('shaka.media.IAbrManager');
/**
* An interface for a generic adaptive bitrate manager. An AbrManager listens
* for bandwidth events and makes decisions about which stream should be used at
* any given time. It can be queried for the initial stream to use when
* starting playback, and it will make active stream changes during playback
* (if enabled).
*
* @listens shaka.util.IBandwidthEstimator.BandwidthEvent
*
* @interface
*/
shaka.media.IAbrManager = function() {};
/**
* Destroy the AbrManager.
*
* @expose
*/
shaka.media.IAbrManager.prototype.destroy = function() {};
/**
* Initialize the AbrManager.
*
* This function will only be called by a VideoSource and should only be called
* once.
*
* @param {!shaka.util.IBandwidthEstimator} estimator
* @param {!shaka.player.IVideoSource} videoSource
* @expose
*/
shaka.media.IAbrManager.prototype.initialize = function(
estimator, videoSource) {};
/**
* Start processing stream switches.
*
* This function will only be called by a VideoSource and should only be called
* once.
*
* @expose
*/
shaka.media.IAbrManager.prototype.start = function() {};
/**
* Enable or disable the AbrManager. It is enabled by default when created.
*
* @param {boolean} enabled
* @expose
*/
shaka.media.IAbrManager.prototype.enable = function(enabled) {};
/**
* Decide on an initial video track to use. Called before playback begins.
*
* @return {?number} The chosen video track ID or null if there are no video
* tracks to choose.
* @expose
*/
shaka.media.IAbrManager.prototype.getInitialVideoTrackId = function() {};