Use custom video thumbnail generation

For each video that you upload in the video library, you can generate a video thumbnail by capturing images from the video. You then select the image you want to use as a video thumbnail in the video galley, for example.

In addition to this thumbnail generation, you can can create an automatic thumbnail generation mechanism for HTML5 videos. You do this by using a third-party component to generate the video thumbnails. For example, you can use the nReco video converter. You add a reference to the nReco assembly and then implement the interface for the custom thumbnail generation. Finally, you replace the default thumbnail generation with the custom one.

To do this:

  1. Download the nReco FFMpeg wrapper from www.nrecosite.com/video_converter_net.aspx
  2. In Visual Studio, add a reference from your project to the NReco.VideoConverter.dll assembly.
  3. In the IVideoThumbnailGenerator interface, implement the CustomVideoThumbnailGenerator method.

    EXAMPLE: For more information about the code of the class, see CustomVideoThumbnailGenerator.cs in Sitefinity documentation-samples on GitHub.

    In the code above, you instantiate object of type FFMpegConverter and you provide the full path to the:

    • Video file name
    • Image thumbnail
    • Frame that is used to create the thumbnail

    The FFMpegConverter object generates a thumbnail that is read as a file stream and an object of type System.Drawing.Image is returned as a result.

  4. In the Global.asax file of your project, replace the default video generation with object factory from the previous step, that is, the custom video generation functionality.

    EXAMPLE: For more information, see Global.asax.cs in Sitefinity documentation-samples on GitHub.

  5. Build your solution.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?