Skip to main content

YouTube

Wisej.Web.Ext.YouTube is reserved for a future YouTube player control. In the 4.1 source, YouTube is only a placeholder: it doesn't derive from a Wisej.NET control, it has no properties, methods or events, and it isn't published on NuGet.

Work in progress

There's nothing to install or use yet. The namespace is listed in the API reference only because the assembly is part of the 4.1 build. Don't take a dependency on it, because its API will change when the control is implemented.

Embedding a YouTube video today​

You don't need an extension to show a YouTube video. YouTube's embeddable player is a web page, so an IFramePanel can host it. Use the youtube-nocookie.com domain to avoid tracking cookies until the user plays the video:

var player = new IFramePanel
{
Dock = DockStyle.Fill,
Url = "https://www.youtube-nocookie.com/embed/VIDEO_ID?rel=0"
};
this.Controls.Add(player);

Replace VIDEO_ID with the id from the video's URL (the part after watch?v=). YouTube's player parameters go in the query string, for example autoplay=1&mute=1 (browsers only autoplay muted videos), start=90 to start at 1:30, or controls=0.

tip

If you need to control the player from the server (play, pause, seek, react to the end of the video), use the YouTube IFrame Player API in a Widget, which lets you load a third-party script and exchange events with your server code.

API reference​