Skip to content

Commit d33a41d

Browse files
committed
Merge pull request #4 from noopman/master
Demo review of the Demo.md files.
2 parents 6ddeb61 + fbdb90e commit d33a41d

File tree

25 files changed

+931
-655
lines changed

25 files changed

+931
-655
lines changed

Presentation/IaaS/Demo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
3. Click on the **Everything** link.
88
4. In **Gallery** blade, open the **Virtual machines** category.
99
5. Scroll down the view and show images of different types (refer back to slide 9).
10-
6. Click on **Windows Server 2012 R2**, and then click the **Create** button in the overview blade. For non-Microsoft focused audience, consider to pick a Linux image instead.
10+
6. Click on **Windows Server 2012 R2 Datacenter**, and then click the **Create** button in the overview blade. For non-Microsoft focused audience, consider to pick a Linux image instead.
1111
7. Fill in the **Create VM** form and click on the **Create** button to provision the VM. Explain this will take a few minutes.
1212
8. Open the already provisioned VM.
1313
9. Scroll down the blade to show various of information available on the blade.
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<appSettings>
4-
<add key="MediaServicesAccountName" value=""/>
5-
<add key="MediaServicesAccountKey" value=""/>
6-
</appSettings>
7-
<startup>
8-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
9-
</startup>
10-
<runtime>
11-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
12-
<dependentAssembly>
13-
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
15-
</dependentAssembly>
16-
<dependentAssembly>
17-
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
18-
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
19-
</dependentAssembly>
20-
<dependentAssembly>
21-
<assemblyIdentity name="Microsoft.WindowsAzure.MediaServices.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
22-
<bindingRedirect oldVersion="0.0.0.0-3.0.0.5" newVersion="3.0.0.5" />
23-
</dependentAssembly>
24-
</assemblyBinding>
25-
</runtime>
3+
<appSettings>
4+
<add key="MediaServices-AccountName" value=""/>
5+
<add key="MediaServices-AccountKey" value=""/>
6+
<add key="Your-Demo-mp4" value="C:\users\you\your.mp4"/>
7+
</appSettings>
8+
<startup>
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
10+
</startup>
11+
<runtime>
12+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
13+
<dependentAssembly>
14+
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
15+
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
16+
</dependentAssembly>
17+
<dependentAssembly>
18+
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="Microsoft.WindowsAzure.MediaServices.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-3.0.0.5" newVersion="3.0.0.5" />
24+
</dependentAssembly>
25+
</assemblyBinding>
26+
</runtime>
2627
</configuration>
Lines changed: 104 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,112 @@
1-
using Microsoft.WindowsAzure.MediaServices.Client;
1+
//****************************************************************************************
2+
// Microsoft Azure Media Services allows you to build scalable, cost effective, end-to-end
3+
// media distribution solutions that can stream media to Adobe Flash, Android, iOS, Windows,
4+
// and other devices and platforms. If you dont have a Microsoft Azure subscription you can
5+
// get a FREE trial account here: http://go.microsoft.com/fwlink/?LinkId=330212
6+
//
7+
//
8+
//TODO: 1. Provision a Media Service using the Microsoft Azure Management Portal
9+
// http://go.microsoft.com/fwlink/?LinkId=324582
10+
// 2. Open App.Config and update the value of appSettings:
11+
// MediaServices-AccountName
12+
// MediaServices-AccountKey
13+
// Your-Demo-mp4 (this should point at your *.mp4 input file)
14+
//****************************************************************************************
15+
216
using System;
317
using System.Collections.Generic;
418
using System.Configuration;
519
using System.Linq;
6-
using System.Text;
720
using System.Threading;
8-
using System.Threading.Tasks;
21+
using Microsoft.WindowsAzure.MediaServices.Client;
922

