Skip to main content
Skip table of contents

OTT session management

Important note:  From ML2.8 onwards OTT session management is provided by the OTT SRM module. Information concerning session management provided by SDP for earlier releases can be found at the bottom of this page.

Summary

OpenTV Platform provides OTT session management to limit the number of concurrent streams and control the amount of bandwidth consumed by client apps. Account profiles can include a maximum number of concurrent OTT streams. The client apps will attempt to set-up a session for each new play-back session and SRM will enforce this limitation, delegating the final check to SDP. In addition, SRM offers an API for the operator to retrieve the existing sessions of a given customer account and tear-down an existing session at any point in time.

The following diagram illustrates the simplified logical flow of the client application for the nominal use case

SRM API methods

SRM API endpoint URLs are proposed in two forms, with or without a version identifier. If the version identifier is not present the latest version of the API available on the SRM instance will be used. The form with version identifier is suggested to ensure backward compatibility in the case of possible future major evolution of the API.

Session Setup

This API should be used to set up a new OTT session for a client device, before playback really begins.

When used, the SRM will verify that the device and associated account are enabled and that they have access to the content requested (via a PAV interface); if so creating a session and returning the details for this.

After a session has been successfully set up the device may begin playing the content.

In order to determine if a setup request is completely successful, the client application must examine the payload of the response and ensure it contains a successResponse item (see below). It cannot rely on just the HTTP response code, as SRM returns HTTP 200 codes for denials of session creation for business reasons, like session limit reached or content access denied.

To use this API, send a HTTP POST request to either of the URLs below:

Using latest version:

CODE
http://<host>:<port>/srm/sessions

Using v1:

CODE
http://<host>:<port>/srm/v1/sessions

HTTP Headers

Name

Type

Description

Required

Client-TokenString

Authentication token gained from a positive sign on response

See Authentication for details on obtaining a token.

Yes

Request Body


Name
Type
Description
Required
contentContent JSON object (see below)Identifier for the content for which playback is being requested.Yes

Content JSON Object

The Content object must contain the following fields.

Name
Type
Description
Required
contentIDString

Identifies the content being consumed:

  • For VOD this should be a valid CMS Origin Key value identifying a COD Asset
  • For TimeShift/StartOver, Live Broadcast this should be a valid CMS Origin Key for a BTV Channel
  • For Catchup and NPVR this should be a valid Broadcast Event CMS Origin Key
Yes
contentTypeString

Identifies the type of content being requested out of the list of values below:-

  • COD - for VOD content
  • CU - for Catch-up content
  • TS - for Timeshift / StartOver content
  • NPVR - for NPVR content
  • LIVE - for live broadcast content
Yes

Example Request Body

Request a session to playback a VOD content:

CODE
{
    "content": {
        "contentID": "100001V3D",
        "contentType" :"COD"
    }
}

Request a session to playback a LIVE channel content

CODE
{
    "content": {
        "contentID": "BTV_CH1_V",
        "contentType": "LIVE"
    }
}

Success Response

HTTP response code of "200" is returned with a response body content as below:

Name
Type
Description
Required
sessionIdStringA unique identifier returned for the newly created session; this will be in the form of a UUID (Universally unique identifier).Yes
timeoutIntegerThis is the number of seconds in which the session manager expects a keep-alive request to be received for the session. If this request is not received in the specified grace period, the session will be cleaned up by the session manager. If the timeout is not specified then the keep-alive feature has been disabled for this session.No

Example:

CODE
{
    "successResponse": {
        "sessionId": "cfd48f8a-4c33-4c0e-ba52-6632e8810d3e",
        "timeout": 30
    }
}

Error Response

Name
Type
Description
Required
codeStringThe HTTP response code.Yes
statusStringThe categorisation of the failure to process the request.Yes
errorCodeStringThe specific error code.Yes
errorMessageStringA human readable error message.Yes

For a full list of code, status and errorCode values see the chapter "SRM API reference / Error Codes and status values" in SRM User Guide

Example error response for a syntax error in the request:

CODE
{
    "errorResponse": {
        "code": "400",
        "status": "ERROR",
        "errorCode": "SRM-0002",
        "errorMessage": "Malformed request or mandatory parameters missing from request"
    }
}

Example error response when the the maximum number of sessions for the account has been reached. The client gets an HTTP return code of 200 and the following response payload:

