Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shaka-player

Package Overview
Dependencies
Maintainers
2
Versions
344
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shaka-player - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

spec/duration_segment_index_source_spec.js

5

app.js

@@ -647,2 +647,7 @@ /**

app.loadStream = function() {
// Set the cross-origin flag to anonymous to allow loading subtitle tracks
// cross-origin, as in the Angel One clip.
// TODO: Remove this when subtitles no longer use the track element.
app.video_.crossOrigin = 'anonymous';
var type = document.getElementById('streamTypeList').value;

@@ -649,0 +654,0 @@ if (type == 'http') {

@@ -0,1 +1,21 @@

## 1.5.1 (2015-10-07)
A roll-up of recent bugfixes.
Bugfixes:
- Fixed a major memory leak introduced in 1.5.0.
- https://github.com/google/shaka-player/issues/184
- Deleting encrypted offline content now deletes persistent sessions.
- https://github.com/google/shaka-player/issues/171
- Static content using SegmentTemplate is now truncated at the Period's
duration.
- https://github.com/google/shaka-player/issues/187
- https://github.com/google/shaka-player/issues/173
- Key status error reporting is now more consistent and provides more
information.
- Reduced flakiness in some tests.
- Requests used for clock sync no longer allow caching.
- https://github.com/google/shaka-player/issues/191
## 1.5.0 (2015-09-17)

@@ -2,0 +22,0 @@

44

lib/dash/duration_segment_index_source.js

@@ -107,9 +107,4 @@ /**

shaka.asserts.assert(this.mpd_.type == 'static');
var segmentTemplate = this.representation_.segmentTemplate;
var scaledSegmentDuration =
segmentTemplate.segmentDuration / segmentTemplate.timescale;
var numSegments = Math.ceil(this.period_.duration / scaledSegmentDuration);
var references = shaka.dash.MpdUtils.generateSegmentReferences(
this.networkCallback_, this.representation_, 1, numSegments);
if (!references) {
this.segmentIndex_ = this.createStaticSegmentIndex_();
if (!this.segmentIndex_) {
var error = new Error('Failed to generate SegmentReferences');

@@ -119,3 +114,2 @@ error.type = 'stream';

}
this.segmentIndex_ = new shaka.media.SegmentIndex(references);
}

@@ -126,1 +120,35 @@

/**
* Creates a static SegmentIndex.
*
* @return {shaka.media.SegmentIndex}
* @private
*/
shaka.dash.DurationSegmentIndexSource.prototype.createStaticSegmentIndex_ =
function() {
var segmentTemplate = this.representation_.segmentTemplate;
var scaledSegmentDuration =
segmentTemplate.segmentDuration / segmentTemplate.timescale;
var numSegments = Math.ceil(this.period_.duration / scaledSegmentDuration);
var references = shaka.dash.MpdUtils.generateSegmentReferences(
this.networkCallback_, this.representation_, 1, numSegments);
if (!references) {
return null;
}
// Ensure the last SegmentReference's end time does not surpass the Period's
// duration.
if (references.length > 0) {
var r = references[references.length - 1];
shaka.asserts.assert(r.startTime <= this.period_.duration);
shaka.asserts.assert(r.endTime >= this.period_.duration);
references[references.length - 1] =
r.adjust(r.startTime, this.period_.duration);
}
return new shaka.media.SegmentIndex(references);
};

2

lib/dash/mpd_request.js

