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.Http Context context)
{
string path = "c:/media/atb.mpg";
byte[] buffer=null;
context.Respons e.ClearHeaders( );
try
{
using(Stream stream = File.Open(path, FileMode.Open))
{
buffer = new byte[1024];
while(stream.Po sition < stream.Length)
{
//Thread.Sleep(10 0);
Debug.WriteLine ("Read");
stream.Read(buf fer,0,buffer.Le ngth);
context.Respons e.OutputStream. Write(buffer,0, buffer.Length);
//context.Respons e.Flush();
//Thread.Sleep(10 00);
}
//stream.Read(buf fer,0,buffer.Le ngth);
}
}
catch{}
}
}
The problem is that the Media player is waiting for the hole file, if I put
this line of code then
context.Respons e.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 2 2862
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" <st************ *@yahoo.com> wrote in message
news:8B******** *************** ***********@mic rosoft.com... 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.Http Context context) { string path = "c:/media/atb.mpg"; byte[] buffer=null; context.Respons e.ClearHeaders( ); try { using(Stream stream = File.Open(path, FileMode.Open)) { buffer = new byte[1024]; while(stream.Po sition < stream.Length) { //Thread.Sleep(10 0); Debug.WriteLine ("Read"); stream.Read(buf fer,0,buffer.Le ngth); context.Respons e.OutputStream. Write(buffer,0, buffer.Length); //context.Respons e.Flush(); //Thread.Sleep(10 00); } //stream.Read(buf fer,0,buffer.Le ngth); } } catch{} } }
The problem is that the Media player is waiting for the hole file, if I put this line of code then context.Respons e.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
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.stre am">
<PARAM name="rate" value="1">
<PARAM name="balance" value="0">
<PARAM name="enabled" value="true">
<PARAM name="enabledCo ntextMenu" value="true">
<PARAM name="fullScree n" value="false">
<PARAM name="playCount " value="1">
<param name="setMode" value="showFram e">
<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.Respons e.Flush();
I get an error message.
Best regards,
Stefan
"Steve C. Orr [MVP, MCSD]" wrote: 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" <st************ *@yahoo.com> wrote in message news:8B******** *************** ***********@mic rosoft.com... 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.Http Context context) { string path = "c:/media/atb.mpg"; byte[] buffer=null; context.Respons e.ClearHeaders( ); try { using(Stream stream = File.Open(path, FileMode.Open)) { buffer = new byte[1024]; while(stream.Po sition < stream.Length) { //Thread.Sleep(10 0); Debug.WriteLine ("Read"); stream.Read(buf fer,0,buffer.Le ngth); context.Respons e.OutputStream. Write(buffer,0, buffer.Length); //context.Respons e.Flush(); //Thread.Sleep(10 00); } //stream.Read(buf fer,0,buffer.Le ngth); } } catch{} } }
The problem is that the Media player is waiting for the hole file, if I put this line of code then context.Respons e.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mickel Grönroos |
last post by:
Hi!
Anybody tried using Windows Media Player 9 via win32com? (And more
precisely, combining that with a Tkinter application.)
I found a few earlier threads on Windows Media Player and Python, but it
seems nobody has really got it to work, e.g. the below does not work:
wmp = win32com.client.Dispatch("MediaPlayer.MediaPlayer.1")
wmp.FileName = "C:/Path/To/Some/Media/File.wav"
|
by: Anise |
last post by:
I have a question concerning embedding a windows media
player into a web application in .net..
I download Windows Media Player 10 and its SDK
On the .ascx page I placed a windows media player object
from the toolbox
and all the sites i read say when
"Adding the Windows Media Player control from the Toolbox
also adds references to two libraries created by Visual
|
by: Stephen Adam |
last post by:
Hi there,
Have spent a while trying to find out how to connect to Windows Media Player
through COM. Unfortunately there doesnt seem to be much stuff about it on
the web.
What I need to do is create a simple console application which will be able
to find out what the values of a currently playing tack.
I've downloaded the Windows Media player SDK which come with some IDL and
|
by: BobAchgill |
last post by:
What is the best way to show a video file directly in a
Form?
Can I use functions of Windows Player in a Windows Form?
Functions like: play video or show visualization for
music, etc.
|
by: UJ |
last post by:
I have a .avi file that uses the Divx codec. If I load it with windows media
player program it works fine. If I load it using my control in a program, it
doesn't display. Over standard media files work fine so it's this particular
file.
Do I have to do anything when the file uses a non-included codec? How can I
tell what Codec it's using?
TIA - Jeff.
| |
by: Paul Fi |
last post by:
I have this code which tries to obtain the number of items in the
current playlist of windows media player:
private void MainForm_Load(object sender, System.EventArgs e)
{
// get Window handle
wnd = Win32.FindWindow("WMPlayerApp","Windows Media Player");
wnd = Win32.FindWindowEx(wnd, 0, "WMPAppHost", null);
wnd = Win32.FindWindowEx(wnd, 0, "WMP Skin Host", null);
wnd = Win32.FindWindowEx(wnd, 0, "CWmpControlCntr", null);
|
by: sri2097 |
last post by:
Basically,
I want to check if a URL is playable or not (without actually playing
it).
i.e. given a URL I want to write an automation script to figure it out
for me
if it's playable or not. If you give a bad/invalid URL for windows
media
player to play a pop-up window shows us that it cannot be played. So
I would want to catch that event.
|
by: Tony |
last post by:
I'm working on project that plays movies using Windows Media Player and
I'm controlling everything with JavaScript. Per the client I only need
to support IE 6 or greater which happens to make things a bit easier.
What I need to do is create a playlist and play it using JavaScript. I
keep on getting close but not close enough to play the dang files. Has
anyone done this before and can shed some light on what worked for them?
|
by: dongarbage |
last post by:
Hi there,
I've created a user control to put in a web page. I'd like to add a
windows media player control to the user control that I've created.
But, for some reason, the user control does not load when I add the
windows media player control to it.
Is the issue that I did not specify the HTML correctly? I have embedded
a windows media player in a web page, and had to specify the CLSID for
media player, but in this case, I'd like to...
|
by: artsohc |
last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while the phones are on hold, but now I am trying to write a script that will allow Windows Media Player to run as a service so I can make it auto-start with out needing a user logged in on the computer. Also it would allow the music-on-hold to work if we...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |