WPF MediaElement + ASX workaround
February 13, 2009 on 5:30 pm | In .NET, General, developpement | 3 CommentsThis i my first English post so sorry for the poor english, and feel free to correct me
I recently had to develop a multimedia XAML application that plays Asx playlists with customs overlays and i faced to differents annoying, unresolved problems related to the MediaElement ASX handling. I discovered that the MediaElement behaves very differently with medias played within an Asx and the same medias played direclty.
My four main problems were :
- The MediaElement keeps the first Asx item aspect radio for the whole Asx. (cannot mix 4:3 and 16:9 medias)
- If you add some still images in the Asx (jpeg), you cannot add animated overlays over it, because the animated items leave ugly black trails over the image…
- The MediaElement doesnt play correctly WMV files inside an Asx. It stops before the end, and the Audio is a little bit desynchronised.
- Maybe related to my last wmv playback problem, sometimes, even with <REPEAT> tags in the Asx, the MediaElement stops during a video.
It took weeks to track and identify these problems…but if you test outside an Asx, all the problems go away, So its clearly related to MediaElement Asx handling. Problem is that MediaElement control is actually very limited.
So i finally decide to create a small AsxController class that simply parse an Asx file and control a specified MediaElement object. Its simple and it works like a charm. Supported Asx items are streams uri, files, but also still images with a specified duration.
Its written in VB.NET but you can easily translate it to C# or something else. It should be compatible with Silverlight.
Grab the source and example code here (rename to .vb) : AsxController.vb
Enjoy !
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^