简体   繁体   English

Wp7 windows 电话 7 媒体元素不播放 stream

[英]Wp7 windows phone 7 media element not playing stream

i have been trying to play some sound(.wav) from a website link on windows phone 7 using the media element.我一直在尝试使用媒体元素从 windows 电话 7 上的网站链接播放一些声音(.wav)。

MediaElement mediaElement = new MediaElement();媒体元素媒体元素 = 新媒体元素(); mediaElement.source = new uri("http://api.microsofttranslator.com%2fwav"); mediaElement.source = new uri("http://api.microsofttranslator.com%2fwav"); mediaElement.play(); mediaElement.play();

doesnt do anything.什么都不做。

i tried implementing handlers or even try to use the Webclient class to download the stream and play it but it has the same problem i dont hear anything.我尝试实现处理程序,甚至尝试使用 Webclient class 下载 stream 并播放它,但它有同样的问题,我什么也没听到。

and also i copied the uri to the browser and it played the wave i needed.我也将 uri 复制到浏览器,它播放了我需要的波形。

If you want to use Microsoft Translator , you can add a Service Reference to the API SOAP service.如果你想使用Microsoft Translator ,你可以添加一个Service Reference到 API SOAP 服务。 The Service Client exposes the SpeakAsync method which will return the URL of the WAV file.服务客户端公开SpeakAsync方法,该方法将返回WAV文件的 URL。 You can then use your WebClient or HttpWebRequest to download the stream and play it.然后,您可以使用您的WebClientHttpWebRequest下载 stream 并播放它。 There's example code in this blog post .博客文章中有示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM