Post by Eton Bones on Apr 1, 2008 19:18:07 GMT -5
The Any Video in Post (AViP) code supports addons that can expand the video types. All addons go in the header below the header portion of the main AViP code since they require the AviP vidType object to already have been created so they can modify it.
Because an addon needs to ensure that the vidType object exists it should go inside an if statement like so:
Because an addon needs to ensure that the vidType object exists it should go inside an if statement like so:
if(window['vidType']){
vidType['typename']={}; //define new type
vidType['typename'].propertyname= value; //set property
}
vidType['typename']={}; //define new type
vidType['typename'].propertyname= value; //set property
}
- Typename
The typename needs to be unique and not clash with an existing type and is also case sensitive. For example a typename of HBO would be different than a typename of hbo - Properties
There are several properties that can be used to define a video type, one is mandatory while all others are optional:[bg=mistyrose]note: all properties are case sensitive and should always be in lowercase - prefix (mandatory): A string containing the direct url to fetch the video. The part of the url that uniquely identifies the video should have a placeholder of %video%
example:www.youtube.com/v/%video%
- maxwidth (optional): A string that defines the maximum width in pixels this video type can attain. This value will be ignored if it exceeds the maximum width defined in _Globals.
- maxheight (optional): A string that defines the maximum height in pixels this video type can attain. This value will be ignored if it exceeds the maximum width defined in _Globals.
- custom (optional): An object used to define customizations depending on current skin. If the video player supports a selectable color scheme this is where you would define the colors.
example: vidType['YouTube'].custom= {skin1:'color1=0x234900&color2=0x4e9e00',skin2:'color1=0x000000&color2=0xFFFFFF',skinall:'border=1'}
[bg=mistyrose]note:skinall applies to all skins - preprocess (optional): A function used to process data before the embed code is constructed. A common use of this property is to define a function that processes the video identifier entered by the person posting the video to strip away unnecessary data. For instance if a person posts an entire youtube url instead of just the identifier the function would extract just the part it needs. Another use can be seen by examining the Yahoo entry in vidType. Since yahoo requires two numeric identifiers to uniquely identify a video a function is created to process the second identifier.
- postprocess (optional): A function used to process data after the embed code has been constructed. The real player type uses this to define a function that creates a second embed since realplayer requires separate embeds for the controls and video display
- checkid (optional): a function that validates the video identifier. If the function returns false then all other processing is abandoned and no embed will be created for that particular video tag.
- params (optional): An object containing a list of parameters that will be applied to the video type. If parameters defined in _Global have the same name as a parameter defined here then then these parameters take precedence over the globals.
- description (optional): A string containing a short name that will be used instead of the typename in the video selection dropdown.
- example (optional): A string containing an url showing an example of how to insert a video of this type.
- autolink(optional): A function that is passed the cell containing the contents of a post so it can search for video links of the type it can handle in that post and convert them to videos that play inside the post. There should be a return value of true or false depending on success or failure. This function will only be called if the typename is listed under vidtype._Globals.autoLink giving the admin control over which links get auto-converted
- prefix (mandatory): A string containing the direct url to fetch the video. The part of the url that uniquely identifies the video should have a placeholder of %video%