媒体播放器库在Windows服务中不起作用 [英] Media player library is not working in windows service

查看:58
本文介绍了媒体播放器库在Windows服务中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要求从MP4视频中捕获缩略图,为此我们使用MediaPlayer库,当我作为控制台应用程序运行时,它正在工作,但是如果我将它实现为一个Windows服务并安装它MediaPlayer.Open没有加载该文件。
请在此建议我。下面是代码,我收到的是"读取文件超时"。由于文件未加载且宽度和高度为零。

We have a requirement to capture thumbnail from a MP4 video, for this we used MediaPlayer library which is working when I run as console application, but if I implement it as a windows service and install it MediaPlayer.Open is not loading the file. Please suggest me on this. Below is the code and I am receiving the "Reading of a file did time-out" since the file is not loaded and width and height is zero.

MediaPlayer player = new MediaPlayer()

{

  ScrubbingEnabled = true

};

MediaPlayer player = new MediaPlayer()
{
  ScrubbingEnabled = true
};

player.Open(new Uri(fileInfo.FileName,UriKind.Absolute));

player.Open(new Uri(fileInfo.FileName, UriKind.Absolute));

提前致谢。

 

推荐答案

WMP最有可能需要用户的个人资料,因为它与DMCA绑定。如果您没有以用户身份运行服务,则可能会失败。但不幸的是,您向我们显示了您的错误消息,而不是发生的实际错误。根据您的代码
(请使用代码块编辑器粘贴代码),您要检查宽度和高度为0,但这并没有告诉我们什么是错误的。文件是否存在?您的服务是否可以访问它?你能用标准流
API读取文件吗?
WMP requires a user's profile most likely since it is tied to DMCA. If you're not running your service as a user then it likely will fail. But unfortunately you are showing us your error message and not the actual error that occurred. Based upon your code (please use the Code block editor to paste code) you are checking for a width and height of 0 but that doesn't tell us anything about what went wrong. Does the file even exist? Does your service have access to it? Can you read the file using the standard stream API?


这篇关于媒体播放器库在Windows服务中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