Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

asp.net and Windows Media Player

1 view
Skip to first unread message

StefanT

unread,
Oct 9, 2005, 6:42:01 PM10/9/05
to
Hi,

I have a web app and a I have a http handler for a file, when I have a web
request for that file I insert a stream of bytes like this:

public void ProcessRequest(System.Web.HttpContext context)
{
string path = "c:/media/atb.mpg";
byte[] buffer=null;
context.Response.ClearHeaders();
try
{
using(Stream stream = File.Open(path,FileMode.Open))
{
buffer = new byte[1024];
while(stream.Position < stream.Length)
{
//Thread.Sleep(100);
Debug.WriteLine("Read");
stream.Read(buffer,0,buffer.Length);
context.Response.OutputStream.Write(buffer,0,buffer.Length);
//context.Response.Flush();
//Thread.Sleep(1000);
}
//stream.Read(buffer,0,buffer.Length);
}
}
catch{}
}
}

The problem is that the Media player is waiting for the hole file, if I put
this line of code then
context.Response.Flush();

the MP is not working anymore.

I want to publisn on my web server a video stream, is there anyway to do
this ?

Best regards,
Stefan

Steve C. Orr [MVP, MCSD]

unread,
Oct 9, 2005, 7:06:44 PM10/9/05
to
You might try using the media player activex control, as detailed here:
http://SteveOrr.net/articles/StreamingMedia.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"StefanT" <stefan_...@yahoo.com> wrote in message
news:8BBE273D-EBBA-42A2...@microsoft.com...

StefanT

unread,
Oct 9, 2005, 8:22:02 PM10/9/05
to
It's still waiting for the hole file, in your articole the file is on the web
server, in my case I have a web handler and want to insert a video stream
from a web cam for e.g. If I put :

<OBJECT ID="Player" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
VIEWASTEXT>
<PARAM name="autoStart" value="True">
<PARAM name="URL" value="out.stream">
<PARAM name="rate" value="1">
<PARAM name="balance" value="0">
<PARAM name="enabled" value="true">
<PARAM name="enabledContextMenu" value="true">
<PARAM name="fullScreen" value="false">
<PARAM name="playCount" value="1">
<param name="setMode" value="showFrame">
<PARAM name="volume" value="100">
</OBJECT>

the MP is waiting until the hole file is on the on that computer. Is there
any way to flush 1024 bytes or more ? If I put this line of code :
context.Response.Flush();

I get an error message.

Best regards,
Stefan

0 new messages