As with other A/V components, LCCS provides a publisher component for capturing and broadcasting a user's Web Camera video screen, and a subscriber component for receiving the publisher's stream and rendering it. In this case, the publisher component is "headless", similar to the AudioPublisher, in that it has no user interface. The WebcamSubscriber has a rudimentary user interface - it displays each incoming video stream as a separate rectangle in a tiled layout within the subscriber component's dimensions.
Similar to the AudioPublisher, the WebcamPublisher's API makes it easy to add video publishing - simply instantiate the component and call webcamPublisher.publish(); In the Flash Player, this will cause the publishing user to see the following :
The Flash Player prompts for Audio Video capture
Upon accepting this dialog, the user in question will have video captured from an attached web camera and broadcast to any subscribers listening.
The WebcamPublisher also provides a variety of APIs for controlling the broadcast quality of the video, including the fps (frames per second captured) and quality (compression factor).
In order to receive web camera video, simply instantiate a WebcamSubscriber, add it to a display list, and give it a size (set its width and height). The subscriber will automatically display all incoming webcam streams available to it.
In the interests of saving bandwidth, the WebcamSubscriber will NOT subscribe to the stream being published from the current users computer, if any. Instead, assign the WebcamPublisher to the subscriber so that video can be captured locally, like so :
By default, the subscriber will display any available incoming streams and lays them out as a set of tiles within its dimensions. If you'd like to customize this layout, the recommended approach is to use multiple subscribers, each restricted to show only one stream. To restrict which streams the subscriber displays, use the publisherIDs API, like so :
This will ensure that only one stream (corresponding to one publisher) will be displayed. From there, one subscriber can be instantiated per stream - to find all available streams, the StreamManager can be used :
From here, you could iterate over the streamIDs object and create one WebcamSubscriber per stream, and fetch stream details via
The StreamDescriptor contains details such as streamPublisherID which can be used for assigning WebcamSubscriber.publisherIDs. How you want to lay out each WebcamSubscriber is then totally up to you.
The WebCamera Component
The WebCamera component is a "pod" level component, meant to provide an easy way to include a web cam publish and subscribe workflow into your application with minimal (as few as one!) lines of code. In following the philosophy of such "pods", the WebCamera provides limited customizability - it's really meant as an easy entry point to the publisher and subscriber components. It's important to note that this component is built completely from the WebcamPublisher and WebcamSubscriber - you can open up its source and see the way in which it uses them. If you'd like to customize your web camera workflow, you could either repurpose or extend the WebCamera code, or build your own workflow from scratch using the publisher and subscriber components, which are lower-level building blocks useful for this purpose.