Free Support Forum - aspose.com

Finding Filename of Media File Within Presentation

Hi,

I am using this componenet to allow users to build their own presentation by picking slides from a pool of source presentations.

Using the CloneSlide functionality i am able to do nearly everything. The one thing I am stick on is that some of the slides contain video, the video source files are in the same folder as the presentation.

In order for me to copy the video slide from the source to the user presentation I just need to find the filename of the video in the original slide however this is proving difficult. I am unable to locate the video filename anywhere within the shapes or placeholders. I can locate an OleObjectFrame on 1 video slide but am still unable to find a mention of the filename. I have been searching the slide object through the debug in VS.Net but no luck.

How can i find the filename of the video in a source presentation?

Thanks in advance

Panksy

If video was inserted as OLE object then you can find file name in the
OleObjectFrame.LinkPathLong or OleObjectFrame.LinkPathShort properties.

If video was inserted as video then it should be recognized as VideoFrame.
The problem is not all types of video files can be recognized right yet.

The presentations have mpg video. I am not able to capture anything from the LinkPath properties as they are always empty. Does this mean that mpeg video is not recognaised by the system?

In Powerpoint itself I created a blank presentation, added a new Content slide and clicked the Insert Media Icon to add an mpg video.

When I examine this slide object in VS.Net debug using SlidePresentation.Slides[0] there appears to be 1 Shape which is a PictureFrame.

SlidePresentation.Slides[0].Shapes[0] {Aspose.Slides.PictureFrame} Aspose.Slides.PictureFrame

If i try to cast this as a VideoFrame i get errors in the properties:

FileName string

I assume this means that the mpg is not being recognaised as a video?

If I add the videoframe to a presentation in code using:

Presentation newPres = new Presentation();
Slide newVideoSlide=newPres.AddBodySlide();
newVideoSlide.Shapes.AddVideoFrame(200,200,3200,2400,@"C:\ppttest\vidtest.mpg");

then save the ppt to disk,. then examine it in vs.net debug, I am able to see the videoframe and its filename fine.

What is the best way to add a video to a slide in Powerpoint so that the Aspose.Slides component will understand it as a VideoFrame in the code?

Thanks

Yes, your video is not recognized. Now Aspose.Slides can recognize AVI video only.
MPG stored in another record type and is not implemented yet.

I managed to access the video filename of the shape item by doing a 'DirectCast' in VB.Net as opposed to CType. This is to cast the item into a VideoFrame. Using DirectCast however you will need to check for the Item type prior to the actual cast -

Dim vf As Aspose.Slides.VideoFrame

If TypeOf sl1.Shapes.Item(i) Is Aspose.Slides.VideoFrame Then

vf = DirectCast(sl1.Shapes.Item(i), Aspose.Slides.VideoFrame)

strFilename = vf.FileName

End If