Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Why Can't I Get Audio Data Directly On A Windows Phone?

DZone's Guide to

Why Can't I Get Audio Data Directly On A Windows Phone?

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

I see this question asked a lot on StackOverflow, and I saw another example of this phenomenon. I decided to write this short article to simply explain why this is not possible, in my opinion, and why you should look for another media source to build your ringtones rather than using the existing media library.

The main problem with building ringtones from existing media content is the lack of access to direct media byte streams. Also known as – media content. You can play registered songs through the OS-based player, but you don’t have the byte array for the content that is played. That being said, SaveRingtoneTask does not accept a parameter of type Song.

What’s the reason for the restriction? The main one I see here would be illegal content distribution. If a third-party application would have access to the media content uploaded through Zune, this would mean that the same application could do whatever it wants with that content – send it somewhere, upload it to a public server. You name it. A lot of songs on various Windows Phone 7 devices are licensed and DRM-protected. Specific licenses restrict distribution of the content, therefore it makes sense to lock any possible backdoors that would facilitate doing that.

What about beat extraction through VisualizationData (via MediaPlayer.GetVisualizationData)?

Not going to work because it is not available on Windows Phone:

What should I do?

Either bundle ringtones with the application (not really efficient but possible – for example, through soundboard apps) or have your own web server (or space on a web server) that can be accessed from within your application to download MP3 and WMA files of appropriate length and size (also, without DRM).

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}