• English
  • Français

Class ApideoCamera


public class ApideoCamera
The ApideoCamera object represents a webcam stream sent to the server.

The Camera object is returned by ApideoRoom.startCamera.

In this release, the Camera object does not have any method. However, you have to keep a reference to this object if you want to be able to close a camera, using the ApideoRoom.removeCamera method.

Defined in apideo.js

Function Summary
public boolean onCameraMuted (Object callback)
Registers a callback function that will be called when the user refuses to activate its camera by clicking the "No" button when prompted the authorization to start its camera by Apideo.
public boolean onCameraStarted (Object callback)
Registers a callback function that will be called when the user clicks the "Yes" button when prompted the authorization to start its camera by Apideo.
public void onError (Object callback)
Registers a callback function that will be called if an error occurs in the camera stream.
public boolean onSecurityError (Object callback)
Registers a callback function that will be called if a security error occurs in the camera stream.
public boolean onUploadBandwidthMeasured (Object callback)
Registers a callback function that is called when the camera widget finished measuring the bandwidth available for upload.
public void resize (Object width, Object height)
Resizes the camera in the browser.
public boolean unregisterOnCameraMuted (Object callback)
Unregisters a callback function that was called when the user refused to activate its camera by clicking the "No" button when prompted the authorization to start its camera by Apideo.
public boolean unregisterOnCameraStarted (Object callback)
Unregisters a callback function that was called when the user clicks the "Yes" button when prompted the authorization to start its camera by Apideo.
public void unregisterOnError (Object callback)
Unregisters a callback function that is called when an error occurs in the camera stream.
public boolean unregisterOnSecurityError (Object callback)
Unregisters a callback function that is called when a security error occurs in the viewer stream.
public boolean unregisterOnUploadBandwidthMeasured (Object callback)
Unregisters a callback function that was called when the camera widget finished measuring the bandwidth available for upload.

Function Details

function onCameraMuted

public boolean onCameraMuted(Object callback)
Registers a callback function that will be called when the user refuses to activate its camera by clicking the "No" button when prompted the authorization to start its camera by Apideo.

Example usage:

 camera.onCameraMuted(function() {
 		... your code goes here ...
 });
 

The scope of the function is the current camera, so "this" in the function refers to the ApideoCamera object.

Parameters:
callback

function onCameraStarted

public boolean onCameraStarted(Object callback)
Registers a callback function that will be called when the user clicks the "Yes" button when prompted the authorization to start its camera by Apideo.

Example usage:

 camera.onCameraStarted(function() {
 		... your code goes here ...
 });
 

The scope of the function is the current camera, so "this" in the function refers to the ApideoCamera object.

Note: if the user clicks "No", you can catch the ApideoCamera.onCameraMuted event.

Parameters:
callback

function onError

public void onError(Object callback)
Registers a callback function that will be called if an error occurs in the camera stream.

Please note that if there is no event handler defined for the camera stream, the error is forwarded to the room. As soon as you define one event handler, the error event will no more be forwarded.

Example usage:

 camera.onError(function(category, type, msg) {
 		... your code goes here ...
 });
 

The scope of the function is the current camera, so "this" in the function refers to the ApideoCamera object.

The parameters passed to the callback function are:

  • category {string} - The category of the error.
  • type {string} - The technical type of the error.
  • msg {string} - The message of the error.

The most important parameter is the category. It can be one of:

  • connect - An error occured while connecting to the room.
  • disconnect - An connection error occured: the room has been disconnected.
  • error - An internal error occured.
  • server - An error occured on the server-side.
  • limit - You reached an Apideo limit. You might have exceeded the number of maximum simultaneous streams received, exceeded the maximum resolution/bandwidth, etc...
Parameters:
callback

function onSecurityError

public boolean onSecurityError(Object callback)
Registers a callback function that will be called if a security error occurs in the camera stream.

Access to a stream can be rejected if the token settings prevent access to publishing the stream (see Token-based security).

Please note that if there is no security error event handler defined for the camera stream, the error is forwarded to the security event handler of the room. As soon as you define one event handler, the error event will no more be forwarded.

Example usage:

 camera.onSecurityError(function(category, type, msg) {
 		... your code goes here ...
 });
 

The scope of the function is the current camera, so "this" in the function refers to the ApideoCamera object.

The parameters passed to the callback function are:

  • category {string} - The category of the error.
  • type {string} - The technical type of the error.
  • msg {string} - The message of the error.
Parameters:
callback

function onUploadBandwidthMeasured

public boolean onUploadBandwidthMeasured(Object callback)
Registers a callback function that is called when the camera widget finished measuring the bandwidth available for upload. The callback is called only if the autoThrottle parameter of the startCamera method is set to "true". The event contains the upload bandwidth available and the latency.

Example usage:

 camera.onUploadBandwidthMeasured(function(uploadBandwidth, latency) {
 		... your code goes here ...
 });
 

The scope of the function is the current camera, so "this" in the function refers to the ApideoCamera object.

Parameters:
callback

function resize

public void resize(Object width, Object height)
Resizes the camera in the browser.

The passed value are expressed in pixel.

You can also pass percentages, for instance:

camera.resize("100%", "100%");

If you pass percentages, the size used will be relative to the camera container. Please be sure to set the width and height of the container.

Parameters:
width
height

function unregisterOnCameraMuted

public boolean unregisterOnCameraMuted(Object callback)
Unregisters a callback function that was called when the user refused to activate its camera by clicking the "No" button when prompted the authorization to start its camera by Apideo.
Parameters:
callback

function unregisterOnCameraStarted

public boolean unregisterOnCameraStarted(Object callback)
Unregisters a callback function that was called when the user clicks the "Yes" button when prompted the authorization to start its camera by Apideo.
Parameters:
callback

function unregisterOnError

public void unregisterOnError(Object callback)
Unregisters a callback function that is called when an error occurs in the camera stream.
Parameters:
callback

function unregisterOnSecurityError

public boolean unregisterOnSecurityError(Object callback)
Unregisters a callback function that is called when a security error occurs in the viewer stream.
Parameters:
callback

function unregisterOnUploadBandwidthMeasured

public boolean unregisterOnUploadBandwidthMeasured(Object callback)
Unregisters a callback function that was called when the camera widget finished measuring the bandwidth available for upload.
Parameters:
callback