|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bramosystems.oss.player.core.client.PlayerUtil
public class PlayerUtil
Utility class for various media player related functions.
Constructor Summary | |
---|---|
PlayerUtil()
|
Method Summary | |
---|---|
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 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlayerUtil()
Method Detail |
---|
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 formatted
public static AbstractMediaPlayer getPlayer(String mediaURL, boolean autoplay, String height, String width) throws LoadException, 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.
LoadException
- if an error occurs while loading the media.
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 LoadException, 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.
LoadException
- if an error occurs while loading the media.
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 LoadException, 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
otherwise
LoadException
- if an error occurs while loading the media.
PluginVersionException
- 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 plugin
getMissingPluginNotice(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 plugin
getMissingPluginNotice(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 plugin
PluginNotFoundException
- 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 provider
IllegalArgumentException
- 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 player
PlayerInfo
object
IllegalArgumentException
- if providerName
and/or playerName
is not availablePlayerInfo
public static AbstractMediaPlayer getPlayer(PlayerInfo playerInfo, String mediaURL, boolean autoplay, String height, String width) throws LoadException, 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.
LoadException
- if an error occurs while loading the media.
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |