Popcorn.js Documentation

Plugins

Plugins add additional functionality to the users Popcorn video. They bring a large set of additional features from across the web, such as GoogleMaps, Facebook, Twitter, and many more. In doing so, users can add additional content from these web services and begin to create Popcorn experiences.

Attribution

Purpose

Allows the user to add proper attribution to the various sources used on the current page. In the most basic sense, the attribution plugin adds text to a specified area on the page.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that the text needs to be attached to, this target element must exist on the DOM
  • nameofwork [String] - is the title of the attribution
  • nameofworkurl [String] - is a url that provides more details about the attribution
  • copyrightholder [String] - is the name of the person/institution that holds the rights to the attribution
  • copyrightholderurl [String] - is the url that provides more details about the copyright holder
  • license [String] - is the type of license that the work is copyrighted under
  • licenseUrl [String] - is the url that provides more details about the license type

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.attribution({
 4       start: 0,
 5       end: 10,
 6       nameofwork: "A Shared Culture",
 7       copyrightholder:"Jesse Dylan",
 8       license: "CC-BY-N6",
 9       licenseurl: "http://creativecommons.org/licenses/by-nc/2.0/",
10       target: "attribdiv"
11     });

Live demo of the attribution plugin

Code

Purpose

The Code plugin allows the user to run arbitrary JavaScript code according to video timing.

Options

  • start [Number] - is the time [in seconds] that you want this plugin to execute.
  • end [Number] - is the time [in seconds] that you want this plugin to stop executing.
  • onStart [Function] - the function to be run when the start time is reached.
  • onFrame [Function] - a function to be run on each paint call (e.g., called ~60 times per second) between the start and end times.
  • onEnd [Function] - a function to be run when the end time is reached.

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.code({
 4       start: 1,
 5       end: 3,
 6       onStart: function( options ) {
 7         document.getElementById( "test1" ).innerHTML = "Yes";
 8       },
 9       onEnd: function( options ) {
10         document.getElementById( "test1" ).innerHTML = "No";
11       }
12     });

Live demo of the code plugin

Facebook

Purpose

The facebook plugin allows the user to bring popular aspects from facebook and display them to the user between a given start and end time. Features a like box, a stream of a user’s friends, comments on a specific post, and many more.

Options

  • Sets options according to user input or default values

  • type [String] - is the name of the plugin in fbxml format. Options: LIKE (default), LIKE-BOX, ACTIVITY, FACEPILE
  • target [String] - is the id of the document element that the text needs to be attached to. This target element must exist on the DOM
  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing

  • Other than the mandatory four parameters, there are several optional parameters (Some options are only applicable to certain plugins)

  • action [String] - like button will either “Like” or “Recommend”. Options: recommend / like (default)
  • always_post_to_friends [Boolean] - live-stream posts will be always be posted on your facebook wall if true. Options: true / false (default)
  • border_color [String] - border color of the activity feed. Names (i.e: “white”) and html color codes are valid
  • colorscheme [String] - changes the color of almost all plugins. Options: light (default) / dark
  • event_app_id [String] - an app_id is required for the live-stream plugin
  • font [String] - the font of the text contained in the plugin. Options: arial / segoe ui / tahoma / trebuchet ms / verdana / lucida grande
  • header [Boolean] - displays the title of like-box or activity feed. Options: true / false (default)
  • href [String] - url to apply to the plugin. Default is current page
  • layout [String] - changes the format of the ‘like’ count (written in english or a number in a callout). Options: box_count / button_count / standard (default)
  • max_rows [Number] - number of rows to disperse pictures in facepile. Default is 1
  • recommendations [Boolean] - shows recommendations, if any, in the bottom half of activity feed. Options: true / false (default)
  • show_faces [Boolean] - show pictures beside like button and like-box. Options: true / false (default)
  • site [String] - href for activity feed. No idea why it must be “site”. Default is current page
  • stream [Boolean] - displays the latest posts from the specified page’s wall. Options: true / false (default)
  • type [String] - determines which plugin to create. Case insensitive
  • xid [String] - unique identifier if more than one live-streams are on one page

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.facebook({
 4       type: "live-stream",
 5       target: "activitydiv",
 6       start: 1,
 7       end: 10,
 8       // id is from example http://developers.facebook.com/docs/reference/plugins/live-stream/
 9       event_app_id: 174243249296725
10     });

Live demo of the facebook plugin;

Flickr

Purpose

The Flickr plugin allows the user to hook into the popular picture hosting site and retrieve images based on user, search term, and provided dimensions.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • userid [String] - is the id of who’s Flickr images you wish to show
  • tags [String] - is a mutually exclusive list of image descriptor tags
  • username [String] - is the username of who’s Flickr images you wish to show. Using both userid and username is redundant. An api_key is required when using username
  • apikey [String] - is your own api key provided by Flickr
  • target [String] - is the id of the document element that the images are appended to, this target element must exist on the DOM
  • numberofimages [Number] - specify the number of images to retrieve from Flickr, defaults to 4
  • height [String] - the height of the image, defaults to ‘50px’
  • width [String] - the width of the image, defaults to ‘50px’
  • padding [String] - number of pixels between images, defaults to ‘5px’
  • border [String] - border size in pixels around images, defaults to ‘0px’

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.flickr({
4       start: 5,
5       end: 15,
6       userid: "35034346917@N01",
7       target: "flickrdiv"
8     });

Footnote

Purpose

Adds text to an element on the page.

Options

  • start [Number] - is the time [in seconds] when you want the footnote to appear.
  • end [Number] - is the time [in seconds] when you want the footnote to become hidden.
  • text [String] - The text you want to appear in the target.
  • target [String] - The id of the document element that the text is to be attached to. This target element must exist on the DOM

Example

1 var p = Popcorn( "#video" ).footnote({
2       start: 5,
3       end: 15,
4       text: 'This text will appear in "target". ',
5       target: "footnotediv"
6     });

GML

Purpose

Renders a GML (Graffiti Markup Language) tag inside an HTML element

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that you wish to render the graffiti in
  • gmltag [Number] - is the numerical reference to a gml tag via 000000book.com

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.gml({
4       start: 0,
5       end: 5,
6       gmltag: "29582",
7       target: "gmldiv"
8     });

Live demo of the gml plugin

Googlefeed

Purpose

Adds a feed from a specified blog url into the target div

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the DOM element that you want the feed to appear in. This element must be in the DOM
  • url [String] - is the url of the blog’s feed you are trying to access
  • title [String] - is the title of the blog you want displayed above the feed
  • orientation [String] - is the orientation of the blog, accepts either Horizontal or Vertical, defaults to Vertical

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.googlefeed({
 4       start: 0,
 5       end: 15,
 6       target: "feed",
 7       url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
 8       title: "Planet Feed",
 9       orientation: "Vertical"
10     });

Live demo of the googlefeed plugin

Googlemap

Purpose

Adds a map to the target div centered on the location specified by the user.

Options

  • start [Number] - is the time [in seconds] when you want the Googlemap to appear.
  • end [Number] - is the time [in seconds] when you want the Googlemap to become hidden.
  • target [String] - Target is the id of the DOM element that you want the map to appear in. This element must be in the DOM
  • type [String, optional] - either: HYBRID (default), ROADMAP, SATELLITE, TERRAIN, STREETVIEW
  • zoom [Number, optional] - defaults to 0
  • heading [Number, optional] - STREETVIEW orientation of camera in degrees relative to true north (0 north, 90 true east, etc)
  • pitch [Number, optional] - STREETVIEW vertical orientation of the camera (between 1 and 3 is recommended)
  • lat [Number] - The Latitude that the map should be centered on.
  • lng [Number] - The Longitude that the map should be centered on. (NOTE: Lat and Lng bust be specified if no Location is provided.)
  • location [String] - An address/location to center the map on. Must be present if lat and lng are not specified.
  • onmaploaded [Function, optional] - A callback function that gets fired once the map has loaded. The callback function also receives the options object as well as a reference to the map object.

Note: using location requires extra loading time, also not specifying both lat/lng and location will cause and error.

Tweening

