Results for:

Suppor Center

Security API

Security API

Create Session

Create Session

The method CreateSession has two functions: you can use it for protection of the content delivery, or if you want to create your own player by using Flash or HTML5

By calling this method you ask to the server to generate an authentication password that is valid for 24 hours.

Request

Post:
<?xml version="1.0" encoding="utf-8" ?>
    <CreateSession>
        <token>MY_API_KEY</token>
        <contentId>MY_CONTENT_ID</contentId>
        <userAgent>CLIENT_USER_AGENT</userAgent>
        <userHostAddress>CLIENT_IP_ADDRESS</userHostAddress>
    </CreateSession>
                
{
    "token": "MY_API_KEY",
    "title": "title",
    "description": "description",
    "note": "Notes",
    "utcStartDate": "Start date",
    "utcEndDate": "End date"
}
                
The call must have API key, contentID of the content you want to create the session and even the user agent and client IP Adress that is trying to watch the video (the user of your site), in order to track views and get true statistics.

Parameters

token Specify your MainStreaming API KEY
contentId Specify the contentID of the content you want to delivery.
userAgent UserAgent of the client that is requesting the content (you have to specify it, for a true statistic tracking)
userHostAddress IP Address of the client that is requesting the content (you have to specify it, for a true statistic tracking)

Response:

<SessionStruct xmlns="http://schemas.datacontract.org/2004/07/Mainsoft.Streaming.Sdk._13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <contentId>MY_CONTENT_ID</contentId>
    <cupertinoHLSUrl>IOS_ADAPTIVE_URL</cupertinoHLSUrl>
    <rtmpSmil>RTMP_ADAPTIVE_SMIL_URL</rtmpSmil>
    <sanJoseHTTPUrl>FLASH_HTTP_ADAPTIVE_URL</sanJoseHTTPUrl>
    <sessionId>SESSION_ID</sessionId>
<SessionStruct>
                
{
    "contentId": "MY_CONTENT_ID",
    "cupertinoHLSUrl": "IOS_ADAPTIVE_URL",
    "rtmpSmil": "RTMP_ADAPTIVE_SMIL_URL",
    "sanJoseHTTPUrl": "FLASH_HTTP_ADAPTIVE_URL",
    "sessionId": "SESSION_ID",
}
                        

The response give to you four values:

SessionId is the value to be used to protect the content. With this value you can embed your content using this URL: http(s)://video.mainstreaming.tv/embed/sessionId

In this way the client can watch the content through a session code, valid for a limited time. All the session have a duration of 24 hours. In the next version of the API will be available the possibilty to customize the duration of the session.

The IFRAME embedding procedure is the same and all parameters are valid.

With cupertinoHLSUrl, rtmpSmil and sanJoseHTTPUrl you can create a custom player in Flash or HTML5.

Session ID can be used as a access password and is secure enough because limits the session to a 24 hours duration. It's important to not distribute the ContentID because the creation of the session is not more valid to protect your content.

The video is visible by any IP Address, even if you specify the IP Address of the user on the request parameters. The field is used only for statistic purposes. There isn't an IP blocking system because there are a lot of devices that have more than one internet connection (ethernet/wifi/3g/4g) and can appear with different IP address even after the create session request.

keyboard_arrow_up