我正在使用Microsoft Interop Library从PowerPoint演示文稿创建视频。PowerPoint演示文稿包含 内部嵌入式视频和动画。
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);
}