ActiveVideo Framework Overview
ActiveVideo provides several libraries to make development easier and faster. By adding just the av.js library, you will have access to all of the ActiveVideo libraries and methods. This article will describe how to add this library, detail some of the features, and show some examples of how to intergrate a few features of av.js.
ActiveVideo av.js Set Up
- Click the Tools tab on the developer community page.
- Select ActiveVideo Framework (avhtml).
- Download av.js (the latest version) into the top level ("test") of your project.
- After downloading it, unzip it into a folder (named "avhtml") in your project. (When you unzip it, it should automatically create the "avhtml" folder, as shown in the example below.)
Add the av framework and configuration files to your HTML page as follows:
You can place the scripts and configs whereever you like but the pathing shown in the example represent ActiveVideo Best Practices. av.js is the main ActiveVideo library to include. This allows you to take advantage of all of the prewritten libraries and methods, including (among many others) logging, cookies, keyboard manipulation, and more.
Including just this one file is all you need to get started. More details on configuration of libraries will be shown later starting at the 'Configuration' section. Below are some examples of how to use the av.js libary.
Example: Logging with the av.js library
These will both print output to the console (The CloudTV Player Logging window if running in CloudTV Player). As noted in the Configuration section, setting the av.logLevel will adjust what types of output gets sent to the console.
The benefit of using av.log.debug() instead of console.log() directly is that you can easily disable them when going live, or only enable error() messages.
Example: Saving data to cookies
Now you can set a cookie or get a cookie if you believe it already exists
For a full listing of libaries methods as well as details on the functionality, see "ActiveVideo Framework Libraries" in the Related Articles section below.
ActiveVideo av.js Configuration
Add the following to your HTML page to include configuration files:
avconfig.js will contain your main global configuration parameters. avlocalize.js allows you to specify an overriding config specific to your deployment. This configuration file set up is not required to be done exactly like this, but following this ActiveVideo Best Practice will help you later when trying to use the ActiveVideo Library.
avconfig.js will look something like this:
You will notice that you can set configurations for different parts of the ActiveVideo Library in the avconfig.js file. For example, you can set the logLevel (av->logLevel) to 0-5; this will affect the logging that gets sent to the console.
avlocalize.js will look something like this:
2 Ways to Load Libraries
- Using Script tags: (the benefit of this method is that if errors are thrown, the line numbers will be available in the console of where the error occurred)
- Using av.require()