Monday, November 11, 2013

Why MP3s may not play on Windows Phone

What follows is the result of at least 4 man-days worth of effort involving at least 6 different people. It ended with a solution that had people in disbelief at the simplicity of the workaround and the probable cause.

For the most part playing music from within an app is simple and there are lots of ways to do it: background audio; MediaElement; or launcher.

Sometimes things go wrong though and last week was one such time. I was asked to look at a bug in a new app that plays music. The bug was that for some tracks there is an obscure error when playing from isolated storage. If the file is copied to the PC from isolated storage then it plays fine though.

In the exception, with it's entirely external call stack, we could see a HRESULT of 0xC00D36C4 or a message of -1072875836. Neither of which are particularly helpful.

Even the internet couldn't give us much help. All we could find was a constant name of MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED for the hex value but that was in a streaming video context. This didn't really help at all.
Beyond that we found records of bugs relating to playing some audio files on Windows Phones but these had all been closed and marked as "no repro".

I looked at files sizes when the tracks were downloaded on the phone and on a PC and everything looked the same.

After much experimentation I realised there was a step in our reproduction process that hadn't been fully explored.
When files are saved on the phone they were given name based on their identifier. This meant that in IsolatedStorage they looked like: "/tracks/tr123456".
When copied to the PC we were renaming the file to include an extension (of ".mp3") so we could double click them to try and start playback.
Starting to approach the limit of possibilities, I wondered what would happen if we tried to play the file with the ".mp3" extension on the phone. Low and behold the track started playing on the phone without issue.

So, the fix?
Just make sure that the files all had a ".mp3" extension on them and they all played fine. Yes, really that simple.

Why does this solution work?
Here's what I think is happening:
Without a file extension to tell the internal media stack what format the file is it guesses, probably based on looking at part of the files contents. In the instances where the file will not play correctly it is probably assuming that it is not a regular MP3 file, even though it is, and so tries to play it assuming a different format.
I must admit that my knowledge of the internals of the MP3 format is non-existent and my knowledge of the internals of the media playback stack is even smaller but this seems to be the most likely theory.

What can we learn from this?
Always include a file extension on your files. Not only does it make it easier/clearer for people to see what type they are, it also help the OS know how to read/play/process them.


  1. Subsequent to installing the ultra-modern variety in your follow restore typically the gaskets not to mention restore the outcome spine. Make certain typically the tag heuer replica sale follow might be missions previously switching the outcome spine. It again definitely isn't a good idea to change typically the variety exclusively on your own for the reason that these are definitely sophisticated timepieces. And yet for everybody who is convinced that anyone can take on the job as they are calm not to mention peaceful an adequate amount of typically the rolex replica sale financial risk is valued at the dollars you will put away to compensate you to definitely restore typically the variety suitable for you. Ensure you destination some light small cloth downwards before commencing in order that this is not to abrasion the facial skin of this follow not to mention have a smallish screwdriver. In the home . recommended that you pay for numerous supplement iwc replica uk gaskets in the case many destroy when ever wiping out not to mention ensure you chose the best particular variety for ones style of Gucci follow you possess. Having electricity items happens to be an inevitable matter through modern society. Throughout louis vuitton replica sale when real, we've been encircled from electro-magnetic spheres assigned apart from items prefer microwaves, cell cords, radios, portable computers, televisions, and others. A particular electromagnetic particular field distributes in any system described as electromagnetic radiation. Primarily, a particular electromagnetic particular field happens to be an section through spot who energy source hands throughout, that's involved with electrically imposed particles.