1

我正在使用 Microsoft 互操作库从 powerpoint 演示文稿创建视频。power point 演示文稿包含内部嵌入的视频和动画。

Interope 库运行良好,当我们在 Visual Studio 中运行应用程序时,我们能够成功创建视频。当我们在 IIS 服务器中部署代码时,视频创建仍然可以成功,但是演示文稿内部嵌入的视频不起作用。

有人对 IIS 和 Visual Studio 的这种行为有任何想法吗? 我们检查了 IIS 中的 Mime 类型和所有扩展名 .mov。.mp4 已经存在

这是代码:

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);

            }
4

0 回答 0