开发者

Playing a MP3 using Windows Phone 7 and MediaElement

I'm trying to figure out how to play a MP3 of a GoogleVoice voicemail item. To start, the MP3 isn't a .mp3 where you can just set an audio source to MediaElement. The MP3 is served via an HTTP response. Basically, I need a way to have MediaElement play this MP3. It would be nice if I can just do a static URL to the file, but it seems I need to download or something first...

Below is as much information as I can dig up. I can make the request via HTTPWebRequest, it's not handling the rest. Before I go about downloading it all, I wanted to see what people suggest.

URL: https://www.google.com/voice/media/send_voicemail/gh8a7a5d649e0b3e182b7d353b1e3794aec89526

Fiddler Request: GET https://www.google.com/voice/media/send_voicemail/gh8a7a5d649e0b3e182b7d353b1e3794aec89526 HTTP/1.1 Accept: text/html, application/xhtml+xml, / Accept-Language: en-US User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E; Zune 4.7; MS-RTC LM 8) Accept-Encoding: gzip, deflate Host: www.google.com Connection: Keep-Alive

Fiddler Response: HTTP/1.1 200 OK Content-Type: audio/mpeg Cache-Control: must-revalidate Expires: Fri, 01 Jan 1990 00:00:00 GMT Pragma: no-cache, no-store cookie: Content-Length: 5120 Content-Disposition: attachment; filename="gh8a7a5d649e0b3e182b7d353b1e3794aec89526.mp3" Content-Transfer-Encoding: binary Accept-Ranges: bytes Date: Fri, 17 Jun 2011 18:11:10 GMT X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE开发者_运维知识库

�� ��yz�CHwww�8��B�!9�F+�F�PIb���&+$@����L�0L�0ؠ�<�9���'4h���[l�S�[m���"�.... (note this is the 5120 bytes in the content length)

Thanks!


Since there's no responses, I went ahead and implemented downloading the file and saving to isolated storage. I seem to be hitting similar issues all over. Wish MS coded to allow this.


I don't know if this is of any help, but for some content MediaElement assumes that correct file extension is in place in the URL. Also, I have seen somewhere that you could try adding the extension as query parameter to the requested URL (sorry, can't find it anymore). So, your URL could become: https://www.google.com/voice/media/send_voicemail/gh8a7a5d649e0b3e182b7d353b1e3794aec89526?ext=.mp3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