• English
  • Français

Class ApideoViewer


public class ApideoViewer
The ApideoViewer object represents the video player playing a stream from the server.

The Viewer object is returned by ApideoRoom.playStream.

Defined in apideo.js

Function Summary
public void hideDelay()
Hides the "live-delay" for the video connection.
public void onError (Object callback)
Registers a callback function that will be called if an error occurs in the played stream.
public boolean onSecurityError (Object callback)
Registers a callback function that will be called if a security error occurs in the camera stream.
public void resize (Object width, Object height)
Resizes the viewer in the browser.
public void showDelay()
Displays the "live-delay" for the video connection, in the bottom left corner of the player.
public void unregisterOnError (Object callback)
Unregisters a callback function that is called when an error occurs in the camera stream.

Function Details

function hideDelay

public void hideDelay()
Hides the "live-delay" for the video connection.

function onError

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

Please note that if there is no event handler defined for the played 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:

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

The scope of the function is the current viewer, so "this" in the function refers to the ApideoViewer 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. Most likely, you tried to change the logo and you do not have a pro-account or you provided buggy parameters...
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 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:

 viewer.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 ApideoViewer 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 resize

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

The passed value are expressed in pixel.

You can also pass percentages, for instance:

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

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

Parameters:
width
height

function showDelay

public void showDelay()
Displays the "live-delay" for the video connection, in the bottom left corner of the player.

The live delay is defined on Adobe flash documentation as the network transmission delay (lag time) between the sender and the viewer.

Actually, after testing thoroughly, it seems the livedelay measure cannot be fully trusted. However, event if not completely precise, it is good enough to provide rating of the average quality of the video connection.


function unregisterOnError

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