Documentation

  • Filter

Just like when you are using embedding events, system events allow you to just set it all up and have your code wait for callback from our system when something interesting happens.

The application events allow you to have a global way of knowing when something specific to an application (not to be confused by embedding events) happens.

If you are after events that happen on a single embedding where you need to know on which embeding this happened on, it would be best to use our embedding events. When you need to listen to specific event and you do not care which embedding it happened on, the application embedding events are what you need, for application only events please read on to see more.

It is good to mention that this works for v2 applications, so what this means is that if your code is pointing to v1-rXY or v2-rXY it will work nicely, however it will give you v2 application in which you would use v2 embedding codes.

You can set up the application as following:

    var application = new ZiggeoApi.V2.Application( {token:"YOUR_APPLICATION_TOKEN"} );

If you had already set it up and need to get it available within your code at a later time, you could get the default application by using the following:

    var application = ZiggeoApi.V2.Application.getDefault();

You could also even find the application using the application token if the application is not the default one:

    var application = ZiggeoApi.V2.Application.getByToken("YOUR_APPLICATION_TOKEN");

In the same sense, you can also set a default up at some later point by using the following:

    ZiggeoApi.V2.Application.setDefault(application);
  • It is good to point out that when we create a first application using the first code example above it will also set your application as a default one for entire page. As such you do not need to call the code to set up the default, unless you are using multiple apps in your setup and want to switch the default one.

The following examples will use the var application we have created above.

  1. error

    Various errors will be reported here, such as trying to play or record video without specifying the application token first.

    Example:
    application.on("error", function ( status_code, message ) {
    	//Your code goes here
    });
  2. ready

    This event uses DOM ready and fires once our system is completely loaded. As such it will always fire after DOM ready, however it should be set before DOM ready in order to fire properly.

    Example:
    application.on("ready", function (  ) {
    	//Your code goes here
    });