Table of Contents

Class VideoViewModelExtensions

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll

Provides extension methods for the VideoViewModel class.

public static class VideoViewModelExtensions
Inheritance
VideoViewModelExtensions
Inherited Members

Methods

GetVideoType(VideoViewModel)

Gets the video type of a VideoViewModel.

public static string? GetVideoType(this VideoViewModel video)

Parameters

video VideoViewModel

The VideoViewModel instance.

Returns

string

The video type as a string, or null if the video is null or the type is not available.

Determines whether the video path of a VideoViewModel is an external link.

public static bool IsExternalLink(this VideoViewModel video)

Parameters

video VideoViewModel

The VideoViewModel instance.

Returns

bool

True if the video path is an external link; otherwise, false.

ToEmbedUrl(VideoViewModel)

Converts the video path of a VideoViewModel to an embed URL for YouTube and Vimeo urls.

public static Uri? ToEmbedUrl(this VideoViewModel video)

Parameters

video VideoViewModel

The VideoViewModel instance.

Returns

Uri

The embed URL as a Uri object, or null if the video is null or the path is an invalid url. https://www.youtube.com/watch?v=5t1fW3KG920 becomes https://www.youtube.com/embed/5t1fW3KG920 https://vimeo.com/123456789 becomes https://player.vimeo.com/video/123456789 If the video path is not a YouTube or Vimeo URL, the video path is returned as a URI. If the video path is not a valid URI, null is returned.

To top