2. Workflow -- Playing Assets Sequentially
The IRIS.TV API offers a lot of flexibility in how recommendations can be integrated into continuous streaming environments. This workflow will cover the API calls needed to handle an Adaptive Stream with no user interaction.
Needed Calls:
1. Watch Call
http://api.iris.tv/watch?platform_id=241YOFG&platform=Incandenza&number=5&access_token=996JVD321AZ&user_id=BTORW&client_token=99999
2. Update Call with “behavior” parameters “[next_auto]=1” “[video_complete]=1”
http://api.iris.tv/update?platform_id=241YOFG&platform=Incandenza&access_token=996JVD321AZ&user_id=BTORW&client_token=99999&experience=53ebec0d321d0690858dw5r1&behavior[next_auto]=1&behavior[video_complete]=1
3. Update Call with “behavior” parameter “[play]=1”
http://api.iris.tv/update?platform_id=343YOW&platform=Incandenza&access_token=996JVD321AZ&user_id=BTORW&client_token=99999&experience=53ebec0d321d0690858dw5r1&behavior[play]=1
4. Next Call
http://api.iris.tv/next?platform_id=46YDPA&platform=Incandenza&number=5&access_token=996JVD321AZ&user_id=BTORW&client_token=99999&experience=53ebec0d321d0690858dw5r1
Example
Client Incandenza is serving an Adaptive Stream to user BTORW. This stream has no user interaction from BTORW. Incandenza is requesting five assets, holding those in a playlist, and is requesting new assets once all four have been watched.
Step 1: Create the Access Token
Once the player has loaded, IRIS.TV recommends automatically creating the Access Token to decrease latency for the first Watch call. The Access Token will be created server-side and follows the OAuth 2 standard. Below is the Curl route for creating access tokens, but these can be created using a variety of languages. For detailed information on creating access token, please refer to OAuth Workflow.
curl -i http://api.iris.tv/oauth/access_token \ -F grant_type=none \ -F client_id=0901c989d10 \ -F client_secret=0980084019 \ -F scope=iris_tv \
Result:
HTTP/1.1 100 Continue HTTP/1.1 200 OK {"access_token":"996JVD321AZ","scope":"iris_tv"}
Step 2: Initiate the Experience
BTORW has clicked the asset titled “Birdman International Teaser,” which has the platform_id “241YOFG.” Client Incandenza is requesting four recommendations.
This call will be sent to the API:
http://api.iris.tv/watch?platform_id=241YOG&platform=Incandenza&number=5&access_token=996JVD321AZ&user_id=BTORW&client_token=99999
The response from IRIS.TV:
jQuery191028397097534104254_1407970311998({ 'success': true, 'next': [ { 'iris_id': '2140j908', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_0.mp4', 'platform_id': '241YOG', 'title': 'Birdman International Trailer', 'release_date': '2014-08-01 18:34:33 UTC' }, { 'iris_id': '51084789cd5f272312231105', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_1.mp4', 'platform_id': '343YOW', 'title': 'Snow Owl Short Film', 'release_date': '2012-10-22 12:30:58 UTC', 'reviewed': '2013-02-05 23:02:24 UTC', }, { 'iris_id': '539a5ba7f09c3f00172310bb', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_2.mp4', 'platform_id': '780YOTSDB'', 'title': 'Blue Heron Teaser Trailer', 'release_date': '2014-06-12 20:51:53 UTC' }, { 'iris_id': '53cdc6233459980016231012', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_3.mp4', 'platform_id': '9019YOPW', 'title': 'Nelson Simcoe Clip', 'release_date': '2014-07-20 19:51:07 UTC' }, { 'iris_id': '51084760cd5f2723122310a1', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_4.mp4', 'platform_id': '89YWQMD', 'title': 'Life & Times Trailer', 'release_date': '2012-11-30 05:48:51 UTC', 'reviewed': '2013-09-06 22:35:10 UTC', }, { 'iris_id': '53814f1af1585f0032231014', 'platform': 'Icandenza', 'content_url': 'http://www.credenza.com/asset_5.mp4', 'platform_id': '46YDPA', 'title': 'Paleo Diet International Trailer', 'release_date': '2014-05-24 19:33:28 UTC' } ], 'experience': '53ebec0d321d0690858dw5r1' })
Incandenza will then hold this series of recommendations within a playlist. All future calls to IRIS.TV within this experience will also include the Experience value IRIS.TV sends in the response.
Step 3: Send Video Complete Update for first asset
BTORW has watched the first asset.
Incandenza sends following call to IRIS.TV:
http://api.iris.tv/update?platform_id=241YOFG&platform=Incandenza&access_token=996JVD321AZ&user_id=BTORW&client_token=99999&experience=53ebec0d321d0690858dw5r1&behavior[next_auto]=1&behavior[video_complete]=1&behavior[percentage_watched]=1
Note: The addition of the experience value in the Update call
Response from IRIS.TV API:
{ "success": true, "behavior": { "next_auto": 1, video_complete: 1 "percentage_watched": 1 }, "experience": "53ebec0d321d0690858dw5r1" }
Step 4: Send Play Notification for Second Asset
Once the second asset starts playing, Incandenza sends an Update call that informs IRIS.TV of new asset.
http://api.iris.tv/update?platform_id=343YOW&platform=Incandenza&access_token=996JVD321AZ&user_id=BTORW&client_token=99999&experience=53ebec0d321d0690858dw5r1&behavior[play]=1
Response from IRIS.TV API:
{ "success": true, "behavior": { "play": 1 }, "experience": "53ebec0d321d0690858dw5r1" }
IRIS.TV