I'm developing an ASP.NET
application that's required to stream video file hosted on the server to client. Now I use DirectShow.NET
to process the video file requested by users such as adding a subtitle before it is sent out into Internet. Following this article, I can successfully transfer video stream over network through WMAsfWriter
after it's processed by DirectShow
and paly it in my web page. To be specific, when I click the play button on my web page, the browser sends a request to the server and the server constructs a DirectShow
graph and runs it. Then the server gets the URL of video stream from the AsfWriter
filter and put it in the response. On the client side the browser parses the URL from the response and calls the vlc
player embedded in an ActiveX
object on that page to play that it.
This all works fine until I want to have more control of the played video stream such as pausing or stopping it. Since web server is stateless, the DirectShow
filter object I used to stream video will be destroyed every time it returns the response to the client. Although it seems that the DirectShow
graph is still running after that because I can see the video stream is being played on my web page, I can't control it through the DirectShow
filter object I used in my program as they are destroyed by the server on the end of the request. I know I can set those object as static variables to keep them alive across user requests, it's the last thing I want to do because static variables can be accessed by all requests from every user. So I want to ask that is there a better solution to achieve my goal?
Aucun commentaire:
Enregistrer un commentaire