Non-supported devices
If SmartLib is not supported on your device, the session handling workflow can be managed by calling APIs in Broadpeak products.
These APIs must be called from the client application or player.
This guide explains how to integrate the HTTP redirect and the keepalive and teardown requests.
1. Creating the session
The first step is add the query response=200
to the content URL hosted on the Video Delivery Manager (BkM100).
https://BKM100/PATH/manifest?response=200
This request returns an empty response body. The redirected URL is provided in the Location response header:
GET /PATH/manifest?response=200 HTTP/1.1
Host: BKM100
User-Agent: curl/7.87.0
Accept: */*
HTTP/1.1 200 OK
Server: bpkhttpserver/01.07.03
Date: Fri, 09 Jun 2023 09:44:46 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: https://BKS400/bpk-token/AAC@oeif0bvyavihukw3jbxnqqkud0dbcsjrafdd1dba/PATH/manifest
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location
The second step is to get the redirected URL from the Location header, store it for keepalive and teardown requests and pass it to the player.
Why response=200
?
This forces the BkM to respond with status code 200. If not set, the BkM responds with status code 307 which automatically performs the redirect on web platforms, as explained here.
Example
http://bpk67.broadpeak-vcdn.com/bpk-vod/vod20/output01/City/City/index.mpd?response=200
GET /bpk-vod/vod20/output01/City/City/index.mpd?response=200 HTTP/1.1
Host: bpk67.broadpeak-vcdn.com
User-Agent: curl/7.87.0
Accept: */*
HTTP/1.1 200 OK
Server: bpkhttpserver/01.07.03
Date: Fri, 09 Jun 2023 09:44:46 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://bpk69.broadpeak-vcdn.com:80/bpk-token/AAC@oeif0bvyavihukw3jbxnqqkud0dbcsjrafdd1dba/bpk-vod/vod20/output01/City/City/index.mpd
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location
The redirected URL to be used for the playback is http://bpk69.broadpeak-vcdn.com:80/bpk-token/AAC@oeif0bvyavihukw3jbxnqqkud0dbcsjrafdd1dba/bpk-vod/vod20/output01/City/City/index.mpd
2. Maintaining the session
Once the session created (e.g. the stream is pulled from the streaming server, such as a BkS400), a request must be sent every 5 to 10 seconds to that streaming server in order to keep the session active.
This is done by appending /keepalive
to the redirected URL path.
https://BKS400/bpk-token/AAC@oeif0bvyavihukw3jbxnqqkud0dbcsjrafdd1dba/PATH/manifest/keepalive
Example
GET /bpk-token/AAC@3wgwbjjt0ygeficirr2lvnmdscxvzopttxnqalba/bpk-vod/vod20/output01/City/City/index.mpd/keepalive HTTP/1.1
Host: bpk69.broadpeak-vcdn.com
User-Agent: curl/7.87.0
Accept: */*
HTTP/1.1 204 No Content
Server: bks400httpserver
Date: Fri, 09 Jun 2023 12:38:14 GMT
Connection: keep-alive
Expires: Fri, 09 Jun 2023 12:38:13 GMT
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD
X-Cache: HIT from bks400
This request returns an empty response body. It only keeps the session active so the reconnect timeout can be set to a short value.
3. Ending the session
When the session is over, a request has to be sent to the streaming server to immediately close the session, instead of waiting for the reconnect timeout.
This is done by appending /teardown/<statusCode>
to the redirected URL.
Use status code 200 if the session ends normally or status code 3005 if it ends with an error.
https://BKS400/bpk-token/AAC@oeif0bvyavihukw3jbxnqqkud0dbcsjrafdd1dba/PATH/manifest/teardown/<statusCode>
Example
GET /bpk-token/AAC@iifoefoivyruyavb0tkaik2ikmckzaoigjoifhca/bpk-vod/vod20/output01/City/City/index.mpd/teardown/200 HTTP/1.1
Host: bpk69.broadpeak-vcdn.com
User-Agent: curl/7.87.0
Accept: */*
HTTP/1.1 204 No Content
Server: bks400httpserver
Date: Fri, 09 Jun 2023 12:58:44 GMT
Connection: keep-alive
Expires: Fri, 09 Jun 2023 12:58:43 GMT
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD
X-Cache: HIT from bks400