CODE
{
    "errorResponse": {
        "code": "200",
        "status": "DENIED",
        "errorCode": "SRM-0006",
        "errorMessage": "Session Limit Reached"
    }
}

Session Keep-alive

This API should be used to maintain an active OTT session for a client device. Concurrently to the content playout, the client application will periodically issue keep-alive requests.  When recieved, the SRM will check the session state, if still valid it will identify the session as being active returning a positive response to the client.

Where a client does not request a keep-alive for a session within a configured time period, that session will become a candidate for removal, with further client access to that session resulting in an error response. The time period within which a keepalive is expected by the session manager for the session, is included in the "timeout" field of a successful SETUP response message. If no "timeout" value has been specified the client should assume that keepalive requests are not required for this session and should not be sent.

It is recommended that the keep-alive period is less than half of that of the timeout period set on SRM, to allow for significant fault tolerance.
To use this API, send an HTTP PUT request to either of the URLs below:

Using the latest version:

CODE
http://<host>:<port>/srm/sessions/{sessionId}

Using v1:

CODE
http://<host>:<port>/srm/v1/sessions/{sessionId}

HTTP Headers

Name
Type
Description
Required
Client-TokenString

Authentication token gained from a positive sign on response

See Authentication for details on obtaining a token.

Yes

It is assumed that the client will maintain a valid authentication token to be included in this request.

Request Parameters

Name
Type
Description
Required
sessionIdStringA unique identifier for the session; this will be in the form of a UUID (Universally unique identifier). It must be the value received in the successResponse from the session's setup request.Yes

Success Response

HTTP response code of "200" will be returned with no response payload.

Error Response

Name
Type
Description
Required
codeStringThe HTTP response code.Yes
statusStringThe categorisation of the failure to process the request.Yes
errorCodeStringThe specific error code.Yes
errorMessageStringA human readable error message.Yes

For a full list of codestatus and errorCode values see the chapter "SRM API reference / Error Codes and status values" in SRM User Guide

Example error responses:

CODE
{
    "errorResponse": {
        "code": "400",
        "status": "ERROR",
        "errorCode": "SRM-0002",
        "errorMessage": "Malformed request or mandatory parameters missing from request"
    }
}
CODE
{
    "errorResponse": {
		"code": "404",
        "status": "ERROR",
        "errorCode": "SRM-0008",
        "errorMessage": "Session Not Found"
    }
}

Error Handling

The client application is expected to behave as follows in certain error situations:

  • Failure to receive response/timeout
    • Client sends keepalive request for session to the session manager.
    • Client does not receive a response from session manager.
      • If the session timeout period has not yet been reached the client is free to re-attempt the session keep-alive using a new request within half the configured timeout period.
      • If the session timeout period has been exceeded the client should send a tear-down request for the session and attempt to setup a new session if required (i.e. OTT stream is still active).


  • Error response
    • Client sends a keepalive request for the session to the session manager
    • Client receives an error response from the session manager
      • Client should send a tear-down request for the session and then attempt to setup a new session if required (i.e. OTT stream is still active). If an attempt is made to setup a new session without issuing a tear-down of the old session when the account maximum number sessions is reached, SRM will refuse to create the new session. The client will have to wait untill one of the old sessions times-out and SRM "expires" it.

Session Tear-down

This API should be used to close an active OTT session for a client device.

When received, the SRM will mark the session as ended and ready for removal. Thus the number of active sessions for the account is decremented, allowing the possibility for a new session to be subseqeuntly created.

To use this API, send an HTTP DELETE request to one of the following URL's:

Using the latest version:

CODE
http://<host>:<port>/srm/sessions/{sessionId}

Using v1:

CODE
http://<host>:<port>/srm/v1/sessions/{sessionId}

HTTP Headers

Name
Type
Description
Required
Client-TokenString

Authentication token gained from a positive sign on response

See Authentication for details on obtaining a token.

Yes

It is assumed that the client will maintain a valid authentication token to be included in this request.

Request Parameters


Name
Type
Description
Required
sessionIdStringA unique identifier for the session; this will be in the form of a UUID (Universally unique identifier). It must be the value received in the successResponse from the session's setup request.Yes
 

Success Response

HTTP response code of "200" will be returned with no response payload.

Error Response

