Commit eb2738e7 authored by Greg Rutz's avatar Greg Rutz

Checkpoint update with fixes for persistent sessions

parent 4a01e74b
......@@ -135,14 +135,26 @@ app.controller('DashController', function($scope, Sources, Notes, Contributors,
controlbar.enable();
};
$scope.isPersistentSession = function(session) {
return session.sessionToken.getSessionType() !== "temporary";
};
$scope.getLoadedMessage = function(session) {
if (session.sessionToken.getSessionType() === "temporary")
if (session.sessionToken && !$scope.isPersistentSession(session))
return "Temporary (Not Persistent)";
return (session.isLoaded) ? "Loaded" : "Not Loaded";
};
$scope.isLoaded = function(session) {
return session.isLoaded || session.sessionToken.getSessionType() === "temporary";
return session.isLoaded;
};
$scope.isPersistent = function(session) {
return session.isPersistent;
};
$scope.isClosed = function(session) {
return session.closed;
};
$scope.arrayToCommaSeparated = function(ar) {
......@@ -187,12 +199,15 @@ app.controller('DashController', function($scope, Sources, Notes, Contributors,
if (persistedSession) {
persistedSession.isLoaded = true;
persistedSession.sessionToken = e.data;
persistedSession.closed = false;
} else {
var sessionToken = e.data;
data.sessions.push({
sessionToken: sessionToken,
sessionID: e.data.getSessionID(),
isLoaded: true
isPersistent: sessionToken.getSessionType() !== "temporary",
isLoaded: true,
closed: false
});
}
} else {
......@@ -205,7 +220,6 @@ app.controller('DashController', function($scope, Sources, Notes, Contributors,
var session = findSession(e.data);
if (session) {
session.isLoaded = false;
session.sessionToken = null;
}
} else {
data.error = e.error;
......@@ -216,7 +230,10 @@ app.controller('DashController', function($scope, Sources, Notes, Contributors,
if (!e.error) {
for (var i = 0; i < data.sessions.length; i++) {
if (data.sessions[i].sessionID === e.data) {
data.sessions.splice(i, 1);
data.sessions[i].closed = true;
if (!data.sessions[i].isPersistent) {
data.sessions.splice(i, 1);
}
break;
}
}
......
......@@ -202,24 +202,24 @@
<div class="errormessage" ng-show="d.error"><span class="label label-danger">ERROR</span><span class="errormessage">{{d.error}}</span></div>
<div class="panel panel-default sessionPanel" ng-repeat="s in d.sessions">
<div class="panel-heading panel-top">
<span class="panel-title">SessionID: {{s.sessionToken.getSessionID()}}</span>
<span class="panel-title">SessionID: {{s.sessionID}}</span>
<div class="btn-group">
<button type="button" ng-disabled="isLoaded(s)" class="btn btn-default" ng-click="d.protCtrl.loadKeySession(s.sessionID)">Load</button>
<button type="button" ng-disabled="!isLoaded(s)" class="btn btn-default" ng-click="d.protCtrl.removeKeySession(s.sessionToken)">Remove</button>
<button type="button" class="btn btn-default" ng-click="d.protCtrl.closeKeySession(s.sessionToken)">Close</button>
<button type="button" ng-disabled="isClosed(s)" class="btn btn-default" ng-click="d.protCtrl.closeKeySession(s.sessionToken)">Close</button>
</div>
</div>
<div class="keymessage" ng-show="s.lastMessage">{{s.lastMessage}}</div>
<div class="keymessage"><b>Session Persistence: </b><span>{{getLoadedMessage(s)}}</span></div>
<h5 ng-show="s.getExpirationTime()">Expiration: {{s.getExpirationTime()}}</h5>
<table ng-show="isLoaded(s) && s.keystatus && s.keystatus.length > 0" class="table table-bordered table-hover">
<h5 ng-show="s.sessionToken && s.sessionToken.getExpirationTime()">Expiration: {{s.sessionToken.getExpirationTime()}}</h5>
<table ng-show="(isLoaded(s) || isPersistent(s)) && s.keystatus && s.keystatus.length > 0" class="table table-bordered table-hover">
<tr>
<th>Key ID</th>
<th class="centered">Key Status</th>
</tr>
<tr ng-repeat="keystatus in s.keystatus">
<td class="keyid">{{keystatus.key}}</td>
<td ng-class="{true: 'success'}[keystatus.status=='usable']" class="centered">{{keystatus.status}}</td>
<td ng-class="{'usable':'success','released':'warning','expired':'danger'}[keystatus.status]" class="centered">{{keystatus.status}}</td>
</tr>
</table>
</div>
......
......@@ -617,7 +617,7 @@ MediaPlayer.dependencies.ProtectionController = function () {
* @fires MediaPlayer.dependencies.ProtectionController#KeySessionCreated
*/
loadKeySession: function(sessionID) {
this.protectionModel.loadKeySession(sessionID);
this.protectionModel.loadKeySession(sessionID, this.sessionType);
},
/**
......
......@@ -229,7 +229,7 @@ MediaPlayer.dependencies.ProtectionExtensions.prototype = {
// Our default server implementations do not do anything with "license-release" or
// "individualization-request" messages, so we just send a success event
if (messageType === "license-release" || messageType == "individualization-request") {
if (messageType == "individualization-request") {
return null;
}
......
......@@ -128,6 +128,9 @@ MediaPlayer.models.ProtectionModel = function() { };
* @name MediaPlayer.models.ProtectionModel#loadKeySession
* @param {string} sessionID the session ID corresponding to the persisted
* session data to be loaded
* @param {string} sessionType the desired session type. One of "temporary",
* "persistent-license", "persistent-release-message". CDM implementations
* are not required to support anything except "temporary"
*/
/**
......
......@@ -406,7 +406,7 @@ MediaPlayer.models.ProtectionModel_01b = function () {
setServerCertificate: function(/*serverCertificate*/) { /* Not supported */ },
loadKeySession: function(/*sessionID*/) { /* Not supported */ },
loadKeySession: function(/*sessionID, sessionType*/) { /* Not supported */ },
removeKeySession: function(/*sessionToken*/) { /* Not supported */ }
};
......
......@@ -332,12 +332,12 @@ MediaPlayer.models.ProtectionModel_21Jan2015 = function () {
});
},
loadKeySession: function(sessionID) {
loadKeySession: function(sessionID, sessionType) {
if (!this.keySystem || !mediaKeys) {
throw new Error("Can not load sessions until you have selected a key system");
}
var session = mediaKeys.createSession();
var session = mediaKeys.createSession(sessionType);
// Load persisted session data into our newly created session object
var self = this;
......
......@@ -349,7 +349,7 @@ MediaPlayer.models.ProtectionModel_3Feb2014 = function () {
setServerCertificate: function(/*serverCertificate*/) { /* Not supported */ },
loadKeySession: function(/*sessionID*/) { /* Not supported */ },
loadKeySession: function(/*sessionID, sessionType*/) { /* Not supported */ },
removeKeySession: function(/*sessionToken*/) { /* Not supported */ }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment