public class PlayerUtil extends Object
Constructor and Description |
---|
PlayerUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
formatMediaTime(long milliSeconds)
Formats the specified time (in milliseconds) into time string in the
format
hh:mm:ss . |
static PluginVersion |
getDivXPlayerPluginVersion()
Detects the version of the DivX Web Player plugin available on the clients browser.
|
static PluginVersion |
getFlashPlayerVersion()
Detects the version of the Flash Player plugin available on the clients
browser.
|
static Set<String> |
getHMTL5MimeTypes()
Returns all audio/video file mime-types that have native (HTML5) support
on the client.
|
static Set<String> |
getMediaExtensions(String mimeType)
Returns all registered file type extensions for the specified mime-type.
|
static com.google.gwt.user.client.ui.Widget |
getMissingPluginNotice(Plugin plugin)
Convenience method to get a widget that may be used to notify the user when
a required plugin is not available.
|
static com.google.gwt.user.client.ui.Widget |
getMissingPluginNotice(Plugin plugin,
String version)
Convenience method to get a widget that may be used to notify the user when
a required plugin is not available.
|
static com.google.gwt.user.client.ui.Widget |
getMissingPluginNotice(Plugin plugin,
String title,
String message,
boolean asHTML)
Returns a widget that may be used to notify the user when a required plugin
is not available.
|
static AbstractMediaPlayer |
getPlayer(PlayerInfo playerInfo,
String mediaURL,
boolean autoplay,
String height,
String width)
Utility method to get the player with the specified
playerInfo . |
static AbstractMediaPlayer |
getPlayer(Plugin plugin,
String mediaURL,
boolean autoplay)
Utility method to get a player that best supports the specified
mediaURL with
the specified plugin feature. |
static AbstractMediaPlayer |
getPlayer(Plugin plugin,
String mediaURL,
boolean autoplay,
String height,
String width)
Utility method to get a player that best supports the specified
mediaURL with
the specified plugin feature. |
static AbstractMediaPlayer |
getPlayer(String mediaURL,
boolean autoplay,
String height,
String width)
Utility method to get a player that best supports the specified
mediaURL . |
static PlayerInfo |
getPlayerInfo(String providerName,
String playerName)
Returns the
PlayerInfo object describing the features of the specified playerName from
the specified providerName . |
static Set<String> |
getPlayerNames(String playerProvider)
Returns the name of all players available from the specified
playerProvider |
static Set<String> |
getPlayerProviderNames()
Returns the name of all available player providers.
|
static PluginInfo |
getPluginInfo(Plugin plugin)
Returns the
PluginInfo object describing the features of the specified plugin |
static PluginVersion |
getQuickTimePluginVersion()
Detects the version of the QuickTime plugin available on the clients browser.
|
static PluginVersion |
getVLCPlayerPluginVersion()
Detects the version of the VLC Media Player plugin available on the clients browser.
|
static PluginVersion |
getWindowsMediaPlayerPluginVersion()
Detects the version of the Windows Media Player plugin available on the clients browser.
|
static boolean |
isHTML5CompliantClient()
Checks if the browser implements the HTML 5 specification.
|
public static String formatMediaTime(long milliSeconds)
hh:mm:ss
.
The hours part of the formatted time is omitted if milliseconds
time
is less than 60 minutes.
milliSeconds
- media time to be formattedpublic static AbstractMediaPlayer getPlayer(String mediaURL, boolean autoplay, String height, String width) throws PluginNotFoundException, PluginVersionException
mediaURL
.
A suitable player is determined based on the plugin available on the browser as well as its suitability to playback the specified media.
NOTE: If the media is served with a special streaming protocol such as
MMS and RTSP, mediaURL
should be specified in its absolute form. Otherwise
mediaURL
should end in a standard media format extension e.g.
.mp3, .wma, .mov, .flv ...
mediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.PluginVersionException
- if the required plugin version is not installed on the client.PluginNotFoundException
- if the required plugin is not installed on the client.public static AbstractMediaPlayer getPlayer(Plugin plugin, String mediaURL, boolean autoplay, String height, String width) throws PluginNotFoundException, PluginVersionException
mediaURL
with
the specified plugin feature.
A suitable player is determined based on the features/capabilities derivable from the player plugin, its availability on the browser, and its suitability to playback the specified media.
The current implementation considers the following features:
NOTE: If the media is served with a special streaming protocol such as
MMS and RTSP, mediaURL
should be specified in its absolute form. Otherwise
mediaURL
should end in a standard media format extension e.g.
.mp3, .wma, .mov, .flv ...
plugin
- the features of the required player pluginmediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.PluginVersionException
- if the required plugin version is not installed on the client.PluginNotFoundException
- if the required plugin is not installed on the client.getPlayer(String, boolean, String, String)
public static AbstractMediaPlayer getPlayer(Plugin plugin, String mediaURL, boolean autoplay) throws PluginNotFoundException, PluginVersionException
mediaURL
with
the specified plugin feature.plugin
- the features of the required player pluginmediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwisePluginVersionException
- if the required plugin version is not installed on the client.PluginNotFoundException
- if the required plugin is not installed on the client.getPlayer(Plugin, String, boolean, String, String)
public static PluginVersion getFlashPlayerVersion() throws PluginNotFoundException
PluginVersion
object wrapping the version numbers of the
Flash Player on the browser.PluginNotFoundException
- if a Flash Player plugin could not be found
(especially if none is installed or the plugin is disabled).public static PluginVersion getQuickTimePluginVersion() throws PluginNotFoundException
PluginVersion
object wrapping the version numbers of the
QuickTime plugin on the browser.PluginNotFoundException
- if a QuickTime plugin could not be found.
(especially if none is installed or the plugin is disabled).public static PluginVersion getWindowsMediaPlayerPluginVersion() throws PluginNotFoundException
PluginVersion
object wrapping the version numbers of the
plugin on the browser.PluginNotFoundException
- if a plugin could not be found.
(especially if none is installed or the plugin is disabled).public static PluginVersion getVLCPlayerPluginVersion() throws PluginNotFoundException
PluginVersion
object wrapping the version numbers of the
plugin on the browser.PluginNotFoundException
- if a plugin could not be found.
(especially if none is installed or the plugin is disabled).public static PluginVersion getDivXPlayerPluginVersion() throws PluginNotFoundException
PluginVersion
object wrapping the version numbers of the
plugin on the browser.PluginNotFoundException
- if a plugin could not be found.
(especially if none is installed or the plugin is disabled).public static com.google.gwt.user.client.ui.Widget getMissingPluginNotice(Plugin plugin, String title, String message, boolean asHTML)
plugin
- the missing plugintitle
- the title of the messagemessage
- descriptive message to notify user about the missing pluginasHTML
- true
if message
should be interpreted as HTML,
false
otherwise.public static com.google.gwt.user.client.ui.Widget getMissingPluginNotice(Plugin plugin, String version)
This is same as calling getMissingPluginNotice(plugin, "Missing Plugin",
"<<message>>", false)
<<message>> => [Plugin Name] [version] or later is required to play this media.
Click here to get [Plugin Name]
plugin
- the required pluginversion
- the minimum version of the required plugingetMissingPluginNotice(Plugin, String, String, boolean)
public static com.google.gwt.user.client.ui.Widget getMissingPluginNotice(Plugin plugin)
This is same as calling getMissingPluginNotice(plugin, "Missing Plugin",
"<<message>>", false)
<<message>> => [Plugin Name] is required to play this media.
Click here to get [Plugin Name]
plugin
- the required plugingetMissingPluginNotice(Plugin, String, String, boolean)
public static boolean isHTML5CompliantClient()
true
if browser is HTML 5 compliant, false
otherwisepublic static PluginInfo getPluginInfo(Plugin plugin) throws PluginNotFoundException
PluginInfo
object describing the features of the specified plugin
plugin
- the pluginPluginNotFoundException
- if the specified plugin is not availablePluginInfo
public static Set<String> getPlayerProviderNames()
public static Set<String> getPlayerNames(String playerProvider)
playerProvider
playerProvider
- the name of the player providerIllegalArgumentException
- if playerProvider
is not registeredpublic static PlayerInfo getPlayerInfo(String providerName, String playerName)
PlayerInfo
object describing the features of the specified playerName
from
the specified providerName
.providerName
- name of the player providerplayerName
- name of playerPlayerInfo
objectIllegalArgumentException
- if providerName
and/or playerName
is not availablePlayerInfo
public static AbstractMediaPlayer getPlayer(PlayerInfo playerInfo, String mediaURL, boolean autoplay, String height, String width) throws PluginNotFoundException, PluginVersionException
playerInfo
.
This method acts as a factory to instantiate player widgets from various providers.
playerInfo
- the required player widgetmediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.PluginVersionException
- if the required plugin version is not installed on the client.PluginNotFoundException
- if the required plugin is not installed on the client.getPlayer(String, boolean, String, String)
public static Set<String> getMediaExtensions(String mimeType)
mimeType
- the mime-typeCopyright © 2009-2013. All Rights Reserved.