Skip to content

Commit

Permalink
Resolve styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gigon committed Oct 23, 2018
1 parent 47f615b commit 0e4cd55
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 33 deletions.
32 changes: 16 additions & 16 deletions demo/offline_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,25 +212,25 @@ shakaDemo.storeDeleteAsset_ = function() {
}

p = configureCertificate.then(function() {
let nameField = document.getElementById('offlineName').value;
let assetName = asset.name ? '[OFFLINE] ' + asset.name : null;
let metadata = {name: assetName || nameField || asset.manifestUri};
return storage.store(asset.manifestUri, metadata).then(function() {
if (option.asset) {
option.isStored = true;
}
return shakaDemo.refreshAssetList_().then(function() {
// Auto-select offline copy of asset after storing.
let group = shakaDemo.offlineOptGroup_;
for (let i = 0; i < group.childNodes.length; i++) {
let option = group.childNodes[i];
if (option.textContent == assetName) {
assetList.selectedIndex = option.index;
}
let nameField = document.getElementById('offlineName').value;
let assetName = asset.name ? '[OFFLINE] ' + asset.name : null;
let metadata = {name: assetName || nameField || asset.manifestUri};
return storage.store(asset.manifestUri, metadata).then(function() {
if (option.asset) {
option.isStored = true;
}
return shakaDemo.refreshAssetList_().then(function() {
// Auto-select offline copy of asset after storing.
let group = shakaDemo.offlineOptGroup_;
for (let i = 0; i < group.childNodes.length; i++) {
let option = group.childNodes[i];
if (option.textContent == assetName) {
assetList.selectedIndex = option.index;
}
}
});
});
});
});
}

p.catch(function(reason) {
Expand Down
27 changes: 12 additions & 15 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,36 +463,33 @@ shaka.media.DrmEngine.prototype.attach = function(video) {


/**
* Create a promise that will be resolved after the server certificate
* will be set.
* Sets the server certificate based on the current DrmInfo.
*
* @return {!Promise|null}
* @return {!Promise}
*/
shaka.media.DrmEngine.prototype.setServerCertificate = function() {
shaka.media.DrmEngine.prototype.setServerCertificate = async function() {
goog.asserts.assert(this.initialized_,
'Must call init() before setServerCertificate');

let setServerCertificate = null;
if (this.mediaKeys_ &&
this.currentDrmInfo_ &&
this.currentDrmInfo_.serverCertificate &&
this.currentDrmInfo_.serverCertificate.length) {
setServerCertificate = this.mediaKeys_.setServerCertificate(
this.currentDrmInfo_.serverCertificate).then(function(supported) {
try {
const supported = await this.mediaKeys_.setServerCertificate(
this.currentDrmInfo_.serverCertificate);
if (!supported) {
shaka.log.warning('Server certificates are not supported by the key' +
' system. The server certificate has been ignored.');
}
}).catch(function(exception) {
} catch (exception) {
return Promise.reject(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.DRM,
shaka.util.Error.Code.INVALID_SERVER_CERTIFICATE,
exception.message));
});
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.DRM,
shaka.util.Error.Code.INVALID_SERVER_CERTIFICATE,
exception.message));
}
}

return setServerCertificate;
};


Expand Down
2 changes: 1 addition & 1 deletion lib/offline/session_deleter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ shaka.offline.SessionDeleter = class {
}

try {
drmEngine.setServerCertificate();
await drmEngine.setServerCertificate();
} catch (e) {
shaka.log.warning('Error setting server certificate', e);
await drmEngine.destroy();
Expand Down
2 changes: 1 addition & 1 deletion lib/offline/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ shaka.offline.Storage.prototype.createDrmEngine = async function(
const config = this.config_;
drmEngine.configure(config.drm);
await drmEngine.initForStorage(variants, config.offline.usePersistentLicense);
drmEngine.setServerCertificate();
await drmEngine.setServerCertificate();
await drmEngine.createOrLoad();

return drmEngine;
Expand Down

0 comments on commit 0e4cd55

Please sign in to comment.