Azure Media Player (MediaRenderer)
BREAKING CHANGES
From 2024-07-01, the Azure Media Player will be deprecated and replaced by the Papirfly Play Player. This is due to the fact that Azure Media Player is no longer supported by Microsoft and it's End of life has been reached.
The AzureMediaPlayerMediaRenderer will render the Azure media player compatible with ImageVault Video.
var video = client.Load<Video>(6405)
.Resize(200, 200)
.Single();
var context = new RenderContext(video);
//You can of course force the azure media player renderer if you would like to
//context.RendererId = AzureMediaPlayerMediaRenderer.RendererId;
var html = MediaRenderer.Render(context);
The following context values can be used to control the behavior of the player. (In addition to the generic context keys that can be set to all renderers.)
Controls
Set this if video controls should be visible for the video.
Default is true.
context.Set(ContextKey.Controls, false);
Autoplay
Set this if autoplay should be activated for the video.
Default is false.
context.Set(ContextKey.Autoplay);
Muted
Set this if audio should be muted from start. In some cases, muted is needed to ensure that autplay works in most browsers.
Default is false.
context.Set(ContextKey.Muted);
Loop
Set to true if video should be looped during playback
Default is false.
context.Set(ContextKey.Loop);
Poster
Set to the url of an image that should be displayed before the video starts playing.
Default is not set.
context.Set(ContextKey.Poster, "https://www.example.com/poster.jpg");
ActiveTextTrackLanguage
Set active text track language. Enter one or more language codes for the text tracks. The first language that matches any text track will be selected as the active text track. This setting will override the user selected language. If not set, the first available text track will be used. Languages is specified by language code in a comma separated list.
Default is not set.
context.Set(ContextKey.ActiveTextTrackLanguage, "sv,en");
DisableTextTracks
Set this to disable any text tracks on the video.
Default is false.
context.Set(ContextKey.DisableTextTracks);
DisableFullscreen
Set this to disable the full screen feature. Users will not be able to trigger full screen display of the video.
Default is false.
context.Set(ContextKey.DisableFullscreen);
DisableLoaderIcon
When the video is loaded, a loader icon is displayed. Set this to hide the loader icon.
Default is false.
context.Set(ContextKey.DisableLoaderIcon);
Width
Sets the width of the player in pixels. Will be translated to the width attribute of the video HTML element.
Default is set to the width of the video
context.Set(ContextKey.Width, 200);
Height
Sets the height of the player in pixels. Will be translated to the height attribute of the video HTML element.
Default is set to the height of the video
context.Set(ContextKey.Height, 400);
EmbedResizeMode
Instructs the player on how to resize the player depending on the parent controller.
- Default - player will be sized according to the Width and Height settings, or if not set, the size of the video itself.
- ScaleToFit - player will be resized to fit inside the parent html element (or window if added directly inside the body tag). The video player will be centered in the parent container.
- ScaleToFill - player will be resized to fill the whole parent html element (or window if added directly inside the body tag). Video will be centered and cropped accordingly to fill the entire area. (areas for controls, text and other features might be hidden in this mode)
Default is EmbedResizeMode.Default
context.Set(ContextKey.EmbedResizeMode, EmbedResizeMode.ScaleToFill);
DisplayDuringInit
When the player is loading in the browser, it's normally hidden to let it load before displaying any content and resizing the player depending on the loaded media. If this is set, no hiding of the player is performed.
Default is false
context.Set(nameof(AzureMediaPlayerSetupOptions.DisplayDuringInit));
InitBackground
During player initialization and loading of media content, the player is hidden (see DisplayDuringInit). During this time, the initBackground is set as css style background
on the parent element (if set). If left blank, no change will be done to the parent element css style background, during initialization.
Default value is not set.
context.Set(nameof(AzureMediaPlayerSetupOptions.InitBackground),"rgba(0,0,0,0.3)");
NotSupportedText
The text displayed to the user if the browser is unable to display the player for some reason.
Default value is documented in NotSupportedText
context.Set(nameof(AzureMediaPlayerMediaRenderer.NotSupportedText), "Ye browser is too old");
Dynamic
Normally, the player is rendered onto the html page and when the page is loaded in the browser, javascript initiation of the player is triggered when the document has been loaded (document.load). If the html is added to the page, after the document.load has been triggered, the dynamic key need to be set to add javascript to the output html of the renderer that will initiate the player.
Default is false
context.Set(ContextKey.Dynamic);
Debug
If set, debug output is written to the javascript console in the browser
context.Set(ContextKey.Debug);
Skin
If set, adds the supplied value to the existing class
attribute to be able to select what skin should be used on the player.
More information about this can be found in the Video player configuration section.
context.Set(ContextKey.Skin,"amp-flush-skin");
PlaysInline
From version IV v5.30 and ImageVault.Client v6.4
If set, the playsInline attribute in the video tag will be set to true. This will allow the video to play inline on iOS devices.
context.Set(ContextKey.PlaysInline);