用于创建视频缩略图的 WCF 服务
我正在尝试创建一个 WCF 服务,该服务利用服务器上的 WPF MediaPlayer 为用户上传的视频生成缩略图。 我发现了很多关于如何渲染帧并将其保存到文件的 oif 信息。 但问题是关键事件 MediaOpened (实际上没有任何事件)我需要绑定到 doesn't - 编辑火。
有谁知道如果在 WCF 服务的上下文中使用 WPF MediaPlayer 事件是否不会触发?
谢谢 迈克尔
I am trying create a WCF service that leverages the WPF MediaPlayer on the server to generate thumbnails for a video that a user uploads. I found a lot oif info on how to render a frame and save it to a file. But the problem is the key event MediaOpened (actually none of the events) I need to tie into doesn't - EDIT fire.
Does anyone know if the WPF MediaPlayer events do not fire if used ion the context of a WCF service?
thanks
Michael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我决定尝试使用 Expression Media Encoder 2 SDK,效果非常好。
从视频生成缩略图的代码非常少 - 这是一个片段
{
队列_positionsToThumbnail = new Queue();
Microsoft.Expression.Encoder.MediaItem 视频 = new Microsoft.Expression.Encoder.MediaItem(fileName);
}
I decided to try and use the Expression Media Encoder 2 SDK and it worked great.
Very little code to generate thumbnails from a video - here is a snippet
{
Queue _positionsToThumbnail = new Queue();
Microsoft.Expression.Encoder.MediaItem video = new Microsoft.Expression.Encoder.MediaItem(fileName);
}
您可能需要在屏幕上呈现数据,以便触发这些事件——这一切都与 WPF 可视化树的一部分相关; 当作为服务运行时则不然。
您可以尝试多种方法来解决此问题,但所有这些方法都很复杂,而且可能无法扩展。 我建议使用普通的 Windows Media API(来自 Windows Media SDK)来深入了解它。
You will likely need to render the data on screen, for those events to be fired -- it's all tied to being part of the WPF visual tree; which when running as a service it is not.
There are many ways you could try to resolve this, all of which are convoluted, and likely not going to scale. I suggest using the normal windows media API's (from the Windows Media SDK) to get to the bottom of it.