Skip to main content
Skip table of contents

Secure Session Management

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 and stream 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 it must be regularly renewed. When playback stops, the session is torn down (destroyed) to allow another session to be created. The CONNECT Player React Native SDK handles SSM with SSP, so all that player integration requires is setting some additional configuration data.

Errors

Errors are sent to the App through the same onError described in Error Handling. All SSM-related errors are under the SSM category.

Error Description

Unique Error Code

Notes

Setup Error6001An error occurred while the Player attempted to set up the session.
Teardown Error6002An error occurred while the Player attempted teardown the session.
Heartbeat Error6002An error occurred while the Player attempted to renew the session.

SSM Synchronization Mode

This is only applicable to Widevine DRM.

The Session Management message can either be performed Synchronously or Asynchronously. The mode can be affected by setting the ssmSyncMode to true or the default false respectively. When set to true, the plugin will always wait for responses to set up and teardown messaging with the SSM server; this can significantly affect channel zapping times.

Example Code

Click here to see a minimal implementation
JS
…
import OTVPlayer from '@nagra/react-otvplayer'
…
const App: () => Node = () => {
    …
    this.otvplayer = {
        ref: OTVPlayer
    };
  
    // This is effectively an autoplay for when the media has loaded
    this._onLoad = (data = {}) => {
        this.otvplayer.ref.play();
    };
  
    this.events = {
        onLoad: this._onLoad.bind(this)
    };
  
    this.encryptedStream = {
        src: "https://stream.com/fairplay.m3u8",
        token: "t0ken",
		type: "application/x-mpegURL",
        drm: {
            certificateUrl: "https://licenseservice.com/certificates",
            licenseURL: "https://licenseservice.com/licenses",
            ssmServerURL: "https://licenseservice.com/ssm",
            type: "Fairplay",
            ssmSyncMode: false
        }
    }
 
    return (
        <OTVPlayer ref={otvplayer => this.otvplayer.ref = otvplayer}
            source={this.encryptedStream}
            style={[styles.player.container]}
            autoplay={true}
        >
        </OTVPlayer>
    );
    …
}
…

For more information, see the OTVPlayer API documentation. The main difference between this example and the clear playback is the definition of the source object passed to the OTVPlayer element. For SSM content, the source alone is insufficient - it also requires the DRM type, token, licence URL, certificate URL (where specific DRM types require it), SSM server URL and optionally, the SSM Synchronization Mode flag.

Session Teardown

When the Stop API is invoked or when a new player source is set, any existing session is destroyed so another session can be created. The destruction of a current session is called Session Teardown.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.