Free Support Forum - aspose.com

Issue on embedding video in ppt


#1

Hi Aspose Team!!

I have created a PPTX file through Aspose.slide lib. In that PPTX file, I have attached/embedded video. Here is my code:-

//Create a presentation
presentation = new Presentation();
slide1 = presentation.getSlides().get_Item(0);

//Add Video Frame
String videoUrl = "/home/pr/Desktop/test.mp4";
IVideoFrame vf = slide1.getShapes().addVideoFrame(50, 150, 300, 150, videoUrl);

//Set Play Mode and Volume of the Video
vf.setPlayMode(VideoPlayModePreset.Auto);
vf.setVolume(AudioVolumeMode.Loud);

//Set default image if in case the video does not appear.
IPPImage img =null;
img = presentation.getImages().addImage(new FileInputStream(new File("/home/pr/Desktop/cow.jpeg")));
vf.getPictureFormat().getPicture().setImage(img);

//Write the presentation to disk
try{
      presentation.save("/home/pr/Desktop/as.pptx",SaveFormat.Pptx);
}catch(Exception e){
    e.printStackTrace();
}

My issue is that When I’m opening this PPTX file in Libre Office/MS Office 2010/2008 then my video is not playing. The only default image is displaying. Could you help me what is the error in my code OR if there are some PP tools, who can handle video inside the slide, then please explain it

Thanks in Advance.


#2

@AbhiG,

I have observed the sample code shared and there seems no issue in the code. Can you please provide the source code, sample video and generated output with us that we may test on our end to help you further.


#3

Sure!!
I have shared with generated PPTX file and video and image that I had embedded with PPTX

test.zip (990.1 KB)

It would be great if you also guide me that which format of video is suitable for embedding with PPTX.
And you have already seen my code so you need again ?


#5

@mudassir.fayyaz Any luck!!!


#6

@AbhiG,

I have worked with files shared by you and it seems to be an issue with API while playing the added video. An issue with ID SLIDESJAVA-37603 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#7

Thanks @mudassir.fayyaz!!


#8

@AbhiG,

You are very welcome. Please feel free to contact us anytime if there is any issue.