@@ -74,3 +74,3 @@ /**

var error = new Error('MPD parse failure.');
error.type = 'mpd';
error.type = 'dash';
return Promise.reject(error);

@@ -77,0 +77,0 @@ }

@@ -128,2 +128,7 @@ /**

if (this.allSessionsReadyTimer_) {
window.clearTimeout(this.allSessionsReadyTimer_);
this.allSessionsReadyTimer_ = null;
}
this.videoSource_ = null; // not owned by us, do not destroy

@@ -193,2 +198,15 @@ this.video_ = null;

/**
* Deletes all sessions from persistent storage.
*
* @return {!Promise}
*/
shaka.media.EmeManager.prototype.deleteSessions = function() {
return Promise.all(this.sessions_.map(function(a) {
shaka.log.debug('Removing session', a);
return a.remove();
}));
};
/**
* Choose unencrypted streams for each type if possible. Store chosen streams

@@ -570,3 +588,12 @@ * into chosenStreams.

p.catch(shaka.util.TypedBind(this,
p.then(shaka.util.TypedBind(this,
function(arg) {
// Assume that the load does not require a message. This allows
// offline sessions to use allSessionsReady.
this.numUpdates_++;
if (this.numUpdates_ >= this.sessions_.length) {
this.allSessionsPresumedReady_.resolve();
}
})
).catch(shaka.util.TypedBind(this,
/** @param {*} error */

@@ -573,0 +600,0 @@ function(error) {

@@ -44,3 +44,4 @@ /**

* 'open' state.
* @param {string} fullMimeType The SourceBuffer's full MIME type.
* @param {string} fullMimeType The full MIME type of the SourceBuffer to
* create, which |mediaSource| must support.
* @param {!shaka.util.IBandwidthEstimator} estimator A bandwidth estimator to

@@ -47,0 +48,0 @@ * attach to all requests.

@@ -51,3 +51,4 @@ /**

* 'open' state.
* @param {string} fullMimeType The SourceBuffer's full MIME type.
* @param {string} fullMimeType The full MIME type of the SourceBuffer to
* create, which |mediaSource| must support.
* @param {!shaka.util.IBandwidthEstimator} estimator A bandwidth estimator to

@@ -293,5 +294,12 @@ * attach to all segment requests.

/**
* Starts presenting the specified stream asynchronously. The stream's type
* must be equivalent to the Stream's underlying SourceBuffer's type.
* <p>
* Starts presenting the specified stream asynchronously. The stream's MIME
* type must be compatible with the Stream's underlying SourceBuffer, i.e., the
* stream must have the same content type, container, and codec as the
* SourceBuffer, but the stream's codec's profile may vary.
* </p>
*
* <p>
* Note: |opt_clearBufferOffset| is relative to the video's playhead.
* </p>
*

@@ -524,4 +532,4 @@ * @override

// During startup the playhead's position will not align with the initial
// buffered range's start if there exists a timestamp correction because we
// During startup, if there's a non-zero timestamp correction then the
// playhead will not align with the start of the first buffered range, as we
// do not apply the timestamp correction to the SegmentIndexes until after

@@ -528,0 +536,0 @@ // stream startup. So, we must call bufferedAheadOf() with an offset to

@@ -186,3 +186,3 @@ /**

var error = new Error('Live manifest support not enabled.');
error.type = 'stream';
error.type = 'app';
return Promise.reject(error);

@@ -189,0 +189,0 @@ }

@@ -28,2 +28,3 @@ /**

goog.require('shaka.util.MapUtils');
goog.require('shaka.util.StringUtils');

@@ -215,4 +216,7 @@

if (message) {
var error = new Error('Key' + keyId + 'is not usable. ' + message);
var prettyKeyId = shaka.util.StringUtils.formatHexString(keyId);
var error = new Error(
'Key ' + prettyKeyId + ' is not usable. ' + message);
error.type = 'drm';
error.code = keyStatus;
var event = shaka.util.FakeEvent.createErrorEvent(error);

@@ -219,0 +223,0 @@ this.dispatchEvent(event);

@@ -86,2 +86,5 @@ /**

this.networkCallback_ = null;
/** @private {shaka.player.DrmInfo.Config} */
this.overrideConfig_ = null;
};

@@ -185,2 +188,3 @@ goog.inherits(shaka.player.OfflineVideoSource, shaka.player.StreamVideoSource);

var emeManager;
var error = null;

@@ -206,2 +210,3 @@ /** @type {!Object.<number, !shaka.media.StreamInfo>} */

var error = new Error('Unable to store live streams offline.');
error.type = 'app';
return Promise.reject(error);

@@ -228,2 +233,5 @@ }

emeManager, 'sessionReady', this.onSessionReady_.bind(this));
this.eventManager.listen(emeManager, 'error', function(e) {
error = e;
});
return emeManager.initialize();

