JW Embedder Modes
The JW Embedder is a powerful new addition to the JW Player toolkit. It drastically simplifies the process of embedding video and ensures that your content is viewable on as many devices as possible.
Modes
The JW Embedder currently offers 3 modes:
-
Flash mode
- The original JW Player mode. Uses the Flash Platform to playback streaming and progressive video, images, and sound.
-
HTML5 mode
- HTML5 offers support on the most up-to-date browsers and devices such as the iPhone, iPad, and Android.
-
Download mode
- Download offers the widest range of compatibility, allowing users with almost any video capable device to view the content.
The player can only run in one mode at a time, and certain features (including plugins, skins, and the JavaScript API) are disabled in download mode. For more information on how the Embedder selects a mode, see the Mode Selection Algorithm
section below.
Setting Mode Order
By default, the JW Embedder will check to see if your configuration is playable in Flash, then HTML5, and finally the Download mode. However, you can change that order by adding the modes
parameter to your configuration, like so:
Note
- Don't set the flashplayer
property if you're using the modes
block. Instead, set the src
attribute of the element flash
type with the path to the Flash player.
Because each mode is checked in order, you'll need to specify modes
in terms of an array. Each object in the array must have a type, which corresponds to either flash, html5, or download.
Specifying an Alternate Configuration for a Mode
A situation may arise where you'd like to use a different configuration for each mode. For example, you may want to use Flash with RTMP by default, but fall back to an mp4 when in HTML5 or download mode. This can be done by setting the config
attribute of any mode in the modes
block, like so:
The embedder will then merge these values with your "default" configuration when embedding, with the mode specific configuration getting precedence.
Mode Selection Algorithm
The JW Embedder's mode selection algorithm is the brain of the embedder. It checks each mode (either in the default order, or in the order you specify) to see if the configuration you've provided can be played in that mode on your device. If no mode supports your configuration, the Embedder will leave the original HTML in place.
To determine if a given mode is playable, the Embedder looks at:
-
Browser capability - The embedder uses the canPlay method of HTML5 <video> browsers to determine if they can natively play back a piece of content
-
Presence of Flash - Flash mode will be immediately excluded if Flash is not present in your browser
-
File extension, or lack thereof - The embedder maintains a list of common file extension and whether they are playable in a given mode. The embedder will ignore this if no file extension is present.
-
Provider, or lack thereof - Certain modes cannot play certain providers and only Flash mode can play externally loaded Media Providers. The embedder will ignore this if no provider is present.
To determine if your file can be played in a specific mode, follow the decision trees below:
Flash
- Does the browser support Flash? If no, don't use Flash. If yes, move to 2.
- Is the provider option set? If yes, use Flash. If no, move to 3.
- Is a supported file extension detected? If yes, use Flash. If no, don't use Flash.
Supported extensions
3g2, 3gp, aac, f4a, f4v, flv, gif, jpg, m4a, m4v, mov (h.264), mp3, mp4, png
Supported providers
All
HTML5
- Is the provider option set? If no, move to 3. If yes, move to 2.
- Is the provider supported? If so, move to 3. If no, don't use HTML5.
- Is a supported file extension detected? If yes, go to 4. If no, don't use HTML5.
- Can the current browser play this file (canPlayType)? If yes, use HTML5. If no, don't use HTML5.
Supported extensions
- Firefox: ogg, ogv, webm (4.0), wav
- Chrome: f4a, f4v, m4a, m4v, m3u8, mov, mp3, mp4, ogg, ogv, wav, webm
- Safari: f4a, f4v, m4a, m4v, m3u8, mov, mp3, mp4, wav
- Opera: ogg, ogv, wav, webm
- Internet Explorer 9: aac, mp3, mp4
Supported providers
video, http, and YouTube
Download
- Is the provider option set? If yes, move to 2. If no, use Download.
- Is the provider option supported? If yes, use Download. If not, don't use Download.
Supported extensions
All
Supported providers
Video, http, image, sound, and YouTube