Aspose.Slides.Examples.CSharp.Slides.Media.ExtractVideo.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations_Media();

            // ExStart:RemoveNotesFromAllSlides
            // Instantiate a Presentation object that represents a presentation file 
            Presentation presentation = new Presentation(dataDir + "Video.pptx");

            foreach (ISlide slide in presentation.Slides)
            {
                foreach (IShape shape in presentation.Slides[0].Shapes)
                {
                    if (shape is VideoFrame)
                    {
                        IVideoFrame vf = shape as IVideoFrame;
                        String type = vf.EmbeddedVideo.ContentType;
                        int ss = type.LastIndexOf('/');
                        type = type.Remove(0, type.LastIndexOf('/') + 1);
                        Byte[] buffer = vf.EmbeddedVideo.BinaryData;
                        using (FileStream stream = new FileStream(dataDir + "NewVideo_out." + type, FileMode.Create, FileAccess.Write, FileShare.Read))
                        {
                            // ExEnd:RemoveNotesFromAllSlides                            
                            stream.Write(buffer, 0, buffer.Length);
                        }
                    }
                }
            }
            
        }
    }
ExtractVideo