setDisplay(displayId) method

If an OzCamera object is added to the program, this method can run on it. It is used to display the stream of the camera represented by the object. So it will show the stream from the client's own camera. It gets a displayId parameter as an input which is ID of the HTML object where the video should be displayed. As an example you could display the video in a div element (Code example 1).

<div id="local">
  <!-- The video will be displayed in this div -->
</div>
	
Code example 1 - Example how to give a display ID in HTML

Parameters

displayId: Type: string|null. The ID of the HTML element or null. If the displayId is empty, the existing camera display will be removed. e.g. "myHtmlId"

Method usage example

In this example we will register our camera to the myCam object, then we will change the width to 360, the height to 240 and the fps to 30. Finally we will send the camera picture to the "local" id in the html code, so it will be shown on the website (Code example 2).

//constructor of the myCam object, the default camera is used
var myCam = OzCamera.getCameraByName(); 

myCam.setMode(360,240,30); //sets the camera properties
myCam.setDisplay("local"); //displays the camera stream
	
Code example 2 - setDisplay(displayId) method example

More information