Insert Video Thumbnail when Using AddVideoFrame Method in Java

Hello,

when inserting a video through addVideoFrame (using JAVA) a media player is inserted (as is written in the doc). But I would like to have the first frame of the video visible before the movie starts, just as it works when inserting a video in PowerPoint itself… Is there any way to do this?

I tried to work with the PlaceHolder, but got a NullPointerException on the getFillFormat(), so I wasn’t able to insert an image into it. Am I missing something?

Regards,

Aart Jan

Hello Aart,

Thanks for your keen interest in Aspose.Slides

I regret to inform you that currently this feature is not supported by Aspose.Slides for Java. A requirement with ID 14178 has been logged in our issue tracking system to support this feature. This thread has also been associated with this issue ID, so that you can be automatically notified as soon as this feature becomes available.

We are sorry for the nuisance.

@mudassir.fayyaz Is this feature supported in Aspose.Slides for .NET? I’m currently using version 18.9.

@suzify,
With Aspose.Slides for .NET, you cannot set the first frame from a video as an image to be visible before the video starts but you can set any image instead. If you extract the first frame from the video using a third-party library, you will be able to use it.

using (Presentation presentation = new Presentation())
{
    ISlide firstSlide = presentation.Slides[0];

    using (Stream videoStream = new FileStream("video.mp4", FileMode.Open, FileAccess.Read))
    using (Stream imageStream = new FileStream("image.png", FileMode.Open, FileAccess.Read))
    {
        // Add the video to the presentation resources.
        IVideo video = presentation.Videos.AddVideo(videoStream);

        // Add the image to the presentation resources.
        IPPImage image = presentation.Images.AddImage(imageStream);

        // Add the video to the first slide.
        IVideoFrame videoFrame = firstSlide.Shapes.AddVideoFrame(20, 20, 300, 200, video);

        // Set the image to be visible before the video starts.
        videoFrame.PictureFormat.Picture.Image = image;
    }

    presentation.Save("output.pptx", SaveFormat.Pptx);
}

More examples: Video Frame|Aspose.Slides Documentation