Adding Media Player using Aspose.Slides

Aspose.Slides - Adding Media Player

ActiveX control are used in presentations. Aspose.Slides for Java lets you add and manage ActiveX controls, but managing them is bit trickier and different from normal presentation shapes. The support for adding Media Player ActiveX control has been added in Aspose.Slides. Remember, ActiveX controls are not shapes and are not part of the presentation’s IShapeCollection but the separate IControlExCollection. This article shows how to work with them.

Java

 //Create empty presentation instance

Presentation newPptx = new Presentation();

//Adding the Media Player ActiveX control

newPptx.getSlides().get_Item(0).getControls().addControl(ControlType.WindowsMediaPlayer, 50, 50, 550, 300);

//Access the Media Player ActiveX control and set the video path

newPptx.getSlides().get_Item(0).getControls().get_Item(0).getProperties().set_Item("URL", "C:\\Wildlife.wmv");

//Save the Presentation

newPptx.save(dataDir + "AsposeMediaPlayer.pptx", SaveFormat.Pptx);

Download Running Code

Download Sample Code