Popcorn.js Documentation

Popcorn Constructor

The Popcorn constructor allows the user to create Popcorn instances. An optional options object can be passed along to set properties for the new instance of Popcorn. The constructor can also be used to listen for DOMContentLoaded, executing a callback function when your page has finished loading.

Popcorn( callback | id, optionsObject )

Purpose

Creates and returns a new Popcorn instance.

All Popcorn media methods, plugins and callbacks are chained directly from a Popcorn instance. The context will always be the instance itself.

Options

Examples

The following code examples show the various ways a Popcorn instance can be created.

1 Popcorn( "#video-element-id" );
1 Popcorn( "#video-element-id", {
2       frameAnimation: true
3     });
1 Popcorn( "#video-element-id", {
2       defaults: {
3         subtitle: {
4           target: "subtitle-div"
5         }
6       }
7     });
1 Popcorn(function() {
2       alert( "The page is loaded" );
3     });
1 Popcorn(function() {
2       Popcorn( "#video-element-id" );
3     });