Widget Functions (Deprecated)

This section lists Upload Widget functions.

onOoyalaUploaderReady() Be sure to implement a function with the name onOoyalaUploaderReady as it will be called when the widget is ready. Wait for this function to be called before making any API requests. We recommend you set your parameters and add event listeners in this function. setParameters(String)

Specify your parameters including account information (pcode) and then sign them according to our signature generation instructions. The resulting string should be passed to setParameters.

To set parameters use:

ooyalaUploader.setParameters('<paramstring>')

Note: setParameters() must be invoked before starting upload, but it may be invoked after addDynamicLabel or setTitle/setDescription.
addEventListener(String,String)

In many cases you will wish to receive notifications when some events occur. At this point in time, the API only supports one listener per event. Subsequent calls to addEventListener will override previous handler assignments.

To register an event listener use:

ooyalaUploader.addEventListener('<event name>', '<event handler name>')

Note: Function names must be passed as strings, not as function references.

Example:

If you wish to register a listener to an IO error event.

ooyalaUploader.addEventListener('error', 'onUploaderIOError');

setTitle(String) and setDescription(String)

Pass in a user-entered title and description respectively.

To assign a title use:

ooyalaUploader.setTitle('<title>');

To assign a description use:

ooyalaUploader.setDescription('<description>');

Note: A title must be specified, but description may be left blank.
addDynamicLabel(String)

Adds dynamic (user-generated) label to the content. The label must match at least one regular expression specified in the dynamic[<id>] parameter of the setParameters() signed string.

To add a user-generated label to the uploaded videos use:

ooyalaUploader.addDynamicLabel('<labelname>');

Note: Validation is performed on the server, so, the partner can first add a label and then provide a signed parameter-string which matches that label.
validate()

Check that the uploader widget is ready to upload files. This returns null if the uploader is ready or an error string if some prerequisite is not met (e.g. file is not selected, title is not specified, file is too big, et cetera).

To validate an upload use:

ooyalaUploader.validate();

upload()

Begin file upload. Returns true if upload has been started or false if it has not. In subsequent events you may use validate() to retrieve the reason for the false return.

To start an upload use:

ooyalaUploader.upload();

Note: Only one upload can be active at a time, if concurrent uploads are initiated, upload() will return false and validate() will return null.

Was this article helpful?