Files
shaka-player/lib/offline/offline_utils.js
T
Joey Parrish b7af879583 Remove hasOutputRestrictions
If a key status is 'output-restricted', treat the key as unusable.
In many cases it is, and we have no way of differentiating when it is
or is not.  So our treatment of this status should be conservative,
and we should treat the key as unusable.  This will prevent
HDCP-related failures that may be caused by adapting to a stream whose
output restrictions may not be met.  The hasOutputRestrictions flag on
streams and tracks is now gone.

The caveat to this change is that if content is encoded with the same
key for SD and HD, and HD streams have HDCP restrictions that cannot
be met, we will now consider both the SD and HD streams to be
unplayable, even though we could still play the SD streams.  Because
we can't separate the status of the two streams, we don't know for
sure if the SD streams can be played.

We will no longer support such content due to the complexity of doing
so, and due to the risk of playback failures on adaptation to
restricted streams.  Streams with different security requirements
should always be encrypted with different keys.  Content which does
not follow this best practice will no longer be playable in Shaka
without modifying the player.

Change-Id: Ia29db8efa0b6f83c0376199dea5210c9b468bc40
2016-07-13 10:40:24 -07:00

56 lines
1.6 KiB
JavaScript

/**
* @license
* Copyright 2016 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.offline.OfflineUtils');
goog.require('goog.asserts');
/** @const {!Object.<string, string>} */
shaka.offline.OfflineUtils.DB_SCHEME = {'manifest': 'key', 'segment': 'key'};
/**
* Converts the given database manifest to a storedContent structure.
*
* @param {shakaExtern.ManifestDB} manifest
* @return {shakaExtern.StoredContent}
*/
shaka.offline.OfflineUtils.getStoredContent = function(manifest) {
goog.asserts.assert(manifest.periods.length > 0,
'Must be at least one Period.');
return {
offlineUri: 'offline:' + manifest.key,
originalManifestUri: manifest.originalManifestUri,
duration: manifest.duration,
size: manifest.size,
tracks: manifest.periods[0].streams.map(function(stream) {
return {
id: stream.id,
active: false,
type: stream.contentType,
bandwidth: 0,
language: stream.language,
kind: stream.kind || null,
width: stream.width,
height: stream.height
};
}),
appMetadata: manifest.appMetadata
};
};