@@ -290,2 +298,6 @@ })

function() {
if (error) {
return Promise.reject(error);
}
var drmInfo = emeManager.getDrmInfo();

@@ -301,2 +313,13 @@ // TODO(story 1890046): Support multiple periods.

})
).then(shaka.util.TypedBind(this,
/** @param {number} i */
function(i) {
this.groupId_ = i;
if (error) {
this.deleteGroupContent_();
return Promise.reject(error);
}
return Promise.resolve(i);
})
);

@@ -418,3 +441,3 @@ };

var contentDatabase = new shaka.util.ContentDatabaseReader();
var duration, keySystem;
var duration, config;

@@ -432,3 +455,11 @@ return contentDatabase.setUpDatabase().then(shaka.util.TypedBind(this,

duration = group['duration'];
keySystem = group['key_system'];
config = {
'keySystem': group['key_system'],
'distinctiveIdentifierRequired': group['distinctive_identifier'],
'persistentStorageRequired': true,
'audioRobustness': group['audio_robustness'],
'videoRobustness': group['video_robustness'],
'withCredentials': group['with_credentials'],
'licenseServerUrl': group['license_server']
};
for (var i = 0; i < group['stream_ids'].length; ++i) {

@@ -444,3 +475,3 @@ var streamId = group['stream_ids'][i];

this.manifestInfo =
this.reconstructManifestInfo_(indexes, duration, keySystem);
this.reconstructManifestInfo_(indexes, duration, config);

@@ -470,3 +501,4 @@ var baseClassLoad = shaka.player.StreamVideoSource.prototype.load;

* @param {number} duration The max stream's entire duration in the group.
* @param {string} keySystem The group's DRM key system.
* @param {shaka.player.DrmInfo.Config} config The config info loaded from
* storage.
* @return {!shaka.media.ManifestInfo}

@@ -476,3 +508,3 @@ * @private

shaka.player.OfflineVideoSource.prototype.reconstructManifestInfo_ =
function(indexes, duration, keySystem) {
function(indexes, duration, config) {
var manifestInfo = new shaka.media.ManifestInfo();

@@ -507,4 +539,17 @@ manifestInfo.minBufferTime = 5;

var drmInfo = shaka.player.DrmInfo.createFromConfig(
{'keySystem': keySystem, 'licenseServerUrl': ''});
if (this.overrideConfig_) {
if (this.overrideConfig_['licenseServerUrl'] != null) {
config['licenseServerUrl'] = this.overrideConfig_['licenseServerUrl'];
}
if (this.overrideConfig_['withCredentials'] != null) {
config['withCredentials'] = this.overrideConfig_['withCredentials'];
}
config['licensePostProcessor'] =
this.overrideConfig_['licensePostProcessor'];
config['licensePreProcessor'] =
this.overrideConfig_['licensePreProcessor'];
config['serverCertificate'] = this.overrideConfig_['serverCertificate'];
}
var drmInfo = shaka.player.DrmInfo.createFromConfig(config);
var streamSetInfo = new shaka.media.StreamSetInfo();

@@ -523,8 +568,61 @@ streamSetInfo.streamInfos.push(streamInfo);

/**
* Deletes a group of streams from storage.
* @return {!Promise}
* Deletes a group of streams from storage. This destroys the VideoSource.
*
* @param {shaka.player.DrmInfo.Config=} opt_config Optional config to override
* the values stored. Can only change |licenseServerUrl|, |withCredentials|,
* |serverCertificate|, |licensePreProcessor|, and |licensePostProcessor|.
* @param {boolean=} opt_forceDelete True to delete the content even if there
* is an error when deleting the persistent session. The error is returned.
* @return {!Promise.<Error>}
* @export
*/
shaka.player.OfflineVideoSource.prototype.deleteGroup = function() {
shaka.player.OfflineVideoSource.prototype.deleteGroup =
function(opt_config, opt_forceDelete) {
shaka.asserts.assert(this.groupId_ >= 0);
if (opt_config) {
this.overrideConfig_ = {
'licenseServerUrl': opt_config['licenseServerUrl'],
'withCredentials': opt_config['withCredentials'],
'serverCertificate': opt_config['serverCertificate'],
'licensePreProcessor': opt_config['licensePreProcessor'],
'licensePostProcessor': opt_config['licensePostProcessor']
};
}
var error = null;
return this.deletePersistentSessions_().catch(function(e) {
if (opt_forceDelete) {
error = e;
return Promise.resolve();
}
return Promise.reject(e);
}).then(shaka.util.TypedBind(this, function() {
return this.deleteGroupContent_();
})).then(function() {
return Promise.resolve(error);
});
};
/** @override */
shaka.player.OfflineVideoSource.prototype.getSessionIds = function() {
return this.sessionIds_;
};
/** @override */
shaka.player.OfflineVideoSource.prototype.isOffline = function() {
return true;
};
/**
* Deletes the offline content from the database for the given |group|.
*
* @return {!Promise}
* @private
*/
shaka.player.OfflineVideoSource.prototype.deleteGroupContent_ = function() {
var contentDatabase = new shaka.util.ContentDatabaseWriter(null, null);

@@ -535,3 +633,3 @@

return contentDatabase.deleteGroup(
/** @type {number} */(this.groupId_));
/** @type {number} */ (this.groupId_));
})

@@ -552,11 +650,41 @@ ).then(

/** @override */
shaka.player.OfflineVideoSource.prototype.getSessionIds = function() {
return this.sessionIds_;
};
/**
* Deletes any persistent sessions associated with the |groupId_|.
*
* @return {!Promise}
* @private
*/
shaka.player.OfflineVideoSource.prototype.deletePersistentSessions_ =
function() {
var fakeVideoElement = /** @type {!HTMLVideoElement} */ (
document.createElement('video'));
fakeVideoElement.src = window.URL.createObjectURL(this.mediaSource);
var emeManager = new shaka.media.EmeManager(null, fakeVideoElement, this);
if (this.config_['licenseRequestTimeout'] != null) {
emeManager.setLicenseRequestTimeout(
Number(this.config_['licenseRequestTimeout']));
}
/** @override */
shaka.player.OfflineVideoSource.prototype.isOffline = function() {
return true;
return this.load().then(function() {
return emeManager.initialize();
}).then(shaka.util.TypedBind(this, function() {
return emeManager.allSessionsReady(this.timeoutMs);
})).then(function() {
return emeManager.deleteSessions();
}).then(shaka.util.TypedBind(this,
function() {
emeManager.destroy();
this.destroy();
return Promise.resolve();
})
).catch(shaka.util.TypedBind(this,
/** @param {*} e */
function(e) {
emeManager.destroy();
this.destroy();
return Promise.reject(e);
})
);
};

@@ -135,3 +135,3 @@ /**

*/
goog.define('GIT_VERSION', 'v1.5.0-debug');
goog.define('GIT_VERSION', 'v1.5.1-debug');

@@ -138,0 +138,0 @@

@@ -241,3 +241,4 @@ /**

var url = this.url;
if (this.estimator && !this.estimator.supportsCaching()) {
if ((this.estimator && !this.estimator.supportsCaching()) ||
this.parameters.synchronizeClock) {
// We cannot detect that a response was cached after the fact, so add a

@@ -244,0 +245,0 @@ // cache-busting parameter to the request to avoid caching. There are

@@ -85,2 +85,8 @@ /**

groupInfo['key_system'] = index['key_system'];
groupInfo['license_server'] = index['license_server'];
groupInfo['with_credentials'] = index['with_credentials'];
groupInfo['distinctive_identifier'] =
index['distinctive_identifier'];
groupInfo['audio_robustness'] = index['audio_robustness'];
groupInfo['video_robustness'] = index['video_robustness'];
return Promise.resolve(groupInfo);

@@ -87,0 +93,0 @@ });

@@ -184,3 +184,8 @@ /**

'duration': duration,
'key_system': drmInfo.keySystem
'key_system': drmInfo.keySystem,
'license_server': drmInfo.licenseServerUrl,
'with_credentials': drmInfo.withCredentials,
'distinctive_identifier': drmInfo.distinctiveIdentifierRequired,
'audio_robustness': drmInfo.audioRobustness,
'video_robustness': drmInfo.videoRobustness
};

@@ -187,0 +192,0 @@ var request = this.getGroupStore().put(groupInfo);

@@ -103,3 +103,8 @@ /**

* duration: ?number,
* key_system: string
* key_system: string,
* license_server: string,
* with_credentials: boolean,
* distinctive_identifier: boolean,
* audio_robustness: string,
* video_robustness: string
* }}

@@ -159,2 +164,3 @@ */

var error = new Error('Persistant storage requires IndexedDB support.');
error.type = 'storage';
return Promise.reject(error);

@@ -165,2 +171,3 @@ }

var error = new Error('A database connection is already open.');
error.type = 'storage';
return Promise.reject(error);

@@ -167,0 +174,0 @@ }

@@ -100,3 +100,3 @@ /**

if (this.requestPromise_) {
// A fetch has already completed or is in progress.
// A fetch is already in progress.
return this.requestPromise_;

@@ -157,2 +157,5 @@ }

function(xhr) {
// |requestPromise_| MUST be set to null; otherwise, we will
// effectively cache every response.
this.requestPromise_ = null;
this.request_ = null;

@@ -159,0 +162,0 @@ return Promise.resolve(xhr.response);

{
"name": "shaka-player",
"description": "DASH/EME video player library",
"version": "1.5.0",
"version": "1.5.1",
"homepage": "https://github.com/google/shaka-player",

@@ -6,0 +6,0 @@ "author": "Google",

@@ -882,2 +882,5 @@ /**

player.load(newSource(languagesManifest)).then(function() {
video.play();
return waitForMovement(video, eventManager);
}).then(function() {
var activeAudioTrack = getActiveAudioTrack();

@@ -894,2 +897,5 @@ expect(activeAudioTrack.lang).toBe('en');

}).then(function() {
video.play();
return waitForMovement(video, eventManager);
}).then(function() {
var activeAudioTrack = getActiveAudioTrack();

@@ -913,2 +919,5 @@ expect(activeAudioTrack.lang).toBe('fr');

player.load(newSource(languagesManifest)).then(function() {
video.play();
return waitForMovement(video, eventManager);
}).then(function() {
var activeAudioTrack = getActiveAudioTrack();

@@ -930,2 +939,5 @@ expect(activeAudioTrack.lang).toBe('en');

player.load(newSource(languagesManifest)).then(function() {
video.play();
return waitForMovement(video, eventManager);
}).then(function() {
var activeAudioTrack = getActiveAudioTrack();

@@ -951,2 +963,5 @@ expect(activeAudioTrack.lang).toBe('fr');

player.load(newSource(languagesManifest)).then(function() {
video.play();
return waitForMovement(video, eventManager);
}).then(function() {
var activeAudioTrack = getActiveAudioTrack();

@@ -953,0 +968,0 @@ expect(activeAudioTrack.lang).toBe('en');

@@ -39,3 +39,3 @@ // This file was autogenerated by third_party/closure/deps/depswriter.py.

goog.addDependency('../../../lib/player/drm_scheme_info.js', ['shaka.player.DrmSchemeInfo'], ['shaka.asserts', 'shaka.player.DrmInfo', 'shaka.util.ArrayUtils', 'shaka.util.Uint8ArrayUtils']);
goog.addDependency('../../../lib/player/http_video_source.js', ['shaka.player.HttpVideoSource'], ['shaka.features', 'shaka.media.StreamConfig', 'shaka.player.DrmInfo', 'shaka.player.IVideoSource', 'shaka.util.EmeUtils', 'shaka.util.FakeEvent', 'shaka.util.FakeEventTarget', 'shaka.util.MapUtils']);
goog.addDependency('../../../lib/player/http_video_source.js', ['shaka.player.HttpVideoSource'], ['shaka.features', 'shaka.media.StreamConfig', 'shaka.player.DrmInfo', 'shaka.player.IVideoSource', 'shaka.util.EmeUtils', 'shaka.util.FakeEvent', 'shaka.util.FakeEventTarget', 'shaka.util.MapUtils', 'shaka.util.StringUtils']);
goog.addDependency('../../../lib/player/i_video_source.js', ['shaka.player.IVideoSource'], ['shaka.media.StreamConfig', 'shaka.player.AudioTrack', 'shaka.player.Player', 'shaka.player.TextTrack', 'shaka.player.VideoTrack', 'shaka.util.MultiMap']);

@@ -46,3 +46,3 @@ goog.addDependency('../../../lib/player/offline_video_source.js', ['shaka.player.OfflineVideoSource'], ['goog.Uri', 'shaka.asserts', 'shaka.dash.MpdProcessor', 'shaka.dash.MpdRequest', 'shaka.dash.mpd', 'shaka.features', 'shaka.log', 'shaka.media.EmeManager', 'shaka.media.IAbrManager', 'shaka.media.OfflineSegmentIndexSource', 'shaka.media.SegmentIndex', 'shaka.media.SimpleAbrManager', 'shaka.media.StreamInfo', 'shaka.player.StreamVideoSource', 'shaka.util.ContentDatabaseReader', 'shaka.util.ContentDatabaseWriter', 'shaka.util.FailoverUri', 'shaka.util.IBandwidthEstimator', 'shaka.util.TypedBind', 'shaka.util.Uint8ArrayUtils']);

goog.addDependency('../../../lib/player/stats.js', ['shaka.player.Stats'], ['shaka.asserts', 'shaka.media.StreamInfo', 'shaka.util.Clock']);
goog.addDependency('../../../lib/player/stream_video_source.js', ['shaka.player.StreamVideoSource'], ['shaka.asserts', 'shaka.features', 'shaka.log', 'shaka.media.IAbrManager', 'shaka.media.IStream', 'shaka.media.ManifestInfo', 'shaka.media.ManifestUpdater', 'shaka.media.PeriodInfo', 'shaka.media.SimpleAbrManager', 'shaka.media.Stream', 'shaka.media.StreamInfo', 'shaka.media.StreamInfoProcessor', 'shaka.media.StreamSetInfo', 'shaka.media.TextStream', 'shaka.player.AudioTrack', 'shaka.player.Defaults', 'shaka.player.IVideoSource', 'shaka.player.Restrictions', 'shaka.player.VideoTrack', 'shaka.util.EmeUtils', 'shaka.util.EventManager', 'shaka.util.FakeEventTarget', 'shaka.util.IBandwidthEstimator', 'shaka.util.LanguageUtils', 'shaka.util.MapUtils', 'shaka.util.PublicPromise']);
goog.addDependency('../../../lib/player/stream_video_source.js', ['shaka.player.StreamVideoSource'], ['shaka.asserts', 'shaka.features', 'shaka.log', 'shaka.media.IAbrManager', 'shaka.media.IStream', 'shaka.media.ManifestInfo', 'shaka.media.ManifestUpdater', 'shaka.media.PeriodInfo', 'shaka.media.SimpleAbrManager', 'shaka.media.Stream', 'shaka.media.StreamInfo', 'shaka.media.StreamInfoProcessor', 'shaka.media.StreamSetInfo', 'shaka.media.TextStream', 'shaka.player.AudioTrack', 'shaka.player.Defaults', 'shaka.player.IVideoSource', 'shaka.player.Restrictions', 'shaka.player.VideoTrack', 'shaka.util.EmeUtils', 'shaka.util.EventManager', 'shaka.util.FakeEventTarget', 'shaka.util.IBandwidthEstimator', 'shaka.util.LanguageUtils', 'shaka.util.MapUtils', 'shaka.util.PublicPromise', 'shaka.util.StringUtils']);
goog.addDependency('../../../lib/player/text_style.js', ['shaka.player.TextStyle'], ['shaka.asserts', 'shaka.log']);

@@ -49,0 +49,0 @@ goog.addDependency('../../../lib/player/text_track.js', ['shaka.player.TextTrack'], []);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc