/
Migrating to the new PlayableStream format endpoints
Migrating to the new PlayableStream format endpoints
Walk through use case
Using the old endpoint
Currently the client will call our "play" endpoint which returns an JSON object containing the URL where the stream is available and the DRM information required to play it.
Current endpoint example |
---|
https://demo.com/api/channel/38/stream/103/play?userEmail=boox6%40cloudpvr.nl&service=delta_test&ajax=1&startover=false&stream_type=hls&service=delta_test |
Using the new endpoint
Client behaviour should be nearly identical.
You will call the endpoint, receive the information, and then perform the redirection.
Differences between old and new
Our new endpoint PlayableStream related to Channel (live) returns similar information, but is more detailed.
The chief differences to note are:
- The "startover" parameter is renamed to "restart_at_beginning"
- The following parameters are no longer required or supported:
- service
- ajax
- stream_type
- The API will return a number of different stream_types and let the client pick which one to display
- The "suggested_devices" key in the response will be empty until we implement this feature. An exception is for when the customer has implemented Broadpeak CDN in which case there may be a stream for the suggested type "nanoCDN"
Example response
Below is an actual example returned for an npvr stream. Note that the protection type does not require protection keys so this is omitted in this response.
Please refer to the API documentation for a more general response format.
Example of a live response (please refer to API documentation for general response format)
{ "data":[ { "id":"{"stream_url":"https://pre-npvr-media-booxmedia.secure.footprint.net","profile_name":"sd_1"}", "type":"PlayableStream", "attributes":{ "suggested_devices":[ ], "codec_info":"video/mp4", "transport_protocol":"https", "streaming_protocols":[ "hls" ], "bitrate":2404, "stream_url":"https://pre-npvr-media-booxmedia.secure.footprint.net/data/r1/2018/04/06/17/6081372/6081372.ism/playlist.m3u8?startvalidity=20180406115952&endvalidity=20180407120452&nva=20180407120452&ttl=86700&ip=81.157.251.100&token=0f2636a5df2905e026323", "protection_types":[ "cdn_auth_token1" ], "profile_name":"sd_1", "max_resolution":"576", "vbr_max_bitrate":2404 } }, { "id":"{"stream_url":"http://mts-pre-vdn-sslsegments.dna.fi","profile_name":"sd_1"}", "type":"PlayableStream", "attributes":{ "suggested_devices":[ ], "codec_info":"video/mp4", "transport_protocol":"http", "streaming_protocols":[ "hls" ], "bitrate":2404, "stream_url":"http://mts-pre-ew3020-van-1-1.dna.fi:80/session/b66c06bc-3992-11e8-b6e0-00505699e137/7kcjqi/data/r1/2018/04/06/17/6081372/6081372.ism/playlist.m3u8?token=de0f08e0e63b388aae976bb96a8b4aae_1523045092_1523045092", "protection_types":[ "cdn_edge" ], "profile_name":"sd_1", "max_resolution":"576", "vbr_max_bitrate":2404 } } ] }