سؤال

I have a Windows Media Object in a C# WebBrowser control. We've got what are basically .AVI files, and the files have been given a custom header. In order to play these we have a custom DirectShow filter.

The videos can be played back inside Windows Media Player, and inside a Windows Media Player Object in IE9 on Windows 7, and in IE8 on Windows XP.

The video playback also succeeds inside the C# embedded WebBrowser control in XP, but not on Windows 7. When trying to use the Windows Media Player Object in the C# WebBrowser control in Windows 7 we receive a message stating: "Windows Media Player cannot play the file. The player might not support the file type or might not support the codec that was used to compress the file."

It's exactly the same code each time, so does anyone have any idea why the specific combination of Windows 7, the WebBrowser Control, and Custom DirectShow filters fails to playback the video, when everywhere else it functions correctly?

هل كانت مفيدة؟

المحلول 2

The problem was that our DirectShow Filter was only built as an x86 DLL. For some reason the WebBrowser control in C# defaults to using a 64 bit IE backend if available, and that version wouldn't work with the x86 DLL we built, because the WMP Object only looked into registry entries for 64-bit versions of Filters.

By setting your build configuration in Visual Studio to target an "x86" CPU rather than "Any CPU" for the application that runs the WebBrowser control, you can ensure that even on a 64-bit version of Windows that the WebBrowser control uses the 32-bit back end.

Seems quite a few people had the same problem with Flash before a 64-bit build was available for it.

نصائح أخرى

You need to do more debugging to get an idea what is going on. First of all, you need to check out if playback at all picks up your DirectShow filter, what kind of methods are called, are there any errors involved, in what way this is different from other systems where playback takes place successfully.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top