Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
277 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
176 changes: 176 additions & 0 deletions
176
articles/media-services-rest-deliver-streaming-content.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
<properties | ||
pageTitle="How to Deliver Streaming Content from Media Services" | ||
description="Learn how to create a locator that is used to build a streaming URL. The code uses REST API." | ||
authors="juliako" | ||
manager="dwrede" | ||
editor="" | ||
services="media-services" | ||
documentationCenter=""/> | ||
|
||
<tags | ||
ms.service="media-services" | ||
ms.workload="media" | ||
ms.tgt_pltfrm="na" | ||
ms.devlang="na" | ||
ms.topic="article" | ||
ms.date="02/17/2015" | ||
ms.author="juliako"/> | ||
|
||
|
||
#How to: Deliver streaming content | ||
|
||
This article is part of the [Media Services Video on Demand workflow](../media-services-video-on-demand-workflow) and [Media Services Live Streaming workflow](../media-services-live-streaming-workflow) series. | ||
|
||
##Overview | ||
|
||
|
||
You can stream an adaptive bitrate MP4 set by creating an OnDemand streaming locator and building a streaming URL. The [encoding an asset](../media-services-rest-encode-asset) topic shows how to encode into an adaptive bitrate MP4 set. Before you create a locator you should configure asset delivery policy as described in [this](../media-services-rest-configure-asset-delivery-policy) topic. | ||
|
||
You can also use an OnDemand streaming locator to build URLs that point to MP4 files that can be progressively downloaded. | ||
|
||
This topic shows how to create an OnDemand streaming locator in order to publish your asset and build a Smooth, MPEG DASH, and HLS streaming URLs. It also shows hot to build progressive download URLs. | ||
|
||
The [following](#types) section shows the enum types whose values are used in the REST calls. | ||
|
||
##Create an OnDemand streaming locator | ||
|
||
To create the OnDemand streaming locator and get URLs you need to do the following: | ||
|
||
|
||
1. Define an access policy. | ||
2. Create an OnDemand streaming locator. | ||
3. If you plan to stream, get the streaming manifest file (.ism) in the asset. | ||
|
||
If you plan to progressively download, get the names of MP4 files in the asset. | ||
4. Build URLs to the manifest file or MP4 files. | ||
|
||
|
||
###Create an access policy | ||
|
||
Request: | ||
|
||
POST https://media.windows.net/api/AccessPolicies HTTP/1.1 | ||
Content-Type: application/json | ||
DataServiceVersion: 1.0;NetFx | ||
MaxDataServiceVersion: 3.0;NetFx | ||
Accept: application/json | ||
Accept-Charset: UTF-8 | ||
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=amstest1&urn%3aSubscriptionId=bbbef702-e769-477b-9f16-bc4d3aa97387&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&Audience=urn%3aWindowsAzureMediaServices&ExpiresOn=1424263184&Issuer=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&HMACSHA256=NWE%2f986Hr5lZTzVGKtC%2ftzHm9n6U%2fxpTFULItxKUGC4%3d | ||
x-ms-version: 2.8 | ||
x-ms-client-request-id: 6bcfd511-a561-448d-a022-a319a89ecffa | ||
Host: media.windows.net | ||
Content-Length: 68 | ||
|
||
{"Name":"access policy","DurationInMinutes":43200.0,"Permissions":1} | ||
|
||
Response: | ||
|
||
HTTP/1.1 201 Created | ||
Cache-Control: no-cache | ||
Content-Length: 311 | ||
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 | ||
Location: https:/media.windows.net/api/AccessPolicies('nb%3Apid%3AUUID%3A69c80d98-7830-407f-a9af-e25f4b0d3e5f') | ||
Server: Microsoft-IIS/8.5 | ||
request-id: a877528a-bdb4-4414-9862-273f8e64f882 | ||
x-ms-request-id: a877528a-bdb4-4414-9862-273f8e64f882 | ||
x-ms-client-request-id: 6bcfd511-a561-448d-a022-a319a89ecffa | ||
X-Content-Type-Options: nosniff | ||
DataServiceVersion: 3.0; | ||
X-Powered-By: ASP.NET | ||
Strict-Transport-Security: max-age=31536000; includeSubDomains | ||
Date: Wed, 18 Feb 2015 06:52:09 GMT | ||
|
||
{"odata.metadata":"https://media.windows.net/api/$metadata#AccessPolicies/@Element","Id":"nb:pid:UUID:69c80d98-7830-407f-a9af-e25f4b0d3e5f","Created":"2015-02-18T06:52:09.8862191Z","LastModified":"2015-02-18T06:52:09.8862191Z","Name":"access policy","DurationInMinutes":43200.0,"Permissions":1} | ||
|
||
###Create an OnDemand streaming locator | ||
|
||
Create the locator for the specified asset and asset policy. | ||
|
||
Request: | ||
|
||
POST https://media.windows.net/api/Locators HTTP/1.1 | ||
Content-Type: application/json | ||
DataServiceVersion: 1.0;NetFx | ||
MaxDataServiceVersion: 3.0;NetFx | ||
Accept: application/json | ||
Accept-Charset: UTF-8 | ||
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=amstest1&urn%3aSubscriptionId=bbbef702-e769-477b-9f16-bc4d3aa97387&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&Audience=urn%3aWindowsAzureMediaServices&ExpiresOn=1424263184&Issuer=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&HMACSHA256=NWE%2f986Hr5lZTzVGKtC%2ftzHm9n6U%2fxpTFULItxKUGC4%3d | ||
x-ms-version: 2.8 | ||
x-ms-client-request-id: ac159492-9a0c-40c3-aacc-551b1b4c5f62 | ||
Host: media.windows.net | ||
Content-Length: 181 | ||
|
||
{"AccessPolicyId":"nb:pid:UUID:1480030d-c481-430a-9687-535c6a5cb272","AssetId":"nb:cid:UUID:cc1e445d-1500-80bd-538e-f1e4b71b465e","StartTime":"2015-02-18T06:34:47.267872Z","Type":2} | ||
|
||
Response: | ||
|
||
HTTP/1.1 201 Created | ||
Cache-Control: no-cache | ||
Content-Length: 637 | ||
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8 | ||
Location: https://media.windows.net/api/Locators('nb%3Alid%3AUUID%3Abe245661-2bbd-4fc6-b14f-9cf9a1492e5e') | ||
Server: Microsoft-IIS/8.5 | ||
request-id: 5bd5864a-0afd-44c0-a67a-4044a2c9043b | ||
x-ms-request-id: 5bd5864a-0afd-44c0-a67a-4044a2c9043b | ||
x-ms-client-request-id: ac159492-9a0c-40c3-aacc-551b1b4c5f62 | ||
X-Content-Type-Options: nosniff | ||
DataServiceVersion: 3.0; | ||
X-Powered-By: ASP.NET | ||
Strict-Transport-Security: max-age=31536000; includeSubDomains | ||
Date: Wed, 18 Feb 2015 06:58:37 GMT | ||
|
||
{"odata.metadata":"https://media.windows.net/api/$metadata#Locators/@Element","Id":"nb:lid:UUID:be245661-2bbd-4fc6-b14f-9cf9a1492e5e","ExpirationDateTime":"2015-03-20T06:34:47.267872+00:00","Type":2,"Path":"http://amstest1.streaming.mediaservices.windows.net/be245661-2bbd-4fc6-b14f-9cf9a1492e5e/","BaseUri":"http://amstest1.streaming.mediaservices.windows.net","ContentAccessComponent":"be245661-2bbd-4fc6-b14f-9cf9a1492e5e","AccessPolicyId":"nb:pid:UUID:1480030d-c481-430a-9687-535c6a5cb272","AssetId":"nb:cid:UUID:cc1e445d-1500-80bd-538e-f1e4b71b465e","StartTime":"2015-02-18T06:34:47.267872+00:00","Name":null} | ||
|
||
###Build streaming URLs | ||
|
||
Use the **Path** value returned after the creation of the locator to build the Smooth, HLS, and MPEG DASH URLs. | ||
|
||
Smooth Streaming: **Path** + manifest file name + "/manifest" | ||
|
||
example: | ||
|
||
http://amstest1.streaming.mediaservices.windows.net/3c5fe676-199c-4620-9b03-ba014900f214/BigBuckBunny.ism/manifest | ||
|
||
HLS: **Path** + manifest file name + "/manifest(format=m3u8-aapl)" | ||
|
||
example: | ||
|
||
http://amstest1.streaming.mediaservices.windows.net/3c5fe676-199c-4620-9b03-ba014900f214/BigBuckBunny.ism/manifest(format=m3u8-aapl) | ||
|
||
|
||
DASH: **Path** + manifest file name + "/manifest(format=mpd-time-csf)" | ||
|
||
|
||
example: | ||
|
||
http://amstest1.streaming.mediaservices.windows.net/3c5fe676-199c-4620-9b03-ba014900f214/BigBuckBunny.ism/manifest(format=mpd-time-csf) | ||
|
||
|
||
###Build progressive download URLs | ||
|
||
Use the **Path** value returned after the creation of the locator to build the progressive download URL. | ||
|
||
URL: **Path** + asset file mp4 name | ||
|
||
example: | ||
|
||
http://amstest1.streaming.mediaservices.windows.net/3c5fe676-199c-4620-9b03-ba014900f214/BigBuckBunny_H264_650kbps_AAC_und_ch2_96kbps.mp4 | ||
|
||
##<a id="types"></a>Enum types | ||
|
||
[Flags] | ||
public enum AccessPermissions | ||
{ | ||
None = 0, | ||
Read = 1, | ||
Write = 2, | ||
Delete = 4, | ||
List = 8, | ||
} | ||
|
||
public enum LocatorType | ||
{ | ||
None = 0, | ||
Sas = 1, | ||
OnDemandOrigin = 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
> [AZURE.SELECTOR] | ||
- [Portal](/en-us/documentation/articles/media-services-manage-content#publish/) | ||
- [.NET SDK](/en-us/documentation/articles/media-services-deliver-streaming-content/) | ||
- [REST API](/en-us/documentation/articles/media-services-rest-deliver-streaming-content) |