In this topic:
This script is used in the following way:
You can find iuembed.js in the root of the Video Uploader installation folder.
To be able to use iuembed.js, it is necessary to link it with your page. You can do
<script> element with
src attribute set to the URL to the iuembed.js.
To embed the Video Uploader in the page, you need to do at least the following:
Here is a simple code snippet demonstrating this:
As you see, the VideoUploaderWriter constructor has three arguments: ID of the control, width, and height. You can change these values later using appropriate properties.
You can also configure other properties of the VideoUploaderWriter, for example a path to the VideoUploader file and its version number. See a full list of VideoUploaderWriter members at the end of this topic.
To initialize parameters of Video Uploader you should use the addParam method of the VideoUploaderWriter class instance before you call writeHtml.
The addParam method has two arguments: the name of the parameter and its value.
Here is a code example:
It takes a while to download and install Video Uploader. After download completes, the browser requires the user to click a button on the security dialog. Furthermore, if Video Uploader is loaded on Windows XP with Service Pack 2, the user should also click an information bar before the security dialog appears.
It may be quite embarrassing for the user. They may misunderstand installation instructions and reject installation when security dialog pops up.
If this happens, display re-installation instructions is a good idea. The iuembed.js exposes a number of properties that enables to do this.
The instructionsEnabled property specifies whether to display instructions. Set it to
to have instructions to appear. The instructionsCommon property specifies HTML code for those instructions which are
common for all client platforms. The instructionsWinXPSP2, instructionsNotWinXPSP2, and
instructionsVista values are appended to common instructions depending on the client platform (Windows Vista, Windows XP
with Service Pack 2, and others platforms respectively).
This code snippet demonstrates how to use it:
vu.instructionsEnabled = true; vu.instructionsCommon = "<p>Video Uploader ActiveX control is necessary to upload " + "your files quickly and easily. You will be able to select multiple images " + "in user-friendly interface instead of clumsy input fields with <strong>Browse</strong> button. " + "Installation will take up to a few minutes, please, be patient. To install Video Uploader, "; vu.instructionsNotWinXPSP2 = "please, reload the page and click the <strong>Yes</strong> button " + "when you see the control installation dialog."; vu.instructionsWinXPSP2 = "please click the <strong>Information Bar</strong>. After page reload click " + "<strong>Install</strong> when you see the control installation dialog."; vu.instructionsVista = "please click on the <strong>Information Bar</strong> and select " + "<strong>Install ActiveX Control</strong> from the dropdown menu. After page reload click " + "<strong>Continue</strong> and then <strong>Install</strong> when you see the control " + "installation dialog.";
To add event handlers do the following:
This code snippet demonstrates how it should be looking like:
To remove some previously added event listeners use the removeEventListener method which accepts the same parameters as the addEventListener.
The iuembed.js script contains a special function - getVideoUploader. It has the single argument - ID of the control, which you get a reference for (for example, specified when creating an instance of VideoUploaderWriter), and returns a reference to the control.
Here is an example of usage:
var videoUploader1 = getVideoUploader("VideoUploader1");
Sometimes you need to modify Video Uploader properties after initialization. The typical situation is when you need to change the view mode between detailed list and thumbnails using the HTML dropdown list.
To do it, you should get a reference to the VideoUploader control as described above, and modify the property value.
The syntax of runtime property modification is the following:
object.setPropertyName, where PropertyName is a name of the property as
specified in the properties reference.
To read a property value, use
object.getPropertyName property instead.
This code snippet demonstrates how to work with properties after initialization:
var videoUploader1 = getVideoUploader("VideoUploader1"); videoUploader1.setUploadView(videoUploader1.getFolderView());
To call methods of VideoUploader, you should use the same approach as you use for properties: get a reference to the VideoUploader and call the method using the following syntax:
object.MethodName(argument1, argument2, ...),
where MethodName is a name of the method as specified in the
Here is a code example:
var videoUploader1 = getVideoUploader("VideoUploader1"); videoUploader1.Send();
Quite often it is necessary to work with Video Uploader controls when you are sure that the page has been fully loaded and the control has been completely created and initialized.
Although you might use the window.onload to determine whether ActiveX control
is loaded, it is recommended to use the FullPageLoad event defined in the
iuembed.js file. It is raised when the page is loaded and the control is
completely ready to be used. To add handler for this event use the addEventListener
method with the
"FullPageLoad" event name parameter value:
The iuembed.js makes development and debugging of Video Uploader embedding script easier. It shows warnings if Video Uploader has wrong configuration.
To make debugging more efficient iuembed.js exposes three debug levels:
To specify the debug level you can use the code below before creating the VideoUploaderWriter object.
IUCommon.debugLevel = 2;
If debug messages are enabled (the debug level is
2) you will get
warnings in the following cases:
It is recommended to set the debug level to greater than
0 value on the development stage
only. Disable debug messages on production application.
For each control included into Video Uploader, the iuembed.js exposes an appropriate class:
Both these classes have the same members (see below). This reference will mention only VideoUploaderWriter for brevity, however keep in mind that other classes also have members.
paramName - a parameter name.
paramValue - a parameter value.
Adds a parameter with the specified name and value. It takes into effect when writeHtml or getHtml method is run.
eventName - an event name.
Verifies whether the control is installed. If yes, it returns
Verifies whether the control is installed and needed to be updated (if an earlier version of the control is already installed).
If yes, it returns
Generates the HTML code which will embed Video Uploader and returns it as a string. It will write all parameters added with the addParam method and append all event handlers specified by the addEventListener method.
|getParam||paramName - a parameter name.||
Returns parameter with a specified name.
eventName - an event name.
|removeParam||paramName - a parameter name.||
Removes parameter with a specified name.
Generates the HTML code which will embed Video Uploader and writes this code directly into the page. It will write all parameters added with the addParam method and append all event handlers specified by the addEventListener method.
The URL that specifies where to download the Video Uploader control from.
It is analogous to the codebase attribute of the
The minimum required version of the VideoUploader.cab. If the user has an older version installed, Internet Explorer downloads the VideoUploader.cab file from the URL provided by the activeXControlCodeBase property automatically.
The subversions should be separated only by commas. For example,
|height||N/A (provided in the constructor)||
Height of the control. You should provide an integer number. Syntax like
|id||N/A (provided in the constructor)||
ID of the control that is used to get a reference with a help of the getVideoUploader function.
Specifies whether and how Video Uploader will display a received server response. Possible values are:
This feature may be useful when debugging server scripts.
|width||N/A (provided in the constructor)||
Width of the control. You should provide an integer number. Syntax like
|getVideoUploader||ID - an ID of the control specified in the VideoUploaderWriter constructor.||
Returns a reference to the control by specified ID. Unlike