How to Add Video in Presentation using C#

In this topic, we will exhibit how to add video in Presentation using C# along with the steps to set up the environment to use the example code. You can use the application in any .NET configured environments inside Linux, Windows or macOS and with no dependence any third-party software or an Interop library to embed video in PPTX using C#.

Steps to Insert Video in Presentation using C#

  1. Configure the application to install Aspose.Slides for .NET package from NuGet to add a video frame
  2. Create an empty presentation using the Presentation class object to embed a video inside the presentation
  3. Access the first slide inside the presentation slides to add a video frame
  4. Load the video file and add inside the presentation slide video frame
  5. Set the video frame properties for volume and auto play
  6. Save the presentation with an embedded video on the disk

By using the above steps in C# inserting video in PowerPoint presentation can be easily managed with the help of simple API calls, whereby the process is initiated by creating a default presentation using the Presentation class and getting access to first slide inside the presentation. Then the source video file is loaded from the disk and added inside the video frame shape for the slide. Finally, the video frame properties for auto playing and audio level are set before saving the presentation with an embedded video on the disk.

Code to Insert Video in Presentation using C#

In C# saving MP4 video in PPT presentation can be easily managed using a very simple API calls as specified in above example. We have used IVideoFrame that also let you set the properties like rewind mode, play mode, play video in a loop and hiding a video to name a few. You can also use an existing presentation to embed a video inside the presentation slide. Once the video will be embedded the presentation can either be saved on the disk or inside a memory stream for web based application use as well.

This tutorial focuses on how to insert video in Presentation using C#. If you want to learn about hiding a slide inside the presentation, refer to the article on how to hide a slide in presentation using C#.

 English