One of the features of the Flash application I'm working on is the ability to share the webcam with other users. We just use the built-in webcam support in Flash and send it via FMS.
We had some people who ask for high-quality video, but we already use the highest quality settings that we can use in Flash (quality setting up to 100%).
I understand that in the new flash players they added MPEG-4 encoding support for video. I created a simple Flex test application to try and compare MP4 and FLV video quality. However, I cannot get MP4 to work at all.
According to the Flex documentation, the only thing I need to do to use MP4 instead of FLV is the prefix "mp4:" to the stream name when I publish:
Specify the stream name as a string with the mp4 prefix: with or without a file name extension. The prefix tells the server that the file contains H.264-encoded video and AAC-encoded audio in MPEG-4 Part 14.
When I try, nothing happens. I do not receive any events raised on the client side, no exceptions, and my server-side log does not show the start of any threads.
Here is the relevant code:
private var nc:NetConnection;
private var sharing:Boolean;
private var pubStream:NetStream;
private var format:String;
private var streamName:String;
private var camera:Camera;
private function startSharing():void {
if (!nc.connected) {
return;
}
if (sharing) { return; }
if(pubStream == null) {
pubStream = new NetStream(nc);
pubStream.attachCamera(camera);
}
startPublish();
sharing = true;
}
private function startPublish():void {
var name:String;
if (this.format == "mp4") {
name = "mp4:" + streamName;
} else {
name = streamName;
}
pubStream.publish(name, "record");
}
Herms source
share