Tweening animates a streetview from one location to another.

  • location [String] - The start point when using an auto generated route
  • interval [Number] - is the speed in which the tween will be executed, a reasonable time is 1000 (time in milliseconds)
  • heading, Zoom, and Pitch [Number] - streetview values are also used in tweening with the autogenerated route (see above)
  • tween [Object] - An array of objects, each containing data for one frame of a tween
  • position [Object] - An object with two keys, lat and lng, both which are mandatory for a tween to work
  • pov [Object] - An object which houses heading, pitch, and zoom paramters, which are all optional, if undefined, these values default to 0

Example

1 var p = Popcorn( "#video" ).googlemap({
2       start: 5,
3       end: 15,
4       type: "ROADMAP",
5       target: "map",
6       lat: 43.665429,
7       lng: -79.403323
8     });
 1 var p = Popcorn( "#video" ).googlemap({
 2       start: 1,
 3       end: 5,
 4       type: "STREETVIEW",
 5       target: "map2",
 6       location: "Toronto, Ontario, Canada",
 7       onmaploaded: function( options, map ) {
 8         // map is a reference to the actual map object
 9         // options is the options object that was passed in initially
10       }
11     });

Image

Purpose

Show an image inside a given element on the page.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • href [String] - is the url of the destination of a link - optional
  • target [String] - is the id of the document element that the iframe needs to be attached to, this target element must exist on the DOM
  • src [String] - is the url of the image that you want to display
  • text [String] - is the overlayed text on the image - optional

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.image({
 4       // seconds
 5       start: 5,
 6       // seconds
 7       end: 15,
 8       href: "http://www.drumbeat.org/",
 9       src: "https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
10       text: "DRUMBEAT",
11       target: "imagediv"
12     });

Live demo of the image plugin

Lastfm

Purpose

Appends information about a LastFM artist to an element on the page.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • artist [String] - is the name of who’s LastFM information you wish to show
  • target [String] - is the id of the document element that the images are appended to, this target element must exist on the DOM
  • apiKey [String] - is the API key registered with LastFM for use with their API

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.lastfm({
4       start: 5,
5       end: 15,
6       artist: "yacht",
7       target: "lastfmdiv",
8       apikey: "30ac38340e8be75f9268727cb4526b3d"
9     });

Live demo of the lastfm plugin

Linkedin

Purpose

Places a LinkedIn plugin inside a div

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that the plugin needs to be attached to, this target element must exist on the DOM
  • type [String] - is the name of the plugin, options are share, memberprofile, companyinsider, companyprofile, or recommendproduct
  • apikey [String] - is your own api key from obtained from https://www.linkedin.com/secure/developer
  • url [String] - is the desired url to share via LinkedIn. Defaults to the current page if no url is specified
  • counter [String] - is the position where the counter will be positioned. This is used if the type is “share” or “recommendproduct”. The options are right and top (don’t include this option if you do not want a counter)
  • format [String] - is the data format of the member and company profile plugins. The options are inline, hover, and click. Defaults to inline
  • companyid [String] - must be specified if the type is “companyprofile,” “companyinsider,” or “recommendproduct”
  • productid [String] - must be specified if the type is “recommendproduct”

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.linkedin({
 4       type: "share",
 5       counter: "right",
 6       url: "http://www.google.ca",
 7       target: "sharediv",
 8       apikey: "ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk",
 9       start: 1,
10       end: 4
11     });

Live demo of the linkedin plugin

Lowerthird

Purpose

Displays information about a speaker over the video, or in the target div

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that the content is appended to, this target element must exist on the DOM
  • salutation [String] - is the speaker’s honorific, e.g.: Mr., Ms., Dr., etc.
  • name [String] - is the speaker’s name.
  • role [String] - is information about the speaker, e.g.: Engineer.

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.lowerthird({
4       start: 5,
5       end: 15,
6       salutation: "Mr",
7       name: "Hyde",
8       role: "Monster"
9     });

Live demo of the lowerthird plugin

Manifest

Purpose

Manifests are used by our authoring tool Popcorn-Maker to create meaningful editors.

Manifests are simply objects that contain data about who wrote the plugin, each option the plugin exposes (start, end, target, etc.), as well as defining what type of element is best used to represent the specified option in the editor (input, select, dropdown, etc.) and the corresponding data for each of those elements (an array of data for select and dropdown, text for input, etc.).

Options

  • about [Object] - an object that defines who wrote this plugin
  • options [Object] - an object containing various other objects for each option that is passed on to the user

Use Case

You want your plugin to be used in butter

Examples

The following example shows what a manifest might look like (the googlemaps manifest in this example)

 1 {
 2       about: {
 3         name: "Popcorn Google Map Plugin",
 4         version: "0.1",
 5         author: "@annasob",
 6         website: "annasob.wordpress.com"
 7       },
 8       options: {
 9         start: {
10           elem: "input",
11           type: "text",
12           label: "In"
13         },
14         end: {
15           elem: "input",
16           type: "text",
17           label: "Out"
18         },
19         target: "map-container",
20         type: {
21           elem: "select",
22           options: [ "ROADMAP", "SATELLITE", "STREETVIEW", "HYBRID", "TERRAIN" ],
23           label: "Type"
24         },
25         zoom: {
26           elem: "input",
27           type: "text",
28           label: "Zoom"
29         },
30         lat: {
31           elem: "input",
32           type: "text",
33           label: "Lat"
34         },
35         lng: {
36           elem: "input",
37           type: "text",
38           label: "Lng"
39         },
40         location: {
41           elem: "input",
42           type: "text",
43           label: "Location"
44         },
45         heading: {
46           elem: "input",
47           type: "text",
48           label: "Heading"
49         },
50         pitch: {
51           elem: "input",
52           type: "text",
53           label: "Pitch"
54         }
55       }

Mustache

Purpose

Adds the ability to render JSON using templates via the Mustache templating library.

Options

  • start [Number] - the time [in seconds] when the mustache template should be rendered in the target div.
  • end [Number] - the time [in seconds] when the rendered mustache template should be removed from the target div.
  • target [String] - a String – the target div’s id.
  • template [String Function] - the mustache template for the plugin to use when rendering. This can be a String containing the template, or a Function that returns the template’s String.
  • data [String Object Function] - the data to be rendered using the mustache template. This can be a JSON String, a JavaScript Object literal, or a Function returning a String or Literal.
  • dynamic [Boolean] - an optional argument indicating that the template and json data are dynamic and need to be loaded dynamically on every use. Defaults to True.

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.mustache({
 4       start: 5,  // seconds
 5       end:  10,  // seconds
 6       target: 'mustache-div',
 7       template: '<h1></h1>'                              +
 8         ''                                               +
 9         '  '                                             +
10         '    <li><strong></strong></li>'                   +
11         '  '                                             +
12         '  '                                              +
13         '    <li><a href=""></a></li>'              +
14         '  '                                              +
15         ''                                               +
16         ''                                                         +
17         ''                                               +
18         '  <p>The list is empty.</p>'                              +
19         ''                                               ,
20       data:     '{'                                                +
21         '  "header": "Test 1", '                                   +
22         '  "items": [ '                                            +
23         '      {"name": "red", "first": true, "url": "#Red"}, '    +
24         '      {"name": "green", "link": true, "url": "#Green"}, ' +
25         '      {"name": "blue", "link": true, "url": "#Blue"} '    +
26         '  ],'                                                     +
27         '  "empty": false'                                         +
28         '}',
29       static: true /* The json is not going to change, load it early. */
30     });

Live demo of the mustache plugin

OpenMap

Purpose

Adds an OpenLayers map and open map tiles (OpenStreetMap [default], NASA WorldWind, or USGS Topographic)

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the DOM element that you want the map to appear in. This element must be in the DOM
  • type [String] - either: ROADMAP (OpenStreetMap), SATELLITE (NASA WorldWind / LandSat), or TERRAIN (USGS). ROADMAP/OpenStreetMap is the default.
  • zoom [String] - the amount the map is zoomed in, defaults to 2
  • lat and lng [String] - are the coordinates of the map if location is not named
  • location [String] - is a name of a place to center the map, geocoded to coordinates using TinyGeocoder.com
  • markers [Array] - is an array of map marker objects, with the following properties:
    • icon [String] - is the URL of a map marker image
    • size [Number] - is the radius in pixels of the scaled marker image (default is 14)
    • text [String] - is the HTML content of the map marker – if your popcorn instance is named ‘popped’, use <script>popped.currentTime(10);</script> to control the video
  • Note: using location requires extra loading time, also not specifying both lat/lng and location will cause a JavaScript error.

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.openmap( {
 4       start: 0,
 5       end: 20,
 6       type: "ROADMAP",
 7       target: "map",
 8       lat: 43.665429,
 9       lng: -79.403323,
10       zoom: "10"
11     });

Live demo of the openmap plugin

Pause

Purpose

When this plugin is used, links on the webpage, when clicked, will pause popcorn videos that specified pauseOnLinkClicked as an option

Links may cause a new page to display on a new window, or may cause a new page to display in the current window, in which case the videos won’t be available anymore. It only affects anchor tags. It does not affect objects with click events that act as anchors.

Options

  • pauseOnLinkClicked [Boolean] - Specifies whether to have the pause on link clicked functionality turned on or off

Example

1 var pop = Popcorn( "#video" , {
2       pauseOnLinkClicked: true
3     });

Live demo of the pause plugin

Processing

Purpose

This plugin adds a Processing.js sketch to be added to a target div or canvas.

Options

  • start [Number] - is the time [in seconds] when you want the sketch to display and start looping.
  • end [Number] - is the time [in seconds] when you want the sketch to become hidden and stop looping.
  • target [String] - is the id of the div or canvas you want the target sketch to be displayed in. A target that is a div will have a canvas created and placed inside of it.
  • sketch [String] - specifies the filename of the Procesing code to be loaded into Processing.js
  • noLoop [Boolean] - specifies whether a sketch should continue to loop when the video is paused or seeking.

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.processing({
4       start: 0,
5       end: 10,
6       target: "processing-div",
7       sketch: "test.pjs",
8       noPause: true
9     });

Subtitle

Purpose

Displays a subtitle over the video, or in the target div

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that the content is appended to, this target element must exist on the DOM
  • text [String] - is the text of the subtitle you want to display.

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.subtitle({
4       start: 5,
5       end: 15,
6       text: "this is the first subtitle of 2011",
7     });

Live demo of the subtitle plugin

Tagthisperson

Purpose

Adds people’s names to an element on the page.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • person [String] - is the name of the person who you want to tag
  • image [String] - is the url to the image of the person - optional
  • href [String] - is the url to the webpage of the person - optional
  • target [String] - is the id of the document element that the text needs to be attached to, this target element must exist on the DOM

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.tagthisperson({
 4       start: 0,
 5       end: 10,
 6       person: "Anna Sob",
 7       image: "http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg",
 8       href: "http://annasob.wordpress.com",
 9       target: "tagdiv"
10     });

Live demo of the tagthisperson demo

Timeline

Purpose

Adds data associated with a certain time in the video, which creates a scrolling view of each item as the video progresses

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing, though for this plugin an end time may not be needed (optional)
  • target [String] - is the id of the DOM element that you want the timeline to appear in. This element must be in the DOM
  • title [String] - is the title of the current timeline box
  • text [String] - is simply related text that will be displayed
  • innerHTML [String] - gives the user the option to add things such as links, buttons and so on
  • direction [String] - specifies whether the timeline will grow from the top or the bottom, receives input as “UP” or “DOWN”

Example

 1 var pop = Popcorn( "#video" );
 2 
 3     pop.timeline({
 4       start: 1,
 5       target: "timeline",
 6       title: "This is a title",
 7       text: "this is some interesting text that goes inside",
 8       innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>" ,
 9       direction: "up"
10    });

Live demo of the timeline plugin

Tumblr

Purpose

The tumblr plugin allows the user to bring in blog posts of various types, a blog avatar or a blog info and display its information at a given start and end time. All blog post types are supported (text, audio, video, photo, chat, answer, quote, link).

Options

The following options are required by all plugin types:

  • requestType [String] - is the name of the type of tumblr plugin request being made. Options: INFO, AVATAR, BLOGPOST.
  • target [String] - is the id of the document element that the text needs to be attached to. This target element must exist on the DOM.
  • start [Number] - is the time [in seconds] that you want this plug-in to execute.
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing.

The following option is required by BLOGPOST and INFO requests:

  • api_key [String] - is the API key registered with Tumblr for use with their API.

The following option is required for BLOGPOST requests:

  • blogId [Number] - is the id that identifies a unique blog post. This is used for the user to specify the specific post they want to be displayed.

The following option is optional for AVATAR requests:

  • size [Number] - is the width in pixels that the returned image will be.

The following options is optional for BLOGPOST requests:

  • width [Number] - is the width of the video or photo being returned. Defaults to 250 pixels for photo blog posts and 400 for video blog posts.

Example

 1 var pop = Popcorn("#video");
 2     
 3     pop.tumblr( {
 4       start: 1, 
 5       end: 4,
 6       requestType: 'blogpost',
 7       target: 'tumblrBlogInfodiv',
 8       base_hostname: "john.io",
 9       blogId: 10596794348,
10       api_key: "7lQpV9mMr2PiYjd20FavZcmReq8cWU0oHTS6d3YIB8rLUQvvcg" 
11     } );

Live Demo of the Tumblr Plugin

Twitter

Purpose

Appends a Twitter widget to an element on the page.

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • src [String] - is the hash tag or twitter user to get tweets from
  • target [String] - is the id of the document element that the images are appended to, this target element must exist on the DOM
  • height [Number] - is the height of the widget [in pixels], defaults to 200
  • width [Number] - is the width of the widget [in pixels], defaults to 250

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.twitter({
4       start: 5,
5       end: 15,
6       title: "Steve Song",
7       src: "@stevesong",
8       target: "twitterdiv",
9     });

Live demo of the twitter plugin

Webpage

Purpose

Creates an iframe showing a website specified by the user

Options

  • start [String] - is the time [in seconds] that you want this plug-in to execute
  • end [String] - is the time [in seconds] that you want this plug-in to stop executing
  • id [String] - is the id that you want assigned to the iframe
  • target [String] - is the id of the document element that the iframe needs to be attached to, target element must exist on the DOM
  • src [String] - is the url of the website that you want the iframe to display

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.webpage({
4       id: "webpages-a",
5       start: 0,
6       end: 5,
7       src: "http://webmademovies.org/",
8       target: "webpagediv"
9     });

Live demo of the webpage plugin

Wikipedia

Purpose

Displays a wikipedia article in the target specified by the user by using a new DOM element instead of overwriting them

Options

  • start [Number] - is the time [in seconds] that you want this plug-in to execute
  • end [Number] - is the time [in seconds] that you want this plug-in to stop executing
  • target [String] - is the id of the document element that the text from the article needs to be appended to, this target element must exist on the DOM
  • lang [String] - (optional, defaults to english) is the language in which the article is in.
  • src [String] - is the url of the article
  • title [String] - (optional) is the title of the article
  • numberofwords [Number] - (optional, defaults to 200) is the number of words you want to display.

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.wikipedia({
4       start: 0,
5       end: 10,
6       src: "http://en.wikipedia.org/wiki/Cape_Town",
7       title: "this is an article",
8       target: "wikidiv"
9     });

Live demo of the wikipedia plugin

Wordriver

Purpose

Displays a string of text, fading it in and out while transitioning across the height of the parent container for the duration of the instance (duration = end - start)

Options

  • start [Number] - is the time [in seconds] that you want the Word River animation to begin
  • end [Number] - is the time [in seconds] that you want the Word River animation to finish
  • text [String] - the text you want to be displayed by Word River
  • target [String] - the target div to append the text to
  • color [String] - the color of the text. Can be an Hex value i.e. #FFFFFF

Example

1 var pop = Popcorn( "#video" );
2 
3     pop.wordriver({
4       start: 1,
5       end: 3,
6       text: "hello",
7       target: "wordriverdiv",
8       color: "red"
9     });

Live demo of the wordriver plugin