VideoFrame PlayMode Auto Is Not Working after Inserting Video to a Presentation in C#

Hi
I created an empty Presentation with a VideoFrame and PlayMode to Auto.
First problem: the video shows “No Image” frame
Second problem: the autoplay is not working !

My code:

Presentation pres = new Presentation();
pres.Slides.RemoveAt(0);

//Add the main slide
ISlide sld = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);

// Embedd vide inside presentation
IVideo vid = pres.Videos.AddVideo(new FileStream(v.FullName, FileMode.Open), LoadingStreamBehavior.ReadStreamAndRelease);

// Add Video Frame
IVideoFrame vf = sld.Shapes.AddVideoFrame(0, 0, pres.SlideSize.Size.Width, pres.SlideSize.Size.Height, vid);

// Set video to Video Frame
vf.EmbeddedVideo = vid;

// Set video settings
//vf.Volume = AudioVolumeMode.Loud; //keep original
vf.PlayMode = VideoPlayModePreset.Auto;
vf.PlayLoopMode = true;
vf.RewindVideo = true;
vf.FullScreenMode = true;
vf.Rotation = 0;
vf.HideAtShowing = false; //hide when cannot play

//set slide sequence
ISequence sequence = sld.Timeline.MainSequence;
//clear effects
sld.Timeline.MainSequence.Clear();
// Adds Fade animation effect to shape
sld.Timeline.MainSequence.AddEffect(vf, EffectType.MediaPlay, EffectSubtype.None, EffectTriggerType.WithPrevious);

//clear interactive sequences
ISequenceCollection interactiveSequences = sld.Timeline.InteractiveSequences;
Debug.WriteLine(interactiveSequences);
interactiveSequences.Clear();

Normally, when you do this in PowerPoint with a classic video insertion and same animations, this is working.

Have an idea please ?
Thanks,
Regards

@pcaillol,
Thank you for contacting support.

Please check your results using the latest version of Aspose.Slides if it is possible. If the issue persists, please share the following additional data and information:

  • input video file
  • output presentation file
  • screenshot showing the problem
  • OS version on which the code was executed
  • .NET target platform in your app

Hi Andrey

I am always using latest version of Aspose.Slides: 22.12 now.
You can take any video you want, result is the same. PowerPoint has no right to control video playback.
OS version: windows 10
.NET: 4.7

Here are the file :
Videos.zip (734.9 KB)

After insertion, first frame is shown as “no image” picture instead of video first frame.
And video not playing automatically on slideshow as it should !

Could you help please ?
Thanks, regards

@pcaillol,
Thank you for the files and information about your environment.

You can set a poster image for the VideoFrame object like this:

FileStream imageStream = File.OpenRead(folderPath + "image.png");
vf.PictureFormat.Picture.Image = pres.Images.AddImage(imageStream);

Unfortunately, I was unable to reproduce the problem with the Auto play mode. The video plays automatically in Slide Show mode on my end. Files.zip (1.8 MB). Please check the problem carefully again and provide more information to reproduce the problem.

Documents: Video Frame

Please also note that you shouldn’t set the video to the EmbeddedVideo property:

// vf.EmbeddedVideo = vid;

Hi Andrey, thanks for your quick return.
ok for the poster but couldn’t Aspose set automatically the poster as the first frame if not provided ?
For the AutoPlay, my bad: ShowAnimation was set to false.
Thank you so much, will continue investigate.
Regards

@pcaillol,
If I understood you correctly, you would like to specify the first frame from the video as a poster image for the VideoFrame object. Could you please confirm?

Exactly ! Instead, i did it with ffmpeg command line.
Thank you Andrey, enjoy your night

@pcaillol,
Thank you for the confirmation. I will get back to you soon.

@pcaillol,
I’ve added a ticket with ID SLIDESNET-43706 to our issue-tracking system. Our development team will consider implementing such a feature. You will be notified when a new release of Aspose.Slides with the update is published.

I roughly understand what you mean, and it seems to me that the problem could be either in the audio track or in the video format. In any case, if I were you, I would change the sound format according to the instructions given here. If this does not help, then try changing the video format or resolution; this is also a very common problem.

@gulshanm,
Thank you for the message. Regarding the issue described in this thread, the frame can be extracted from the video using a third-party code and used as a poster image as shown above.