开发者

Pausing issue with flash webcam recording

I'm building a webcam recording app in CS5 and I'm having some seemingly random issues with the recorded flv. Currently I'm publishing a stream to Wowza Media Server using the standard _netstream.publish("movieName", "record") command. Everything regarding this works fine and I can play the file back but sometimes there's a 3 to 4 second pause at the beginning or end of the video. There will be a still frame and the time will sit at 0 and then snap to 4. I've explored bandwidth options and I've turned the resolution an开发者_如何转开发d quality down considerably and it doesn't seem to have any effect and the rest of the video will play back smoothly. Here are my current camera and mic settings.

    _cam.setMode(160, 120, 30, false);
    _cam.setQuality(0, 88);
    _cam.setKeyFrameInterval(30);
    _mic.rate = 11;

I'm also flushing the buffer before closing out the publish stream

    _netstream.publish('null');

Could there be something going on with camera initialization/deactivation that causes the lag?

Any help would be greatly appreciated. Let me know if you need more details


I believe this has something to do with the way that the Flash plugin itself initializes and displays the camera.

If you set up a simple test to try setting and unsetting the video stream:

var cam:Camera = Camera.getCamera();
var webcam:Video = new Video(500, 375);
addChild(webcam);

var isPaused:Boolean = false;

function showWebcam():void {
    if (!isPaused) {
        cam = null;
    } else {
        cam = Camera.getCamera();
    }

    webcam.attachCamera(cam);
    isPaused = !isPaused;
}

pausingButton.addEventListener(MouseEvent.CLICK, showWebcam);

You'll notice a definite pause as it switches between the two states.

From what I've seen, every time I call attachCamera() with a video object, there is a noticeable pause of the Flash Player itself (including all tweens, interactions, everything) when the method is called, even if the object I'm attaching is null.

Four seconds seems like an excessive lag, but I have noticed that the larger the input/video render and with smoothing = true set on the video object can affect the length of the delay.

As for a solution; I'm not sure if there is one achievable via pure Actionscript, since the delay appears to be down to how the Flash Player itself initializes and renders the live video object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