Sample Video bar using » Google Ajax Search API | |
Loading...
Loading...
|
Google AJAX Search API key | |
To use google API's within a web-site/blog, you need to have an API KEY that is specific to the URL/URI of website/blog.
For the Google Ajax Search API, you may generate just the key for your website/blog or you can use the wizard to generate the key along with the code relating to an application based on the Ajax Search API. Video Bar, Video Search Controls are applications based on the Google Ajax Search API. Using the wizard would be a convenient alternative, where you are starting just now. |
Generate Video Bar Code (including a key for your blog/website) | |
|
Generate Just the Google AJAX Search API key | |
If you intend to generate just a key specific to the URL/URI of your website/blog. This may be the case where you have collected the video bar code from elsewhere and intend to change just the key in the code.
This key would be used
You can generate the key as many times as you want, but each time a new key would be generated. » Code Generate
While displaying the generated key, you would find html code also getting generated and displayed below the key.
That code is not specific to the Videobar Application. To avoid confusion use the Videobar WIZARD to generate the code you need for the video bar.
Greater Customization of the Video Bar/Player
The explanation below this is for those who have an interest in hanlding programme code and are interested in learning things in detail. |
Include the code in your blog or web page | |
To make the video bar appear in your blog or web page, include the code within the html code of your web page.
In blogger blog, if you are using the modern widget based template for your blog, you can include (paste) the code within a HTML/Javascript Page Element (widget). If you have not used the wizard, ensure that the Access Key you generated is used in the code being placed. |
Positioning the Video Bar | |
» In any Web Page
You can place the bar and the player anywhere on your web page. The player displays the video when a user clicks on a thumbnail of a video within the bar.
Place the html code relevant to division displaying the bar/player at the location where you want them to appear. » In a blogger Blog
In blogger blog, if you are using the modern widget based template for your blog, you can position the widget where you want the video bar to appear.
Greater Customization of the Video Bar/Player
The explanation below this is for those who have an interest in hanlding programme code and are interested in learning things in detail. |
Loading the Ajax API & Video Bar Script | |
• STEP 1
This code can be placed within the head section or the body section of the web page. If you are using a wizard to create the code, you would be placing all the code at a single place, i.e. the body section where you intend the video bar and player to appear. • What are they for?
|
Positioning the Divisions displaying the Video Bar & the Video Player | |
• STEP 2
The text "Loading ..." indicates the default text that is displayed within the division till it is filled with content. • Where to place them?
There may be situations where you display two or more video bars. In such cases you may use the same player to play the videos from both the bars.
|
Formatting the Divisions displaying the Video Bar & the Video Player | |
The style definitions are to be included within the <style> tag and placed within the web page head section preferably. When you use the wizard for creating the code, this gets placed along with all other code. The code for formatting the division with the ID videoBar is given here. Any other css formatting code that is to be used can be included within the same style element. This is only optional and is thus not marked as a step. |
Creating and Configuring the Video Bar Control | |
• STEP 3 (Last)
Include this script within the web page either in the head or the body section. As far as possible place the code along with the other related code, so that you dont lose track of it.
The script is executed as when it is encountered by the browser. If it is placed within the head section of the web page, it is executed before the body content is loaded. The function GSearch.setOnLoadCallback() at the end of the script code, calls the function LoadVideoBar() and cause the code within it to get executed. • LoadVideoBar() execution
The execution of the function LoadVideoBar() will result in
|
Video Bar Options | |
There are a number of options that can be chosen for the video bar. In the example above, these options are assigned to the variable by name "options" and passed on to the video bar object. They form the arguments for the function call creating the videobar object.
The available options are • Orientation [Horizontal/Vertical] » horizontal : true
By default the video bar is oriented along the vertical. To make the video bar orient itself along the horizontal, use the argument horizontal : true.
This may be set to be false or completely ignored to obtain a vertically oriented video bar. Multiple options are separated by commas. • Number of Video Thumbnail in a Bar » largeResultSet : true
By default the video bar is set to display upto 4 video thumbnails. To display upto 8 video thumbnails, use the argument largeResultSet : true.
This may be set to be false or completely ignored to set the video bar to display the fewer number of video thumbnails. • Thumbnail Size » thumbnailSize : GSvideoBar.THUMBNAILS_SMALL
By default the video bar is set to display medium sized video thumbnails which are about 100px x 75px size. Small sized thumbnails which are approximately half the size of the medium thumbnails can be displayed using the option thumbnailSize : GSvideoBar.THUMBNAILS_SMALL.
To display medium sized thumbnails, either ignore the option or use the option • Custom String » string_allDone : "____"
Whenever a user clicks on the thumbnail, the video player is displayed with the phrase "i'm done watching this" at the top which also works as display text for a link that closes the player and folds away the division holding the player.
The text can be changed to any text string of your choice using the option string_allDone : "____", the dash taking the text you want to appear in place of i'm done watching this. • Auto Execute Lists »
Video Bar content can be refreshed with content relevant to the video search expressions within a list. The two parameters forming this option are an array of expressions forming the list and the cycle timer.
» Execute List Property
The execute list is an array of search expression strings.
executeList : [ "cartoons", "kids", "fun", "computers", "games" ]. Please avoid using a comma after the last expression in the array as the code may not function properly in IE with a trailing comma. » Cycle Time Property
cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM
The autoExecuteList.cycleTime defines the time between refreshes. At the end of each cycle, a new Video Search is performed from your list, and the cycle timer resets. The values may be
Where no mention is made of this property, the default value assumed is SHORT (10 seconds). » Cycle Mode Property
GSvideoBar.CYCLE_MODE_LINEAR
This property is used to set the cycle mode to either random or sequential.
Where no mention is made of this property, the default value assumed is LINEAR (sequential mode). The list is considered sequentially from the left to the right. » Status Root Property
statusRoot : document.getElementById("VideoBarStatus")
This property allows you to specify a location on the web page as a "status" area by placing the relevant code within the options and placing a division with the same ID on your web page where you want the list to be displayed.
The text Loading... is the text displayed in the division till it is filled with the content. The video bar will populate this area with the current contents of your auto execute list. The web page readers can click on links to manually switch the contents of the video bar. • Simplified Code
Where the auto execute list is used, the code for creating the videobar can be further simplified.
The execute method within the videobar object need not be called to initialize the video bar. Thus, declaring a variable and assigning the videobar object to the variable is not needed.
You have to name the videobar object if you intend to access it subsequently and change the content displayed in the video bar at the choice of the user. [Refer to this section below: Changing the video bar content using links] |
Multiple Video Bars on a Page | |
• Using Separate Players for Each Bar
If you intend to use separate players for each bar, then the process would be repeating step 3 and step 2 for each video bar to be displayed.
The divisions relating to each video bar and the players should be placed wherever you think them to be fit.
• The Same Players for one or more Video Bars
If you intend to use the same player for two or more bars, then a player is defined for one of the video bars in whose case, the steps would be the same as in the case of a video bar with its own player.
The code for the videobar that is set to use the player relating to another videobar needs to be modified to indicate the same. The video bar itself would have a division of its own and the division that holds the player is not present in such a case
» Options to indicate the player to use
master : vbarone
This indicates that the current video bar is set to use the video player relating to the video bar with the videobar object name vbarone. » null Argument passed for PlayerIn calling the function to create the videobar object, the second argument passing the data relating to the division to hold the video player is set to NULL
This indicates that the current video bar has no player of its own. |
Player Size | |
|
Formatting » Videobar, Text above and below the player | |
The box holding the thumbnails displaying the video within the video bar, the text displayed above the video player and the text displayed below the video player can be formatted using the CSS style properties which would override the default settings in the file "gsvideobar.css".
Any of the style properties that are capable of being used for the relevant element can be used. |
Changing Video Bar Content using Links | |
The videos displayed listed within the video bar for the first time are dependent on the keywords used while creating the videobar object. Subsequently, the content can be changed by calling the objects execute method and passing on the new keywords as argument.
The link can be created using the anchor tag or any other element using the html event attributes onclick, onmouseover, etc. In vbr.execute('kids fun'), vbr is the variable name that holds the video bar object created. The variable should have been declared as a global variable to be accessible using such a link. In the example given to the right, the variable vbarmain is declared within the function and is thus local to that function. It can only be accessed from within the function. The variable vbarone is declared outside the function (all functions) and is thus accessible from anywhere. |
Want to Know More!! | |
• About the Tech behind the Videobar
If you have understood the functioning of the product "videobar" and if you are proficient in javascript, viewing the javascript code that has been used for the product would be useful in getting an understanding of the tech behind the product.
You can access a copy of the code using the url within the html element used for inserting the code. gsearch: uds.js and VideoBar: gsvideobar.js • Formatting
If you are proficient with CSS properties and have the patience and interest to experiment, you can get greater details from this file which is the CSS file linked to videobar and you may also get some idea from the CSS file linked to the googlesearch.
|
Author Credit : The Edifier |