1023
namespace VODWorkflow
1124
{
12-
class Program
13-
{
14-
//****************************************************************************************
15-
// Microsoft Azure Media Services allows you to build scalable, cost effective, end-to-end
16-
// media distribution solutions that can stream media to Adobe Flash, Android, iOS, Windows,
17-
// and other devices and platforms. If you dont have a Microsoft Azure subscription you can
18-
// get a FREE trial account here: http://go.microsoft.com/fwlink/?LinkId=330212
19-
//
20-
//
21-
//TODO: 1. Provision a Media Service using the Microsoft Azure Management Portal
22-
// http://go.microsoft.com/fwlink/?LinkId=324582
23-
// 2. Open App.Config and update the value of appSetting MediaServicesAccountName
24-
// and MediaServicesAccountKey
25-
// 3. Update _singleInputMp4Path variable below to point at your *.mp4 input file
26-
//****************************************************************************************
27-
28-
private static readonly string _singleInputMp4Path = @"C:\users\you\your.mp4";
29-
private static readonly string _mediaServicesAccountKey = ConfigurationManager.AppSettings["MediaServicesAccountKey"];
30-
private static readonly string _mediaServicesAccountName = ConfigurationManager.AppSettings["MediaServicesAccountName"];
31-
32-
33-
// Field for service context.
34-
private static CloudMediaContext _context = null;
35-
36-
static void Main(string[] args)
37-
{
38-
try
39-
{
40-
MediaServicesCredentials credentials = new MediaServicesCredentials(_mediaServicesAccountName, _mediaServicesAccountKey);
41-
CloudMediaContext context = new CloudMediaContext(credentials);
42-
43-
Console.WriteLine("Creating new asset from local file...");
44-
45-
// 1. Create a new asset by uploading a mezzanine file from a local path.
46-
IAsset inputAsset = context.Assets.CreateFromFile(_singleInputMp4Path, AssetCreationOptions.None,
47-
(af, p) =>
48-
{
49-
Console.WriteLine("Uploading '{0}' - Progress: {1:0.##}%", af.Name, p.Progress);
50-
});
51-
52-
Console.WriteLine("Asset created.");
53-
54-
// 2. Prepare a job with a single task to transcode the previous mezzanine asset
55-
// into a multi-bitrate asset.
56-
IJob job = context.Jobs.CreateWithSingleTask(MediaProcessorNames.WindowsAzureMediaEncoder,
57-
MediaEncoderTaskPresetStrings.H264AdaptiveBitrateMP4Set720p,
58-
inputAsset,
59-
"Sample Adaptive Bitrate MP4",
60-
AssetCreationOptions.None);
61-
62-
Console.WriteLine("Submitting transcoding job...");
63-
64-
// 3. Submit the job and wait until it is completed.
65-
job.Submit();
66-
job = job.StartExecutionProgressTask(j => {
67-
Console.WriteLine("Job state: {0}", j.State);
68-
Console.WriteLine("Job progress: {0:0.##}%", j.GetOverallProgress());
69-
}, CancellationToken.None).Result;
70-
71-
Console.WriteLine("Transcoding job finished.");
72-
73-
IAsset outputAsset = job.OutputMediaAssets[0];
74-
75-
Console.WriteLine("Publishing output asset...");
76-
77-
// 4. Publish the output asset by creating an Origin locator for adaptive streaming,
78-
// and a SAS locator for progressive download.
79-
context.Locators.Create(LocatorType.OnDemandOrigin, outputAsset, AccessPermissions.Read, TimeSpan.FromDays(30));
80-
context.Locators.Create(LocatorType.Sas, outputAsset, AccessPermissions.Read, TimeSpan.FromDays(30));
81-
82-
IEnumerable<IAssetFile> mp4AssetFiles = outputAsset.AssetFiles.ToList()
83-
.Where(af => af.Name.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase));
84-
85-
// 5. Generate the Smooth Streaming, HLS and MPEG-DASH URLs for adaptive streaming,
86-
// and the Progressive Download URL.
87-
Uri smoothStreamingUri = outputAsset.GetSmoothStreamingUri();
88-
Uri hlsUri = outputAsset.GetHlsUri();
89-
Uri mpegDashUri = outputAsset.GetMpegDashUri();
90-
List<Uri> mp4ProgressiveDownloadUris = mp4AssetFiles.Select(af => af.GetSasUri()).ToList();
91-
92-
// 6. Get the asset URLs.
93-
Console.WriteLine(smoothStreamingUri);
94-
Console.WriteLine(hlsUri);
95-
Console.WriteLine(mpegDashUri);
96-
mp4ProgressiveDownloadUris.ForEach(uri => Console.WriteLine(uri));
97-
98-
Console.WriteLine("Output asset available for adaptive streaming and progressive download.");
99-
100-
Console.WriteLine("VOD workflow finished.");
101-
}
102-
catch (Exception exception)
103-
{
104-
// Parse the XML error message in the Media Services response and create a new
105-
// exception with its content.
106-
exception = MediaServicesExceptionParser.Parse(exception);
107-
108-
Console.Error.WriteLine(exception.Message);
109-
}
110-
finally
111-
{
112-
Console.ReadLine();
113-
}
114-
}
115-
}
116-
}
25+
class Program
26+
{
27+
private static readonly string SingleInputMp4Path = ConfigurationManager.AppSettings["Your-Demo-mp4"];
28+
private static readonly string MediaServicesAccountKey = ConfigurationManager.AppSettings["MediaServices-AccountKey"];
29+
private static readonly string MediaServicesAccountName = ConfigurationManager.AppSettings["MediaServices-AccountName"];
30+
31+
static void Main()
32+
{
33+
try
34+
{
35+
MediaServicesCredentials credentials = new MediaServicesCredentials(MediaServicesAccountName, MediaServicesAccountKey);
36+
CloudMediaContext context = new CloudMediaContext(credentials);
37+
38+
Console.WriteLine("Creating new asset from local file...");
39+
40+
// 1. Create a new asset by uploading a mezzanine file from a local path.
41+
IAsset inputAsset = context.Assets.CreateFromFile(SingleInputMp4Path, AssetCreationOptions.None,
42+
(af, p) =>
43+
{
44+
Console.WriteLine("Uploading '{0}' - Progress: {1:0.##}%", af.Name, p.Progress);
45+
});
46+
47+
Console.WriteLine("Asset created.");
48+
49+
// 2. Prepare a job with a single task to transcode the previous mezzanine asset
50+
// into a multi-bitrate asset.
51+
IJob job = context.Jobs.CreateWithSingleTask(MediaProcessorNames.WindowsAzureMediaEncoder,
52+
MediaEncoderTaskPresetStrings.H264AdaptiveBitrateMP4Set720p,
53+
inputAsset,
54+
"Sample Adaptive Bitrate MP4",
55+
AssetCreationOptions.None);
56+
57+
Console.WriteLine("Submitting transcoding job...");
58+
59+
// 3. Submit the job and wait until it is completed.
60+
job.Submit();
61+
job = job.StartExecutionProgressTask(j =>
62+
{
63+
Console.WriteLine("Job state: {0}", j.State);
64+
Console.WriteLine("Job progress: {0:0.##}%", j.GetOverallProgress());
65+
}, CancellationToken.None).Result;
66+
67+
Console.WriteLine("Transcoding job finished.");
68+
69+
IAsset outputAsset = job.OutputMediaAssets[0];
70+
71+
Console.WriteLine("Publishing output asset...");
72+
73+
// 4. Publish the output asset by creating an Origin locator for adaptive streaming,
74+
// and a SAS locator for progressive download.
75+
context.Locators.Create(LocatorType.OnDemandOrigin, outputAsset, AccessPermissions.Read, TimeSpan.FromDays(30));
76+
context.Locators.Create(LocatorType.Sas, outputAsset, AccessPermissions.Read, TimeSpan.FromDays(30));
77+
78+
IEnumerable<IAssetFile> mp4AssetFiles = outputAsset.AssetFiles.ToList()
79+
.Where(af => af.Name.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase));
80+
81+
// 5. Generate the Smooth Streaming, HLS and MPEG-DASH URLs for adaptive streaming,
82+
// and the Progressive Download URL.
83+
Uri smoothStreamingUri = outputAsset.GetSmoothStreamingUri();
84+
Uri hlsUri = outputAsset.GetHlsUri();
85+
Uri mpegDashUri = outputAsset.GetMpegDashUri();
86+
List<Uri> mp4ProgressiveDownloadUris = mp4AssetFiles.Select(af => af.GetSasUri()).ToList();
87+
88+
// 6. Get the asset URLs.
89+
Console.WriteLine(smoothStreamingUri);
90+
Console.WriteLine(hlsUri);
91+
Console.WriteLine(mpegDashUri);
92+
mp4ProgressiveDownloadUris.ForEach(Console.WriteLine);
93+
94+
Console.WriteLine("Output asset available for adaptive streaming and progressive download.");
95+
96+
Console.WriteLine("VOD workflow finished.");
97+
}
98+
catch (Exception exception)
99+
{
100+
// Parse the XML error message in the Media Services response and create a new
101+
// exception with its content.
102+
exception = MediaServicesExceptionParser.Parse(exception);
103+
104+
Console.Error.WriteLine(exception.Message);
105+
}
106+
finally
107+
{
108+
Console.ReadLine();
109+
}
110+
}
111+
}
112+
}
Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<appSettings>
4-
<add key="MediaServicesAccountName" value=""/>
5-
<add key="MediaServicesAccountKey" value=""/>
6-
</appSettings>
7-
<startup>
8-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
9-
</startup>
10-
<runtime>
11-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
12-
<dependentAssembly>
13-
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
14-
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
15-
</dependentAssembly>
16-
<dependentAssembly>
17-
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
18-
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
19-
</dependentAssembly>
20-
<dependentAssembly>
21-
<assemblyIdentity name="Microsoft.WindowsAzure.MediaServices.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
22-
<bindingRedirect oldVersion="0.0.0.0-3.0.0.5" newVersion="3.0.0.5" />
23-
</dependentAssembly>
24-
</assemblyBinding>
25-
</runtime>
3+
4+
<appSettings>
5+
<add key="MediaServices-AccountName" value=""/>
6+
<add key="MediaServices-AccountKey" value=""/>
7+
<add key="Your-Demo-mp4" value="C:\users\you\your.mp4"/>
8+
</appSettings>
9+
10+
<startup>
11+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
12+
</startup>
13+
<runtime>
14+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
15+
<dependentAssembly>
16+
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
17+
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
18+
</dependentAssembly>
19+
<dependentAssembly>
20+
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
21+
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
22+
</dependentAssembly>
23+
<dependentAssembly>
24+
<assemblyIdentity name="Microsoft.WindowsAzure.MediaServices.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
25+
<bindingRedirect oldVersion="0.0.0.0-3.0.0.5" newVersion="3.0.0.5" />
26+
</dependentAssembly>
27+
</assemblyBinding>
28+
</runtime>
2629
</configuration>

0 commit comments

Comments
 (0)