Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: FadeInOut not working in ASPNET

$
0
0
Hi guys,

I found a problem and cannot solve it, this code works perfectly in Windows Application, but not in Web Application, and still can't figure out why. I used source code from NAudioDemo - FadeInOutDemo, and this is the code:

private IWavePlayer wavePlayer;
private AudioFileReader file;
private FadeInOutSampleProvider fadeInOut;
private string fileName = "C:\music\intro.mp3";

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Debug.Assert(this.wavePlayer == null);
            this.wavePlayer = new WaveOutEvent();
            this.file = new AudioFileReader(fileName);
            this.fadeInOut = new FadeInOutSampleProvider(file);
            this.wavePlayer.Init(new SampleToWaveProvider(fadeInOut));
            this.wavePlayer.Play();
            timer1.Enabled = true;
        }
    }
protected void timer1_Tick(object sender, EventArgs e)
    {
        if (fadeInOut != null)
        {
            fadeInOut.BeginFadeOut(5000);
        }
        timer1.Interval = 150000;
    }
I am still not sure why does FadeOut only occurs in desktop app and not in web app, I appreciate your help.

Viewing all articles
Browse latest Browse all 5831

Latest Images

Trending Articles



Latest Images