Like many others here, I was plagued with the Sonos Illegal MIME type error. I read and watched many threads but could not find a solution, until today. My error only occured randomly, during our Morning Update. Evening Updates and all other spoken announcements worked well. But why only sometimes for the Morning Update? Turns out that one of the items that gets spoken (when the conditions are right) contained a colon ( : ) . That one punctuation mark was the cause of the failure.
Some background; I use a template to build my updates. We have 3 major spoken updates. A Morning for myself and my wife which comes from one template and an Evening which comes from another template. Therefore two sensors (sensor.am_update) and (sensor.pm_update). Both of these can be tested in the Template section of the Developer Tools and always worked just fine. The automation to play the updates gets the message data from the correct sensor and pushes it to a Sonos_Say script. I use Google as my TTS provider and usually everything just works.
As my wife has become more interested in the information the Updates provide, she has asked for additional items that were important to her. The changes I made about a month ago ultimately lead to my Illegal Mime type errors, but not right away. It took several weeks for the conditions to be just right where the colon was introduced, and it took me another several days to understand what and why it was happening.
Moral of the story is CHECK YOUR TEXT STRING before sending it to be spoken. Replace any nefarious punctuation with either a space character or nothing at all. Google TTS will parse the string just fine if there is missing punctuation, but the media_player.play_media will fail if there is punctuation that causes the message string to become an invalid string, in my case the colon. I ended up stripping out all unnecessary punctuation, leaving only the commas and periods required for smooth speech.
Although this may not be the solution for everyone, it certainly did work for me and I hope it helps others. For me, a seemingly benign change several weeks prior went unseen for weeks then popped up as a difficult error to track down.
Art
aka kartcon