Name
Type
Description
Required
codeStringThe HTTP response code.Yes
statusStringThe categorisation of the failure to process the request.Yes
errorCodeStringThe specific error code.Yes
errorMessageStringA human readable error message.Yes

For a full list of codestatus and errorCode values see the chapter "SRM API reference / Error Codes and status values" in SRM User Guide

Example error responses:

CODE
{
    "errorResponse": {
        "code": "400",
        "status": "ERROR",
        "errorCode": "SRM-0002",
        "errorMessage": "Malformed request or mandatory parameters missing from request"
    }
}

Error Handling

The client application is expected to behave as follows in certain error situations occurring for a tear-down request:

  • Failure to receive response/timeout
    • Client sends tear-down request for session to the session manager.
    • Client does not receive a response from session manager.
      • If the session timeout period has not yet been reached the client is free to re-attempt the tear-down using a new request within half the configured timeout period.
      • If the session timeout period has been exceeded the client should assume the session to be closed.
      • If the session timeout period is not set then the client is free to re-attempt the tear-down using a new request N times within T period; after this period the session can be assumed to be closed.


  • Error response
    • Client sends teardown request for session to the session manager.
    • Client receives an error response from the session manager.
      • The client should assume the session to be closed.

Pre ML2.8, Interface to SDP

As well as the information provided here, see also the full SDP API documentation.

Data Models

OTT Session data model

This is a JSON object with the following fields:

Name
Type
Description
accountIdLongThe ID of the account associated with this session.
allocatedDateDateThe date on which the session was created.
changeLogString

The change history.

This feature is deprecated, and no longer visible to the HUE list.

contentIdLongThe ID of the content being streamed by the session.
contentTypeStringThe type of content being streamed by the session.
creationDateDateThe date the session was created.
deAllocatedDateDateThe date on which the session was deallocated.
deviceIdLongThe ID of the device using the session.
expiryDateDate

The date on which the session will expire. Expiry is calculated depending on the SPID.

exportIDIntegerThe ID to export object to third-party systems.
modifiedDateDateThe date last modified and persisted.
originIDIntegerThe UID of the origin system (third-party system).
originIdAndKeyRead-only stringA unique reference for the object derived by concatenating the originID and originKey, together, separated by a pipe character (|)
originKeyStringThe key of the model object in the origin system (third-party system).
serviceProviderIDLongThe Service Provider UID.
sessionTypeStringThe type of session.
statusStringThe status of the session.
uIDLongThe unique identifier of the session.

Example

JS
{ 
    "UID" : 153,
    "accountUID" : 27,
    "contentUID" : 126,
    "contentType" : "PRG",
    "deviceId" : 36,
    "allocatedDate" : "12-12-2013",
    "status" : "LIVE",
    "expiryDate" : "12-12-2015"
}

Use Cases

Set up an OTT Session

Setup API is used to create a new OTTSession on SDP.

CODE
GET http://server:port/adaptor/hue-gateway/gateway/http/js/ottSession/setUp
Parameters
Name
Type
Description
Mandatory
Example
arg0LongContentId.Y123
arg1StringContentType.YCOD
localeStringLocale.Yen_gb
tokenStringSDP authentication token.Y2HFAQk7EtPMyRGT787M9cExU3HeD

After successful creation, the OTT Session object is returned in the response.

Tear-down an OTT Session

TearDown API is used to delete an OTTSession on SDP.

CODE
GET http://server:port/adaptor/hue-gateway/gateway/http/js/ottSession/tearDown
Parameters
Name
Type
Description
Mandatory
Example
arg0LongSession ID.Y3234
localeStringLocale.Yen_gb
tokenStringSDP authentication token.Y 2HFAQk7EtPMyRGT787M9cExU3HeD

After successful deletion, the sessionId of the deleted OTT Session is returned in the response.

Retrieve list of active OTT Session Media Players

Retrieve API is used to retrieve the list of active OTT sessions Media Player.

CODE
GET http://server:port/adaptor/hue-gateway/gateway/http/js/ottSession/getMPDevicesWithOpenSessions
Parameters
Name
Type
Description
Mandatory
Example
arg0LongstartRow.Y1
arg1LongendRow.Y4
localeStringLocale.Yen_gb
tokenStringSDP authentication token.Y2HFAQk7EtPMyRGT787M9cExU3HeD

This call returns a list of Media Player items that are associated with an active OTTSession.

JavaScript errors detected

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

If this problem persists, please contact our support.