# Friday, November 05, 2010

Playing Audio with Silverlight on Mac OSX

So, who out there already knew what a coworker and I just learned via trial and (mostly) error?

Jim and I were working on a simple Silverlight audio player with a couple of tracks, nothing elaborate whatsoever. It runs great on Windows. Yet, it failed to play audio on Mac OSX, regardless of browser.

After a bit of voodoo, standing on one foot and other meaningless postulates, Jim says, “Hey, can you move the player back onto the screen so we can see the trace statements?” I was using CSS to position the player off the screen, as it has no user interface. Jim was showing trace events in a simple textblock.

As soon one pixel of the Silverlight control existed inside the visible browser viewport, the audio would play on our Macbook Pro. Move it off the screen, then no audio for you.

But wait there’s more! Setting CSS visibility to hidden works in Mac/Safari, but still fails in Mac/Firefox. To play in all browsers, the Silverlight player must have at least one visible pixel on the screen. I didn’t try layering it behind another element because a single dot on our page was invisible on the edge.

Uhg.

#    Comments [0] |