Note that there are some explanatory texts on larger screens.

plurals
  1. POCrop camera before streaming to a NetStream in Flash
    primarykey
    data
    text
    <p>I'm building a very simple publisher for the webcam in Flash. I want to select a camera and send the stream to a RTMP URL, basically:</p> <pre><code>Camera camera = Camera.getCamera(); NetStream ns = new NetStream(connection); ns.attachCamera(camera); ns.publish("stream name"); </code></pre> <p>Now, I know I can set a mode on the camera, like this:</p> <pre><code>camera.setMode(320, 240, 25); </code></pre> <p>But what I really would like to do is to set a mode such as 360 x 480 (not the same aspect ratio as the camera is recording) and have Flash crop the image for me. Is there a way to do that?</p> <p><strong>Edit:</strong> I know <a href="http://www.adobe.com/products/flash-media-encoder.html" rel="nofollow">Flash Media Live Encoder</a> can do this, but I would like to do it in the browser.</p> <p>According to the <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#setMode%28%29" rel="nofollow">ActionScript docs for Camera.setMode</a>, there is an optional fourth parameter that sounds interesting, <code>favorArea</code>. From the docs:</p> <blockquote> <p><strong>favorArea</strong>:<code>Boolean</code> (default = <code>true</code>) — Specifies whether to manipulate the width, height, and frame rate if the camera does not have a native mode that meets the specified requirements. The default value is <code>true</code>, which means that maintaining capture size is favored; using this parameter selects the mode that most closely matches <code>width</code> and <code>height</code> values, even if doing so adversely affects performance by reducing the frame rate. To maximize frame rate at the expense of camera height and width, pass <code>false</code> for the <code>favorArea</code> parameter.</p> </blockquote> <p>But it defaults to true and it doesn't seem to make what I want (I want to crop the image of each frame, throw away some data, and stream the rest).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload