Core Player Provider

The Core Player Provider provides widgets to embed Windows Media Player, QuickTime player, Adobe ® Flash® player, VLC Media Player, DivX® Web Player plugins and HTML5 Video to GWT applications.

GWT Module Inheritance / Provider Name

Add the following line to your GWT XML application module file to include the player provider in your application:

<inherits name="com.bramosystems.oss.player.core.CorePlayerProvider" />

The provider is registered with the API as "core"

Version Dependency Matrix

The following table lists the minimum version of the package dependencies required by the player provider:

Core Player Provider version BST Player API version GWT version
2.0 2.0.1 2.2

Provided player widgets

The following table lists all player widgets available with the Core Player Provider package, the supported plugin and the minimum plugin version required on the browser.

Player Widget Provider Name Media Plugin Minimum plugin version
DivXPlayer DivXPlayer DivX® Web Player plugin 2.0.1
FlashMediaPlayer FlashPlayer Flash® Player plugin 10.0
QuickTimePlayer QuickTimePlayer Quicktime Player plugin 7.2.1
VLCPlayer VLCPlayer VLC Media Player plugin 2.0.2
WinMediaPlayer WinMediaPlayer Windows Media Player 7.0
NativePlayer Native HTML5 Media Player -

All the player widgets class resides in the com.bramosystems.oss.player.core.client.ui package.

Working with the player widgets

The following example shows the basic usage

SimplePanel panel = new SimplePanel();   // create panel to hold the player
AbstractMediaPlayer player = null;
try {
    // create the player, specifing URL of media
    player = new WinMediaPlayer("www.example.com/mediafile.wma", 
                    false, "height", "width");
    panel.setWidget(player); // add player to panel.
} catch(PluginVersionException e) {
    // required plugin version is not available, alert user
    panel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin(), 
            e.getRequiredVersion()));
} catch(PluginNotFoundException e) {
    // catch PluginNotFoundException and display a friendly notice.
    panel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin));
}

The following example adds the same widget using the Base API utility methods:

SimplePanel panel = new SimplePanel();   // create panel to hold the player
AbstractMediaPlayer player = null;
try {
    // retrieve the basic information about the player as registered with the API
    // using the provider name and the player name
    PlayerInfo pi = PlayerUtil.getPlayerInfo("core", "WinMediaPlayer");

    // create the player, using the PlayerInfo object and specifing URL of media
    player = PlayerUtil.getPlayer(pi, "www.example.com/mediafile.wma", false, 
        "width", "height");
    panel.setWidget(player); // add player to panel.
} catch(PluginVersionException e) {
    // required plugin version is not available, alert user
    panel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin(), 
            e.getRequiredVersion()));
} catch(PluginNotFoundException e) {
    // catch PluginNotFoundException and display a friendly notice.
    panel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin));
}

A Note about FlashMediaPlayer widget

The FlashMediaPlayer widget embeds the BST Flash Player SWF application to playback Flash-supported media formats. The BST Flash Player has two variants:

  • bst-flash-player-<version>.swf - Built with network support. Appropriate for applications served by a web server, as is mostly the case
  • bst-flash-player-<version>-lo.swf - Built without network support. Appropriate for applications that run off the filesystem

The -lo variant is excluded from application builds by default. If you need to include it, then you need to add the following lines to your GWT XML application module instead:

// add minimal definitions of the Core Player Provider ...
<inherits name="com.bramosystems.oss.player.core.CorePlayerProviderLite" />

// add Flash-Lo resources
<inherits name="com.bramosystems.oss.player.core.resources.FlashLo" />

Also, if you will not be using the FlashMediaPlayer widget in your application, you can reduce your build artifacts by excluding the BST Flash Player application resources altogether. Simply inherit only CorePlayerProviderLite instead:

// add only minimal definitions of the Core Player Provider to exclude the BST Flash Player 
// resources from build artifacts...
<inherits name="com.bramosystems.oss.player.core.CorePlayerProviderLite" />