Downloads Integration Details

Allow your website visitors to securely download movies from your website to the Secure Player app

​Minimum Implementation

1. PUT YOUR MOVIE FILE URL IN JSON

{

"urlmovie": "https://example.com/download?movie=examplemovie123"

}

2. BASE64

ENCODE THE JSON

eyJ1cmxtb3ZpZSI6ICJodHRwczovL2V4YW1wbGUuY29tL2Rvd25sb2FkP21vdmllPWJlYW5zLm1wNCJ9

3. PUT A DOWNLOAD BUTTON ON YOUR SITE

<button onclick="window.location='splayer://dl?b= eyJ1cmxtb3ZpZSI6ICJodHRwczovL2V4YW1wbGUuY29tL2Rvd25sb2FkP21vdmllPWJlYW5zLm1wNCJ9'">DL</button>

When user taps on the DL button, the Secure Player app will open and start to download the file from the URL that you specified in the first step. It will look something like this:

Using VR downloads

To specify VR playback of a movie file, add the "viewmode"

parameter to the JSON in step 1 of the minimum implementation. Then continue with step 2 and step 3.

{

"urlmovie": "https://example.com/vrmovie.mp4", "viewmode" : "TD"

}

Value

Description

TD

Stereoscopic, top down

PANO

Panorama

SBS180

Side by side, 180 degrees

SBS360

Side by side, 360 degrees

Use Metadata API (Optional)

To show custom metadata like title and cover picture, implement and use the metadata API

You need to host the metadata API on your own server.

1. ADD THE URL OF YOUR METADATA API TO THE JSON:

{

    "urlmovie": "https://example.com/download?movie=examplemovie123",    "metadata_api": "https://example.com/api/metadata?movie=examplemovie123"

}

2. THE METADATA API SHOULD RETURN JSON LIKE THIS:

{

    "title": "Big Buck BUNNY",

    "urlpicture": "https://example.com/bunnycover.jpg",

    "part": "1",

    "filesize": "786432000",

    "quality": "HD"

}

All of the properties in the metadata response are optional.

"title" will be shown instead of the movie filename.

"urlpicture" - which should point to an image file - will be shown as the cover image instead of the default cover.

If your movie has several parts you can use "part" to specify the part number.

"filesize" should be the number of bytes of the movie - if specified this will allow the app to show move file size before download begins.

Refer to the example screenshot.

Use Authentication API (Optional)

If you want to authenticate the user before download and playback, implement and use the authentication API.

You need to host the authentication API on your own server.

Add the "auth_api" property to the JSON specified in "Minimum implementation". The URL should point to the authentication API.

{

    "urlmovie": "https://example.com/download?movie=samplemovie123",

    "auth_api": "https://example.com/api/auth"

}

The authentication API should return one of three responses in JSON format:

{

    "status": 1,

    "target": "https://www.example.com/loginpage"

}

If authentication is required. App will open the redirect target login page in a web view.

The web page should - after successful login - set session cookies and call JavaScript: window.location.href = 'secure://retry_access';

{

    "status": 0

}

If access is granted. Should confirm the session cookies.

{

    "status": 2,

    "error": {

        "title": "Error",

        "message": "Some random error."

    }

}

If error occurred. The error title and message will be shown in an alert.

© 2019 secureplayer.net