Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
438 views
in Technique[技术] by (71.8m points)

actionscript 3 - Save video captured from webcam using Flash

I'd like to use Flash to capure video from the user's webcam and then save it on the same server that hosts the Flash file. The web server will be running ASP.Net technology. Seems easy, right?

Lot of searches yielded the same lines of code to start a webcam capture using Flash. I can't find anything that sends that captured video back to a server.

I can find lots of blog and forum posts that imply 3rd party software or Flash Communication Server is required to collect it on the server, but I don't understand why.

It seems like Flash ought to be able to capture some video and send it as an HTTP post to the same server that hosts the Flash file. That's pretty basic Flash/webcam functionality, right? It seems like we don't need to introduce 3rd party dependencies just yet.

Does anyone know where these extra lines of sample ActionScript code might be hiding?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You do need a Flash Media Server (or an open-source alternative such as Red5) to be able to stream video from the client to the server, which is essentially what you want to do here. There is no way to do that using HTTP POST.

You can, however, draw your Video display object to a bitmap each frame, and upload those bitmaps on the fly using regular HTTP file uploads. Although as you can imagine, that's not exactly ideal from a performance point of view. You'll also bump into problems because the Flash Player security model does not allow you to upload files without the operation being user-initiated (i.e. a mouse click event is in the stack trace.) There are way to work around this though, e.g. sending the file as an AMF ByteArray through an AMF service, but it might not be future proof.

In the end though, for any type of professional-grade application, you'll definitely want to incorporate a Flash Media Server (or Red5.) There are companies from which you can hire such services, one example being Influxis. Going down that route, you won't have to host the server (which is Java) yourself.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...