I was wondering if the format is really supported. I am developing a simple WP7 application which contains a MediaElement such as the one shown bellow:
For the sake of testing, I subscribed for the MediaFailed event and it fires always.
If I try to open the file in the browser, it opens successfully. If I p开发者_运维技巧ut the same MediaElement in a regular SL application - it runs. If I give some .wmv file to the MediaElement in the WP7 app - it runs. (http://files.ch9.ms/ch9/5baa/ea2aeba2-9dcc-4565-942a-9e6101655baa/DevKid_ch9.wmv).
Got any ideas?
One thing to watch is that video won't play if you're connected using USB to the Zune software.
I just tried your video using this IronRuby script - it plays fine.
For more help, you can check out the Channel9 application on codeplex - that works well.
Windows Phone 7 supports the MP4 container, but only supports a certain set of codecs. I believe this list is a pretty accurate list of what's supported.
It seems that you can't play mp4 files when Zune is running. However, you can still debug your application by connecting to your phone using WPConnect.exe which by default is installed to C:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect. You'll need to close Zune before running WPConnect, but after you have run it, you should be able to F5 in Visual Studio and the the debugger running your code on the phone.
One other thing to keep in mind is that Windows Phone 7 requires the file (or URL) extension to match with the codec, so for mp4 files you need to have file name ending with .mp4, otherwise it won't play.
精彩评论