Kaltura Simple Uploader (KSU) - Integrate inside a Flash application

When using KUploader inside Flash or Flex Applications follow the following preliminary steps:

  • Edit KUpload.as, inside "init()" function, remove the following line:
    addEventListener(Event.ADDED_TO_STAGE, addedToSatgeHandler);

  • Create an init Object that contains the same parameters KUploader should get from flashVars when using HTML + Javascript mode.
  • Add the following init function, and call it passing the init Object you created.
    public function initKUploader (initParams:Object):void

    {

            var initCommand:InitCommand = new InitCommand(initParams);

            initCommand.execute();

    }

  • Create your UI in Flash/Flex.
  • On your upload button MOUSE_EVENT.CLICK listener call the browse(); method of KUploader.
  • To get the rest of the events to work in your Flash/Flex application edit "NotifyShellCommand.as" and replace the contents of execute() function with code to dispatch the events to your application instead of calling ExternalInterface.

After completing the upload flow, keep the ids of the entries that were added, and call the getentry API (using the flash/flex client library) to retrieve the new entry that was created.
You can also modify various parameters before upload using the KUploader APIs, see Kaltura Simple Uploader (KSU) - Website Integration Guide for a complete list of methods and parameters.

Important Security Note

Due to security restrictions in Flash Player v10, any browse operation must be triggered as a result of user-interaction, therefore, user must click the swf itself in order to show the file dialogue box.
To overcome this security restriction, it's advised not to use the browse() API function, but rather place the swf above the real GUI that the user interacts with, so that the actual "click" event is triggered from the KUploader flash.

Errors – Flash player Exceptions

  • Limitations error – "Cannot upload, limitations exceeded. Please check for errors" - thrown if the upload() function is invoked while an error *exists.
  • Upload error - "Cannot add entries, some uploads failed. Either re-upload or remove the files" - thrown if the addEntries() function is invoked while an error *exists.

The error can be polled by calling getError();

For further information about the KSU APIs and usage see Kaltura Simple Uploader (KSU) - Website Integration Guide

For further problem solving and details please refer to the Frequently Asked Questions on the KSU Integration guide.