Issue in converting ppt to video with Microsoft interop library

192 Views Asked by At

I am using Microsoft Interop Library to create a Video from a powerpoint presentation.The power point presentation contains internal embedded videos and animations.

The Interope library works perfectly well and we are able to create the video successfully when we run the application in the Visual studio. When we deploy the code in the IIS Server the Video creation still works successfully however, the Videos embeded internally within the presentation do not work.

Does any one have any idea about this behaviour of IIS and Visual Studio ? We have checked the Mime types in IIS and all extensions .mov. .mp4 are already present

Here is the code :

var videoRelativePath = "\\UserData\\User_" + templateObj.UserId + "\\VideoTemplate\\Vid_" + timeStampNew + ".mp4";
            var videoPath = _environment.ContentRootPath + videoRelativePath;
            ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "Initializing powerpoint application for video creation");
            Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
            Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
            ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "OPening the presentation Instance");
            Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(
              videoFileNameForConversion,MsoTriState.msoFalse,MsoTriState.msoFalse,MsoTriState.msoFalse);
            //System.Threading.Thread.Sleep(180);
            oPres.UpdateLinks();
            try
            {
                //CreateVideo(string FileName, bool UseTimingsAndNarrations, int DefaultSlideDuration, int VertResolution, int FramesPerSecond, int Quality)
                ErrorLoging.LogMessageInLogFile(System.DateTime.Today.ToLongTimeString() + " - " + "Calling CreateVideo ");
                oPres.CreateVideo(videoPath);
                while (oPres.CreateVideoStatus == Microsoft.Office.Interop.PowerPoint.PpMediaTaskStatus.ppMediaTaskStatusInProgress || 
                oPres.CreateVideoStatus == Microsoft.Office.Interop.PowerPoint.PpMediaTaskStatus.ppMediaTaskStatusQueued)
                {
                    System.Threading.Thread.Sleep(10000);
                }
             }

            catch (Exception er)
            {
                ErrorLoging.LogErrorInLogFile(er);

            }
0

There are 0 best solutions below