0
0

[Platform] – Win32
[Language] – C#

Are there any issues with FMOD streaming audio/video from Windows Media Service?

My company streams their audio and video through WMS, I am trying to make a player that will use FMOD to connect to the stream and play it. I know that the streaming functionality does work because I have streamed a song from a web site.

Here are two links to multimedia objects, the first is a song I found that is able to stream, the second is a *.wmv file that we play. The file is there so there should be no concerns of missing files.

  1. [url:3c0q7v8v]http://61.156.7.14/upload/mp3/10.mp3[/url:3c0q7v8v]
  2. [url:3c0q7v8v]http://wms1.managed-media.com:8080/web/lastcall.wmv[/url:3c0q7v8v]

I have added the code that I am using in a simple 1 textbox and 1 button windows application. Whenever it reaches the timer1_tick it will break on the Sound.getOpenState(…) is resulting in an FMOD.RESULT.ERR_FORMAT error.

Any help will be most appreciated. If you need any more info just ask.

[code:3c0q7v8v]
private FMOD.System system = null;
private FMOD.Sound Sound = null;
private FMOD.Channel Channel = null;
private FMOD.RESULT result;
private Boolean playing = false;

private void Form1_Load(object sender, EventArgs e)
{
uint version = 0;
StringBuilder drivername = new StringBuilder(256);

//Build Sound Card A
result = FMOD.Factory.System_Create(ref system);
ERRCHECK(result);

//Check FMOD Version
result = system.getVersion(ref version);
ERRCHECK(result);
if (version < FMOD.VERSION.number)
{
    MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
    this.Close();
}

result = system.init(2, FMOD.INITFLAG.NORMAL, (IntPtr)null);
ERRCHECK(result);

}

private void btnPlay_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
result = system.setStreamBufferSize(128 * 1024, FMOD.TIMEUNIT.RAWBYTES);
ERRCHECK(result);

    result = system.createStream(textBox1.Text, (FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.NONBLOCKING), ref Sound);
    ERRCHECK(result);

    timer1.Start();
}

}

private void timer1_Tick(object sender, EventArgs e)
{
FMOD.OPENSTATE openstate = 0;

uint percentbuffered = 0;
bool starving = false;

result = Sound.getOpenState(ref openstate, ref percentbuffered, ref starving);
ERRCHECK(result);

if (openstate == FMOD.OPENSTATE.READY && Channel == null)
{
    result = system.playSound(FMOD.CHANNELINDEX.FREE, Sound, false, ref Channel);
    ERRCHECK(result);
}

result = Channel.isPlaying(ref playing);
ERRCHECK(result);

if (!playing)
{
    Channel = null;
    timer1.Stop();
}

int channelsplayingA = 0;
uint Counter = 0;

if (Channel != null)
{
    system.getChannelsPlaying(ref channelsplayingA);
    Channel.getPosition(ref Counter, FMOD.TIMEUNIT.MS);
}

statusBar.Text = "Channels Playing : " + channelsplayingA + ", Time : " + (Counter / 1000).ToString();

if (system != null)
{
    system.update();
}

}

private void ERRCHECK(FMOD.RESULT result)
{
if (result != FMOD.RESULT.OK)
{
timer1.Stop();
MessageBox.Show("FMOD error! " + result + " – " + FMOD.Error.String(result));
Environment.Exit(-1);
}
}
[/code:3c0q7v8v]
edit: changed 2nd URL

  • You must to post comments
0
0

The application that I am creating is not going to be a service. It’s to be a player that pulls from the music from the streaming servers. The problem lies in that whenever I try to play the sounds on the streaming server it will not play, throws the format error mentioned in my first post.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.