is it possible to build a Flash app that can record webcam input and then send that back to the server to record it as an FLV or some other format?
Hmm as I type it out it sounds rather unlikely to me. Perhaps better to get the user to make their own video with their own software then just upload the complete video to the server, then convert it to FLV, then play it back on the website.
Any thoughts?
There is an air app that allow editing of flv's it is free to use but not open source and it is based on bitmapdata so its all flash so might be possible.
Recently I have done blue screen videos in papervision so I expect as3 can do bitmapdata grabbing fast enough its transfer and encoding that might just be too slow.
It is not difficult to encode a movieclip as a jpeg and send to server but it would be too slow to send lots of jpegs.
import com.adobe.images.JPGEncoder;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
//...
private function sendjpgToServer():void
{
_jpgSource = new BitmapData( WIDTH, HEIGHT );
_jpgSource.draw( _imageSource );
_jpgEncoder = new JPGEncoder( COMPRESSION );
_jpgStream = _jpgEncoder.encode( _jpgSource );
_header = new URLRequestHeader("Content-type", "application/octet-stream");
_jpgUrlRequest = new URLRequest(_sendImagePath+ '?PictureId='+_imageId+'&cacheKiller=' + (new Date()).getTime());
_jpgUrlRequest.requestHeaders.push( _header );
_jpgUrlRequest.method = URLRequestMethod.POST;
_jpgUrlRequest.data = _jpgStream;
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.INIT, onCompleteJpg);
myLoader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, ioErrorListener );
myLoader.load(_jpgUrlRequest);
}
It uses a hack to send the data (using Loader rather than URLLoader) as the ways I found online only works if you have sloopy php security setup, my approach requires the php echo's a jpg to get a finished call back!
these guys offer one you can buy:
http://www.flashsyndrome.com/recorder.php
But for my purposes now I don't need to save the webcam vid onto the server at all it turns out - I just need to be able to record it to memory and be able to play it back to the user, and that app does exactly that. I guess from the choppiness of the playback that it is showing a series of BMPs or JPGs like you described JLM. Maybe I'll look into how that's done.
_Originally posted by: persist_http://osflash.org/red5
