Secure Session Management
To test this feature and view the example code, please see the Browsers SDK 1 Example Code Quick Start guide.
Secure Session Management (SSM) is used in conjunction with DRM to add further protection. A maximum number of concurrent sessions is associated with an account to prevent abuse by account sharing. SSM sets up a session on an SSM server each time a piece of content plays. A session expires after a short time, so must be regularly renewed. When playback stops, the session is torn down (destroyed) to allow another session to be created. The CONNECT Player SDK for Browsers handles SSM with SSP, so all that player integration requires is the setting of some additional configuration data.
Example code
Configuration of the player for SSP is described in the Browser SDK Integration Guide. To add SSM support, add thessmServer
member to the config object used to configure the player toolkit DRM.
{
system: "nagra-ssp",
config: {
mode: "token",
tenantId: myTenantId,
licenceServer: sspLicenceServerUrl,
ssmServer: ssmServerUrl
}
}
Session teardown
When a new player source is specified using playerInstance.src()
, any existing session is destroyed so another session can be created. The destruction of an existing session is called session teardown. A teardown can be initiated without selecting another source, by calling playerInstance.reset()
.
Teardown on navigate or browser close
When the user navigates away from the player page or closes down the browser, the current session is not torn down automatically. The asynchronous nature of the teardown message to the server means that automated teardown cannot be guaranteed to complete before the SDK is unloaded. We recommended that playback is stopped, and playerInstance.reset()
is called before navigating away from the page or closing the tab. The following code will display a warning dialog if the player has not been reset.
window.addEventListener("beforeunload", function(event) {
if (!isNaN(playerInstance.duration())) {
event.preventDefault();
event.returnValue = "";
return "";
}
});
If the user closes the browser tab or navigates away despite the warning, then one of the allowed sessions will remain in use until it expires.
SSM events
The application can register for SSM error events.
playerInstance.on("ssmsetuperror", function (err) {
console.log(err.type);
console.log(err.reason);
});
Error | Description |
---|---|
"ssmsetuperror" | The player encountered an error trying to set up a new session |
"ssmteardownerror" | The player encountered an error trying to tear down the current session |
"ssmheartbeaterror" | The player encountered an error trying to renew the current session (Playready or Fairplay DRM) |
"ssmrenewalerror" | The player encountered an error trying to renew the current session the current licence (Widevine DRM) |