Adding Audio Frame to Slide in Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Adding Audio Frame to Slide
Aspose.Slides for Java allows developers to add audio files in their slides. These audio files are embedded in the slides as Audio Frames. An Audio Frame contains the embedded audio file.
Java
//Instantiate Prsentation class that represents the PPTX
Presentation pres = new Presentation();
//Get the first slide
ISlide sld = pres.getSlides().get_Item(0);
//Load the wav sound file to stram
FileInputStream fstr = new FileInputStream(new File("logon.wav"));
//Add Audio Frame
IAudioFrame af = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr);
//Set Play Mode and Volume of the Audio
af.setPlayMode(AudioPlayModePreset.Auto);
af.setVolume(AudioVolumeMode.Loud);
//Write the PPTX file to disk
pres.save("AsposeAudio.pptx", SaveFormat.Pptx);
Download Running Code
Download Sample Code
For more details, visit Adding Audio Frame to Slide.