如何运行在客户端的一个.wav。 ASP.NET [英] How to run a .wav in client. ASP.NET

查看:158
本文介绍了如何运行在客户端的一个.wav。 ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有发挥使用的SoundPlayer类波形文件的应用程序。然而,当我发布在IIS应用程序,文件将无法播放。
要使用我添加了一个参考windows.dll的声音播放类,它可能会干扰?

I have an application that plays a wave file using the SoundPlayer class. However, when I publish the application in IIS, the file will not play. To use the SoundPlayer class I added a reference windows.dll, it may interfere?

 public void PlaySound()
    {
        try
        {
            while (1 == 1)
            {
                List<string> distinctMusic = GetMusicFile.Distinct().ToList();

                for (int i = 0; i < distinctMusic.Count; i++)
                {
                    player.SoundLocation = distinctMusic[i];
                    player.Play();
                    Thread.Sleep(GetMusicDuration[i] * 1000);
                    player.Stop();
                }
                player.Dispose();
            }
        }
        catch (Exception e)
        {
            //log.LogTxt(e.ToString());
        }
    }

谁能帮我?
THX!

Can anyone help me? Thx !

推荐答案

有没有使用C#在asp.net上播放客户端声音的方式(当然除了Silverlight的)。你需要使用一个客户端技术,比如JavaScript。

There's no way of using C# in asp.net to play a sound on client-side (except Silverlight of course). You need to use a client-side technology, like javascript.

例如这样的:

播放音频使用Javascript?

http://www.w3schools.com/html/html_sounds.asp

<audio controls height="100" width="100">
  <source src="horse.mp3" type="audio/mpeg">
  <source src="horse.ogg" type="audio/ogg">
  <embed height="50" width="100" src="horse.mp3">
</audio>

这篇关于如何运行在客户端的一个.wav。 ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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