Search Results for

    Show / Hide Table of Contents

    Html5 video Renderer

    The [Html5VideoRenderer][] will render the YouTube embedded player.

    var video = client.Load<Video>(6405)
        .Resize(200, 200)
        .Single();
    var context = new RenderContext(video);
    
    //You can of course force the Html 5 video renderer if you would like to
    //context.RendererId = YouTubeRenderer.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.)

    Src

    Sets the src of the iframe.

    Default is set to the embed url of the YouTube video

    context.Set(ContextKey.Url, "https://www.youtube.com/embed/dQw4w9WgXcQ");
    

    Width

    Sets the width of the iframe in pixels.

    Default is set to the width of the video

    context.Set(ContextKey.Width, 200);
    

    Height

    Sets the height of the iframe in pixels.

    Default is set to the height of the video

    context.Set(ContextKey.Height, 400);
    
    In This Article
    Back to top (c) Meriworks 2002-2022