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

Vertically Oriented WebCamera

nathanah
Level 3
Level 3

Is there a quick way to make the WebCamera pod display vertically with video streams on top of each other instead of side by side? I just started looking at the WebCamera.mxml sample app, but was wondering if there was a preexisting way to do it.

4 Replies
Hironmay
Level 10
Level 10

Hi,

If you have a single WebCamera Pod display all your streams, then streams are shown in a grid structure based on some area calculations. They can be laid out in a horizontal or a vertical manner.

There are two ways to show the streams vertically in one column

a) Either you modify the source code in WebCamSubscriber, the

place where in if loop, we mention the orientation.Make that orientation always vertical i.e. current code is

if (maxArea == maxHArea) {

var arrayH:Array=areasH[maxHAreaIndex];

theW = arrayH[0];

theH = arrayH[1];

theNum = maxHAreaIndex+1;

orientation = "horizontal";

} else {

var arrayV:Array=areasV[maxVAreaIndex];

theW = arrayV[0];

theH = arrayV[1];

theNum = maxVAreaIndex+1;

orientation = "vertical";

}

Instead make it always

var arrayV:Array=areasV[maxVAreaIndex];

theW = arrayV[0];

theH = arrayV[1];

theNum = maxVAreaIndex+1;

orientation = "vertical";

Look inside WebcamSubscriber.as files for more details.

b) You take one WebcamSubscriber for every stream and then lay out all the subscribers in a VBox. WebCamera example can shows how to use multiple WebcamSubscribers. The advantage of second approach is you can draw any layout of streams with this just by placing the WebcamSubscribers.

However, if you want to just give a quick try , you can modify the code as I mentioned. I have not done this but it should ideally work.

Hope this helps

Thanks

Hironmay Basu

nathanah
Level 3
Level 3

Thanks so much for your quick response.

A did not work for me. Perhaps there's something I did wrong though. I extended WebcamSubscriber to create MyWebcamSubscriber and overrode layoutCameraStreams(). Then extended WebCamera to create MyWebCamera and overrode recreateSubscribers() to use MyWebcamSubscriber.

I found another solution that will work for me for now. I can just limit the width of the WebCamera enough so that the next video player is pushed onto the next row.

Hironmay
Level 10
Level 10

Hi,

Maybe somewhere you are hitting the old function. I mean best way to verify A would be to put a break point inside layoutCameraStreams and see. But your solution is also fine. You can try out B though in case you are looking for other layouts also.

Thanks

Hironmay Basu

easterisle
Level 2
Level 2

I'm pretty new to LCCS and flash in general, but I wanted to do something similar to you, simple functionality with a vertical layout, and I did it just using defaults and laying them out with vbox

<mx:HBox width = "100%" height = "100%">

     <mx:VBox width = "33%" height = "100%">

          <rtc:WebCamera width = "100%" height = "66%"/>

     </mx:VBox>

</mx:HBox>

Maybe I am misreading what you are trying to do, but for me, this stacks up local and remote webcams vertically in the vbox