Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Changing WebcamSubscriber aspect ratio

Avatar

Level 3

Hi,

The default aspect ratio is 1.

I'm building a private 1-1 video chat where a user see a small view of his own webcam and a large view of his friend.

For that I'm using two WebcamSubscribers.

The large video view should have width=200 and height=280

I found a question of someone that is trying to do something similar

http://forums.adobe.com/thread/203057?tstart=750

How do I change the aspect ratio?

Do I need to change both WebcamPublisher and WebcamSubscriber or only the subscriber?

In the linked thread Hironmay mentioned setting the aspectRatio in the StreamManager API and overriding the layoutStreams function

of the WebcamSubscriber.

I couldn't find a way to access the StreamManager from the WebcamSubscriber and even if there is a way,

both the portrait and landscape aspect ratios have width larger then the height and I need a custom ratio where the height is larger then the width.

Can you please exaplain or give a simple example how to set a custom aspect ratio?

Is there a reason why this functionality is not exposed to the the WebcamSubscriber API?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

To access the StreamManager, use your connectsession instance. i.e. connectSession.streamManager.

And you can use something like connectSession.streamManager.aspectRatio = StreamManager.AR_PORTRAIT.

For some reason, I don’t see the aspectRatio API being exposed in docs. But I will expose the API for aspectRatio as well do something regarding custom aspectRatio in coming release.

And yes, what you are doing is right, you can manually do vC.height and vC.width in layoutCameraStreams() to set any height/width you want.

Hope this helps

Thanks

Regards

Hironmay Basu

View solution in original post

0 Replies

Avatar

Level 10

Hi,

When you mention the width and height of a WebcamSubscriber, it takes the size of the external UIComponent (Subscriber) holding your streams. You need to mention the height and the aspect ratio or width and aspect ratio. The other component of width/height is calculated from aspect ratio while laying out the streams. We provide three aspect ratios currently, standard, landscape and portrait and default is standard which is 1 so width and height is same for you.

You can take a look into the source of the computeArea_Rows, computeArea_Columns and layoutCameraStreams in WebcamSubscriber source if you are interested in knowing the calculations behind stream layouts.

Hope this helps

Thanks

Regards

Hironmay Basu

Avatar

Level 3

I can't find a way to set the aspectRation.

I can't find a way to access the StreamManager

I don't know what is the correct way to do what I need so I manually set the offset and vC.height by overriding layoutCameraStreams:

I've added:

yOffset = 0;

vC.height = theH + 36;

I've found several similar forum posts of people looking for the same functionality.

It'll be great if you can add a setting for a custom aspect ratio.

Thanks

Avatar

Correct answer by
Level 10

To access the StreamManager, use your connectsession instance. i.e. connectSession.streamManager.

And you can use something like connectSession.streamManager.aspectRatio = StreamManager.AR_PORTRAIT.

For some reason, I don’t see the aspectRatio API being exposed in docs. But I will expose the API for aspectRatio as well do something regarding custom aspectRatio in coming release.

And yes, what you are doing is right, you can manually do vC.height and vC.width in layoutCameraStreams() to set any height/width you want.

Hope this helps

Thanks

Regards

Hironmay Basu

Avatar

Level 3

Thank you for the custom aspectRatio in the API.