0

I am trying to create a PowerPoint, insert (embed) a video as mediaobject / shape and then, when playing I would love it to start playing directly. However, it doesnt play directly, it waits for me to give a trigger.

PowerPoint.Application _application = new PowerPoint.Application();
            PowerPoint.Presentation _presentation = _application.Presentations.Add(MsoTriState.msoFalse);
            PowerPoint.CustomLayout customLayout = _presentation.SlideMaster.CustomLayouts[PowerPoint.PpSlideLayout.ppLayoutTitle];

            PowerPoint.Slide slide = _presentation.Slides.AddSlide(1, customLayout);
            
            PowerPoint.Shape shape = slide.Shapes.AddMediaObject2(filename, MsoTriState.msoFalse, MsoTriState.msoTrue, 0, 0);
            shape.AnimationSettings.PlaySettings.PlayOnEntry = MsoTriState.msoTrue;

            shape.Left = _presentation.PageSetup.SlideWidth * .5f - shape.Width / 2;
            shape.Top = _presentation.PageSetup.SlideHeight * .5f - shape.Height / 2;
 
            slide.FollowMasterBackground = MsoTriState.msoFalse;
            slide.Background.Fill.ForeColor.RGB = 0;

            PowerPoint.SlideShowSettings settings = _presentation.SlideShowSettings;
            settings.ShowType = PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
            settings.ShowPresenterView = MsoTriState.msoTrue;
            PowerPoint.SlideShowWindow sw = settings.Run();
            _presentation.SlideShowWindow.View.FirstAnimationIsAutomatic();

Now, in PowerPoint I notice the option for the animation when to start. Is there a method to set this option within c#, or what else can I try to start the video automatically?

enter image description here

Mart
  • 475
  • 4
  • 21

0 Answers0