I am working on a silverlight 4 project, where the goal is to play back video from files on the local PC (these files are downloaded first, and then played).
The problem I am having is that for relatively large video files (i.e. 350 MB+), the media element ‘hangs’ for about 8-10 seconds once the source has been set. From what I have read, the MediaElement is reading the content to the end of the file before it is loaded. There seems to be no event for when the mediaElement is in the “Opening” state – only “Opened”. The delay seems to be between setting the source of the media element and the media element hitting the “Opened” state.
Is there a way I can work around this? At the very least is there a way that I can prevent the mediaelement from hanging the application while it loads?
I put the SetSource into a background worker and then called BeginInvoke on the UI dispatcher and it seems to have done the trick. Was calling the wrong Invoke method.