Azure Media Player is a powerful tool for streaming media content online. It's a free, open-source player that allows you to deliver high-quality video and audio to your audience.
To get started with Azure Media Player, you'll need to create a new instance in the Azure portal. This will give you access to the player's configuration settings.
The player supports a wide range of formats, including HLS, DASH, and Smooth Streaming. This means you can easily integrate it with your existing content delivery network (CDN).
For a smooth playback experience, make sure to configure the player's buffering settings correctly. This will help prevent interruptions and ensure your content continues to play uninterrupted.
Azure Media Player Setup
Azure Media Player Setup is relatively straightforward. You can use Azure Media Player to stream videos from Azure Media Services.
If your web page or application loads the video tag dynamically, you'll need to manually set up the player instead of relying on the data-setup attribute. This involves removing the data-setup attribute from the tag and running some JavaScript code after the Azure Media Player JavaScript has loaded and the video tag has been loaded into the DOM.
The JavaScript code takes three arguments: the ID of your video tag, an options object, and a 'ready' callback function. The 'ready' callback function is called once Azure Media Player has initialized, and 'this' object refers to the player instance.
Dynamic HTML Setup
Dynamic HTML Setup is a bit different from the regular setup, and it's worth noting that you'll want to manually set up the player if your web page or application loads the video tag dynamically.
You'll need to remove the data-setup attribute from the tag so there's no confusion around when the player is initialized.
To set up the player manually, you'll need to run some JavaScript code after the Azure Media Player JavaScript has loaded and after the video tag has been loaded into the DOM.
This JavaScript code will take the ID of your video tag as its first argument, and an options object as its second argument. You can use this options object to set additional options, just like you can with the data-setup attribute.
The third argument is a 'ready' callback, which will be called once Azure Media Player has initialized. In this callback, 'this' object refers to the player instance.
You can also pass a reference to the element itself instead of using an element ID.
Service Creation
To create a Media Service in Azure, you'll need to follow these steps. First, log in to your Azure account and click on "Create a resource" or search for "Media Service" in the search bar.
You'll then click on "Create" to create a Media Service account, filling in the basic details such as your subscription and resource group name.
Fill in the Media Service account name and location, and then create a storage account with a unique name, selecting the storage account kind and replication type.
You can choose to enable classic APIs, but keep in mind that this will disable advanced security features like managed identities. For best practices, it's recommended to leave this setting off.
To configure advanced settings, you can create a new user-assigned managed identity, but this is optional.
Before creating the resource, review the details you've filled in and verify them to ensure everything is correct. Then, click on "Review and Create" to provision the resource.
Once the deployment is complete, click on "Go to resource" to configure your Media Service.
Services Advantages
Azure Media Services offers a range of advantages that make it an ideal choice for streaming media.
Easy Encoding for Video Sources: With Azure Media Services, encoding video sources is a breeze.
High Security for Copyright Video: Azure Media Services provides high security for copyright video, allowing you to work with sensitive content while protecting your intellectual property.
Audio Encoding is another advantage of Azure Media Services, allowing you to encode audio with ease.
Content Delivery Network (CDN) Support: Azure Media Services enables you to use a Content Delivery Network (CDN) for high-speed content delivery and a better user experience.
Live Streaming Support with High Bandwidth: Azure Media Services supports live streaming with high bandwidth, making it perfect for events and real-time content.
Analytics: Azure Media Services provides in-depth analytics, allowing you to track usage, geo, views streamed, devices, and more.
Content Protection: Azure Media Services offers robust content protection, ensuring that your content is secure and protected from unauthorized access.
Fast and Secure Content Ingest: Azure Media Services offers fast and secure content ingest, making it easy to upload and manage your content.
Here are some of the key advantages of using Azure Media Services:
Video Upload and Encoding
To upload and encode a video for the Azure Media Player, start by selecting the input source as an asset and uploading a new media file. You can choose a file from your local computer or select an existing asset from your source.
Select the video file you want to upload and click on "Upload File." You can also rename the asset name to fit your naming convention.
Once the video is uploaded, select a transform for it by clicking on "Create new" and providing a name for the transform, along with a use case description and transform type, which should be set to "Encoding."
To configure the output, enter a unique output asset name, select the created asset storage account, and give a unique job name. You should also select a job priority of "High" from the dropdown.
Here's a summary of the steps:
- Upload a new media file by selecting the input source as an asset.
- Choose a video file and click on "Upload File" to upload it.
- Once the video is uploaded, select a transform by clicking on "Create new" and providing a name, use case description, and transform type.
- Configure the output by entering a unique output asset name, selecting the asset storage account, and giving a unique job name.
- Set the job priority to "High" from the dropdown.
After deployment, you can copy the streaming URL and open the Azure Media Player to test the video.
Sources
- https://github.com/MicrosoftDocs/azure-media-services/blob/main/media-services/azure-media-player/azure-media-player-full-setup.md
- https://product.imagevault.se/docfx/doc/csharp/mediarenderer/azure-media-player.html
- https://www.geeksforgeeks.org/microsoft-azure-azure-media-service/
- https://medium.com/@bisrate22/adding-azure-media-services-video-to-a-web-page-4a63cc0c7909
- https://github.com/Azure-Samples/azure-media-player-samples
Featured Images: pexels.com