“MediaElement.SetSource” throws “AE_INVALID_FORMAT_ERROR” when setting “Stream” sources
When reading a stream from a location such as a media resource object, and then calling “MediaElement.SetSource” may return “AE_INVALID_FORMAT_ERROR”. If you construct a “MemoryStream” using your “Stream” object (reading all bytes and writing to a MemoryStream), then “SetSource” works fine.
This issue may ocur when the “Stream” object is not seekable. A “MemoryStream” will always be seekable and will always work with “SetSource”. "SetSource" always expects a seekable “Stream”.
Comments
- Anonymous
January 08, 2009
PingBack from http://www.codedstyle.com/%e2%80%9cmediaelementsetsource%e2%80%9d-throws-%e2%80%9cae_invalid_format_error%e2%80%9d-when-setting-%e2%80%9cstream%e2%80%9d-sources/