n音讯 - 从互联网上播放MP3没有FileOpenDialog? [英] NAudio - Play mp3 from internet without FileOpenDialog?

查看:163
本文介绍了n音讯 - 从互联网上播放MP3没有FileOpenDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在n音讯演示注意到从n音讯的最新版本,如果文件名是空的,那么它会打开一个fileopendialog。
所以,如果我粘贴在该窗口中的HTTP链接,然后点击确定,我已经注意到,文件名字符串看起来是这样的:



C:\\ \\Users\User\AppData\Local\Microsoft\Windows\Temporary互联网Files\Content.IE5\2FO1NTK2\20s [1] .MP3



这是如何发生的确切?我不想一个OpenFileDialog,因为我想打的路径已经在别处说明。
和在我的情况,我用一个字符串,它看起来像这样http://domainname.com/file.mp3



这将创建一个错误说明URL不被支持。 ?所以我猜有什么我失踪这里



编辑:插入PlayMp3FromUrl给了我这个错误在waveout的:



NAudio.Wave.WaveOut'不包含一个构造函数'3'参数'
这是在行使用(waveout的waveout的=新waveout的(0,500,空))我试着只是删除所有的参数,离开它()),以及编译。但是,声音播放,似乎开始为微秒或东西。然后一切冻结。我已经试过各种参数,并没有似乎工作。 ?我想这是得到的东西做的参数


解决方案

 的http:\ www.domainname.com/file.mp3

它是否与<$工作C $ C> // ?






使用 PlayMp3FromUrl SO质疑:

  PlayMp3FromUrl(http://www.domainname.com/file.mp3); 


I noticed in the NAudio Demo from the latest version of NAudio that if Filename is empty, then it opens a fileopendialog. So if I paste a http link in that window and click OK, I've noticed that the FileName string looks something like this:

"C:\Users\User\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\2FO1NTK2\20s[1].mp3"

How does this exactly happen? I don't want an OpenFileDialog because the path I want to play is already stated elsewhere. And in my case, I use a string which looks something like this "http://domainname.com/file.mp3"

This creates an error stating that URL is not supported. So I guess there's something I'm missing here?

Edit: Inserting the PlayMp3FromUrl gives me this error in WaveOut:

'NAudio.Wave.WaveOut' does not contain a constructor that takes '3' arguments' This is at line "using (WaveOut waveOut = new WaveOut(0, 500, null))" I tried to just remove all of the arguments, leaving it ()), and that compiles. But the sound playback seems to start for a microsecond or something. And then everything freezes. I've tried with various arguments and none seem to work. I guess it's got something to do with the arguments?

解决方案

"http:\www.domainname.com/file.mp3"
      ↑

Does it work with // ?


Using PlayMp3FromUrl from this SO question:

PlayMp3FromUrl("http://www.domainname.com/file.mp3");

这篇关于n音讯 - 从互联网上播放MP3没有FileOpenDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