Expand my Community achievements bar.

SOLVED

native webcam capture width / height

Avatar

Level 4

the native width and height capture always seems to be 128x128.  how can i change this?  it's taking a square crop from the camera and publishing that as the stream. 

also, i don't quite understand what resolutionFactor is doing.  what are the three native width and height values?  does setting resolutionFactor=3 for a 128x128 capture translate to a 384x384 resolution?  no matter what i set resolutionFactor to, when i check the stream coming in the nativeWidth/nativeHeight is always 128x128.

can you help me clarify this?

Specifies the resolution factor of captured data; ResolutionFactor values range from 1 (lowest resolution) to 10 (highest resolution). Resolution factor gets multiplied by the native width and height of captured camera. We provide three native width and height values based on aspect ratios. That width and height when multiplied with this factor, gives the resolution.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Adam,

If you look at the source code of StreamManager.as in the player 9 source we provide, we have three set of values for native width/height. I will copy them here

/**

  • @private

*/

public static const AR_PORTRAIT_W:Number = 144;

/**

  • @private

*/

public static const AR_PORTRAIT_H:Number = 112;

/**

  • @private

*/

public static const AR_STANDARD_W:Number = 128;

/**

  • @private

*/

public static const AR_STANDARD_H:Number = 128;

/**

  • @private

*/

public static const AR_LANDSCAPE_W:Number = 160;

/**

  • @private

*/

public static const AR_LANDSCAPE_H:Number = 96;

By default, we use the standard values for nativeWidth and nativeHeight i.e. 128 and 128. When you specify a reslotion factor, the native width and height doesn't change but the capture width and height is multiplied by the factor in

camera.setMode(StreamManager.ARSTANDARD_WresolutionFactor, StreamManager.AR_STANDARD_H resolutionFactor, _fps);

So, if you are setting resolution factor as 3 it will do for standard

_camera.setMode(1283, 1283, _fps); though the native width and height remains the same.

If you want to change them, you need to override the createMyStream function in WebcamPublisher.as and change the nativeWidth and nativeHeight( the code is same for 9 and 10, so even If you are using player 10 swc, you can refer to 9 source of this function), but you don't need to do the native width and height, just changing the resolutionFactor should change the capture width/height for you.

Please refer to updateSettings and createMyStream functions in the source code of WebcamPublisher.as for further clarity.

Hope this helps.

Thanks

Hironmay Basu

View solution in original post

7 Replies

Avatar

Level 4

also, i'd like to add that i tried setting the native camera capture rez with Camera.getCamera().setMode(w,h), but it had no effect.

Avatar

Correct answer by
Former Community Member

Hi Adam,

If you look at the source code of StreamManager.as in the player 9 source we provide, we have three set of values for native width/height. I will copy them here

/**

  • @private

*/

public static const AR_PORTRAIT_W:Number = 144;

/**

  • @private

*/

public static const AR_PORTRAIT_H:Number = 112;

/**

  • @private

*/

public static const AR_STANDARD_W:Number = 128;

/**

  • @private

*/

public static const AR_STANDARD_H:Number = 128;

/**

  • @private

*/

public static const AR_LANDSCAPE_W:Number = 160;

/**

  • @private

*/

public static const AR_LANDSCAPE_H:Number = 96;

By default, we use the standard values for nativeWidth and nativeHeight i.e. 128 and 128. When you specify a reslotion factor, the native width and height doesn't change but the capture width and height is multiplied by the factor in

camera.setMode(StreamManager.ARSTANDARD_WresolutionFactor, StreamManager.AR_STANDARD_H resolutionFactor, _fps);

So, if you are setting resolution factor as 3 it will do for standard

_camera.setMode(1283, 1283, _fps); though the native width and height remains the same.

If you want to change them, you need to override the createMyStream function in WebcamPublisher.as and change the nativeWidth and nativeHeight( the code is same for 9 and 10, so even If you are using player 10 swc, you can refer to 9 source of this function), but you don't need to do the native width and height, just changing the resolutionFactor should change the capture width/height for you.

Please refer to updateSettings and createMyStream functions in the source code of WebcamPublisher.as for further clarity.

Hope this helps.

Thanks

Hironmay Basu

Avatar

Level 2

I can't find setMode or getCamera.  What class are they on?  I'm using WebcamPublisher.

I tried to set aspectRatio directly, since it is documented as a read/write attribute, but that won't compile, since it is "Access of a possibly undefined property aspectRatio through a reference with static type com.adobe.rtc.subclass:WebcamPublisherSubclass"

(we are using the patched subclass of the WebcamPublisher class)

Avatar

Former Community Member

Hi,

To get the current camera from webcamPublisher , use webcamPub.camera .

There is no setMode as such, you can set the aspectRatio , the API is in StreamManager, streamManager.aspectRatio = "your aspect ratio" ;

The aspect Ratio constants are in StreamManager , I am copying them here. They are public

/**

  • Constant for specifying a portrait aspect ratio on a video stream.

*/

public static const AR_PORTRAIT:String = "portrait";

/**

  • Constant for specifying a standard aspect ratio on a video stream.

*/

public static const AR_STANDARD:String = "standard";

/**

  • Constant for specifying a landscape aspect ratio on a video stream.

*/

public static const AR_LANDSCAPE:String = "landscape";

Also,You need to choose a specific aspect ratio(their width and height values are in StreamManager) , so you can see what ratio you want , and depending on choose the type of aspectRatio.

And if you set the resolutionFactor value inside webcamPub, you will get multiples of width/height values. Refer to updateCameraSettings function inside player 9 source code for reference.

Hope this helps

Thanks

Hironmay Basu

Avatar

Level 2

Hi,

I tried to set resolutionFactor using webcamerapublicer object but it did not set tha value even it was raising some exceptation

Severity and Description    Path    Resource    Location    Creation Time    Id
1195: Attempted access of inaccessible method resolutionFactor through a reference with static type com.adobe.rtc.collaboration:WebcamPublisher.

My code written as follows ....

camPub.resolutionFactor(1);

Waiting for your quick response

Regards

Rajsun2

Avatar

Former Community Member

Hi,

resolutionFactor is a property and not a function or method. For properties , you need to do something like

webcamPub.resolutionFactor = 5 ;

Hope this helps

Thanks

Hironmay Basu

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----