Wt  3.7.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
Wt::WMediaPlayer Class Reference

A media player. More...

#include <Wt/WMediaPlayer>

Inheritance diagram for Wt::WMediaPlayer:
Inheritance graph
[legend]

Public Types

enum  Encoding {
  PosterImage, MP3, M4A, OGA,
  WAV, WEBMA, FLA, M4V,
  OGV, WEBMV, FLV
}
 An enumeration for a media encoding. More...
 
enum  MediaType { Audio, Video }
 An enumeration for a media type. More...
 
enum  ButtonControlId {
  VideoPlay, Play, Pause, Stop,
  VolumeMute, VolumeUnmute, VolumeMax, FullScreen,
  RestoreScreen, RepeatOn, RepeatOff
}
 An enumeration for a button function. More...
 
enum  BarControlId { Time, Volume }
 An enumeration for a progressbar function. More...
 
enum  TextId { CurrentTime, Duration, Title }
 An enumeration for a text. More...
 
enum  ReadyState {
  HaveNothing = 0, HaveMetaData = 1, HaveCurrentData = 2, HaveFutureData = 3,
  HaveEnoughData = 4
}
 An enumeration for the player state. More...
 
- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 

Public Member Functions

 WMediaPlayer (MediaType mediaType, WContainerWidget *parent=0)
 Creates a new media player. More...
 
 ~WMediaPlayer ()
 Destructor.
 
void setVideoSize (int width, int height)
 Sets the video size. More...
 
int videoWidth () const
 Returns the video width. More...
 
int videoHeight () const
 Returns the video height. More...
 
void setControlsWidget (WWidget *controls)
 Sets the user-interface controls widget. More...
 
WWidgetcontrolsWidget () const
 Returns the user-interface controls widget. More...
 
void setTitle (const WString &title)
 Sets the media title. More...
 
void addSource (Encoding encoding, const WLink &link)
 Adds a source. More...
 
WLink getSource (Encoding encoding) const
 Returns a source. More...
 
void clearSources ()
 Clears all sources. More...
 
void setButton (ButtonControlId id, WInteractWidget *btn)
 Binds a control button. More...
 
WInteractWidgetbutton (ButtonControlId id) const
 Returns a control button. More...
 
void setProgressBar (BarControlId id, WProgressBar *progressBar)
 Binds a control progress bar. More...
 
WProgressBarprogressBar (BarControlId id) const
 Returns a control progress bar. More...
 
void setText (TextId id, WText *text)
 Sets a text place-holder widget. More...
 
WTexttext (TextId id) const
 Returns a text place-holder widget. More...
 
void pause ()
 Pauses the player. More...
 
void play ()
 Start or resume playing. More...
 
void stop ()
 Stops the player. More...
 
void seek (double time)
 Seeks to a time. More...
 
void setPlaybackRate (double rate)
 Sets the playback rate. More...
 
void setVolume (double volume)
 Sets the volume. More...
 
double volume () const
 Returns the volume. More...
 
void mute (bool mute)
 Mutes or unmutes the playback volume. More...
 
bool playing () const
 Returns whether the media is currently playing. More...
 
ReadyState readyState () const
 Returns the current player state. More...
 
double duration () const
 Returns the duration. More...
 
double currentTime () const
 Returns the current playback time. More...
 
double playbackRate () const
 Returns the current playback rate. More...
 
JSignal< double > & timeUpdated ()
 Event that indicates a time update. More...
 
JSignalplaybackStarted ()
 Event that indicates that playback started. More...
 
JSignalplaybackPaused ()
 Event that indicates that playback paused. More...
 
JSignalended ()
 Event that indicates that the video or audio has ended.
 
JSignal< double > & volumeChanged ()
 Event that indicates that the volume has changed.
 
virtual void refresh ()
 Refresh the widget. More...
 
- Public Member Functions inherited from Wt::WCompositeWidget
 WCompositeWidget (WContainerWidget *parent=0)
 Creates a WCompositeWidget. More...
 
 WCompositeWidget (WWidget *implementation, WContainerWidget *parent)
 Creates a WCompositeWidget with given implementation. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setPositionScheme (PositionScheme scheme)
 Sets the CSS position scheme. More...
 
virtual PositionScheme positionScheme () const
 Returns the CSS position scheme. More...
 
virtual void setOffsets (const WLength &offset, WFlags< Side > sides=All)
 Sets CSS offsets for a non-statically positioned widget. More...
 
virtual WLength offset (Side s) const
 Returns a CSS offset. More...
 
virtual void resize (const WLength &width, const WLength &height)
 Resizes the widget. More...
 
virtual WLength width () const
 Returns the width. More...
 
virtual WLength height () const
 Returns the height. More...
 
virtual void setMinimumSize (const WLength &width, const WLength &height)
 Sets a minimum size. More...
 
virtual WLength minimumWidth () const
 Returns the minimum width. More...
 
virtual WLength minimumHeight () const
 Returns the minimum height. More...
 
virtual void setMaximumSize (const WLength &width, const WLength &height)
 Sets a maximum size. More...
 
virtual WLength maximumWidth () const
 Returns the maximum width. More...
 
virtual WLength maximumHeight () const
 Returns the maximum height. More...
 
virtual void setLineHeight (const WLength &height)
 Sets the CSS line height for contained text.
 
virtual WLength lineHeight () const
 Returns the CSS line height for contained text. More...
 
virtual void setFloatSide (Side s)
 Specifies a CSS float side. More...
 
virtual Side floatSide () const
 Returns the CSS float side. More...
 
virtual void setClearSides (WFlags< Side > sides)
 Sets the sides that should be cleared of floats. More...
 
virtual WFlags< SideclearSides () const
 Returns the sides that should remain empty. More...
 
virtual void setMargin (const WLength &margin, WFlags< Side > sides=All)
 Sets CSS margins around the widget. More...
 
virtual WLength margin (Side side) const
 Returns a CSS margin set. More...
 
virtual void setHiddenKeepsGeometry (bool enabled)
 Sets whether the widget keeps its geometry when hidden. More...
 
virtual bool hiddenKeepsGeometry () const
 Returns whether the widget keeps its geometry when hidden. More...
 
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())
 Hides or shows the widget. More...
 
virtual bool isHidden () const
 Returns whether the widget is set hidden. More...
 
virtual bool isVisible () const
 Returns whether the widget is visible. More...
 
virtual void setDisabled (bool disabled)
 Sets whether the widget is disabled. More...
 
virtual bool isDisabled () const
 Returns whether the widget is set disabled. More...
 
virtual bool isEnabled () const
 Returns whether the widget is enabled. More...
 
virtual void setPopup (bool popup)
 Lets the widget overlay over other sibling widgets. More...
 
virtual bool isPopup () const
 Returns whether the widget is overlayed. More...
 
virtual void setInline (bool isInline)
 Sets whether the widget is displayed inline or as a block. More...
 
virtual bool isInline () const
 Returns whether the widget is displayed inline or as block. More...
 
virtual void setDecorationStyle (const WCssDecorationStyle &style)
 Sets a CSS decoration style. More...
 
virtual WCssDecorationStyledecorationStyle ()
 Returns the decoration style of this widget. More...
 
virtual void setStyleClass (const WString &styleClass)
 Sets (one or more) CSS style classes. More...
 
virtual WString styleClass () const
 Returns the CSS style class. More...
 
virtual void addStyleClass (const WString &styleClass, bool force=false)
 Adds a CSS style class. More...
 
virtual void removeStyleClass (const WString &styleClass, bool force=false)
 Removes a CSS style class. More...
 
virtual bool hasStyleClass (const WString &styleClass) const
 Returns whether the widget has a style class.
 
virtual void setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto)
 Sets the vertical alignment. More...
 
virtual AlignmentFlag verticalAlignment () const
 Returns the vertical alignment. More...
 
virtual WLength verticalAlignmentLength () const
 Returns the fixed vertical alignment that was set. More...
 
virtual void setToolTip (const WString &text, TextFormat textFormat=PlainText)
 Sets a tooltip. More...
 
virtual WString toolTip () const
 Returns the tooltip.
 
virtual void setDeferredToolTip (bool enable, TextFormat textFormat=PlainText)
 Enable deferred tooltip. More...
 
virtual void setAttributeValue (const std::string &name, const WString &value)
 Sets an attribute value. More...
 
virtual WString attributeValue (const std::string &name) const
 Returns an attribute value. More...
 
virtual void setJavaScriptMember (const std::string &name, const std::string &value)
 Sets a JavaScript member. More...
 
virtual std::string javaScriptMember (const std::string &name) const
 Returns the value of a JavaScript member. More...
 
virtual void callJavaScriptMember (const std::string &name, const std::string &args)
 Calls a JavaScript member. More...
 
virtual void load ()
 Loads content just before the widget is used. More...
 
virtual bool loaded () const
 Returns whether this widget has been loaded. More...
 
virtual void setCanReceiveFocus (bool enabled)
 Sets whether the widget can receive focus. More...
 
virtual bool canReceiveFocus () const
 Returns whether the widget can receive focus. More...
 
virtual void setFocus (bool focus)
 Sets focus. More...
 
virtual bool setFirstFocus ()
 Set focus on the widget's first descendant. More...
 
virtual bool hasFocus () const
 Returns whether the widget currently has the focus.
 
virtual void setTabIndex (int index)
 Sets the tab index. More...
 
virtual int tabIndex () const
 Returns the tab index. More...
 
virtual void setId (const std::string &id)
 Sets the CSS Id. More...
 
virtual WWidgetfind (const std::string &name)
 Finds a descendent widget by name. More...
 
virtual WWidgetfindById (const std::string &name)
 Finds a descendent widget by id.
 
virtual void setSelectable (bool selectable)
 Sets as selectable. More...
 
virtual void doJavaScript (const std::string &js)
 Executes the given JavaScript statements when the widget is rendered or updated. More...
 
virtual void propagateSetEnabled (bool enabled)
 Propagates that a widget was enabled or disabled through children. More...
 
virtual bool scrollVisibilityEnabled () const WT_CXX11ONLY(final override)
 Returns whether scroll visibility detection is enabled for this widget. More...
 
virtual void setScrollVisibilityEnabled (bool enabled) WT_CXX11ONLY(final override)
 Sets whether scroll visibility detection is enabled for this widget. More...
 
virtual int scrollVisibilityMargin () const WT_CXX11ONLY(final override)
 Returns the margin around the viewport within which the widget is considered visible. More...
 
virtual void setScrollVisibilityMargin (int margin) WT_CXX11ONLY(final override)
 Sets the margin around the viewport within which the widget is considered visible. More...
 
virtual Signal< bool > & scrollVisibilityChanged () WT_CXX11ONLY(final override)
 Signal triggered when the scroll visibility of this widget changes. More...
 
virtual bool isScrollVisible () const WT_CXX11ONLY(final override)
 Returns whether this widget is currently considered scroll visible. More...
 
virtual void setThemeStyleEnabled (bool enabled)
 Sets whether theme styling for a widget is enabled or disabled. More...
 
virtual bool isThemeStyleEnabled () const
 Returns whether this widget is currently styled by the chosen theme. More...
 
- Public Member Functions inherited from Wt::WWidget
virtual ~WWidget ()
 Destructor. More...
 
WWidgetparent () const
 Returns the parent widget. More...
 
virtual void removeChild (WObject *child)
 Removes a child object. More...
 
void setWidth (const WLength &width)
 Sets the width. More...
 
void setHeight (const WLength &height)
 Sets the height. More...
 
virtual void positionAt (const WWidget *widget, Orientation orientation=Vertical)
 Positions a widget next to another widget. More...
 
virtual void toggleStyleClass (const WString &styleClass, bool add, bool force=false)
 Toggles a CSS style class.
 
std::string jsRef () const
 Returns a JavaScript expression to the corresponding DOM node. More...
 
void setFocus ()
 Sets focus. More...
 
virtual void acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString())
 Sets a mime type to be accepted for dropping. More...
 
virtual void stopAcceptDrops (const std::string &mimeType)
 Indicates that a mime type is no longer accepted for dropping. More...
 
virtual void htmlText (std::ostream &out)
 Streams the (X)HTML representation. More...
 
bool isRendered () const
 Returns whether the widget is rendered. More...
 
void hide ()
 Hides the widget. More...
 
void animateHide (const WAnimation &animation)
 Hides the widget using an animation. More...
 
void show ()
 Shows the widget. More...
 
void animateShow (const WAnimation &animation)
 Shows the widget using an animation. More...
 
void enable ()
 Enables the widget. More...
 
void disable ()
 Disable thes widget. More...
 
bool layoutSizeAware () const
 Returns whether the widget is layout size aware. More...
 
- Public Member Functions inherited from Wt::WObject
 WObject (WObject *parent=0)
 Create a WObject with a given parent object. More...
 
virtual ~WObject ()
 Destructor. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
void addChild (WObject *child)
 Adds a child object. More...
 
const std::vector< WObject * > & children () const
 Returns the children.
 
WObjectparent () const
 Returns the parent object.
 

Protected Member Functions

virtual void render (WFlags< RenderFlag > flags)
 Renders the widget. More...
 
- Protected Member Functions inherited from Wt::WCompositeWidget
virtual void enableAjax ()
 Progresses to an Ajax-enabled widget. More...
 
void setImplementation (WWidget *widget)
 Set the implementation widget. More...
 
WWidgetimplementation ()
 Get the implementation widget. More...
 
virtual int boxPadding (Orientation orientation) const
 Returns the widget's built-in padding. More...
 
virtual int boxBorder (Orientation orientation) const
 Returns the widget's built-in border width. More...
 
- Protected Member Functions inherited from Wt::WWidget
void setLayoutSizeAware (bool sizeAware)
 Sets the widget to be aware of its size set by a layout manager. More...
 
virtual void layoutSizeChanged (int width, int height)
 Virtual method that indicates a size change. More...
 
 WWidget (WContainerWidget *parent=0)
 Creates a widget. More...
 
virtual void dropEvent (WDropEvent dropEvent)
 Handles a drop event. More...
 
void scheduleRender (WFlags< RepaintFlag > flags=0)
 Schedules rerendering of the widget. More...
 
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Wt::WWidget
static WString tr (const char *key)
 Short hand for WString::tr() More...
 
- Static Protected Member Functions inherited from Wt::WObject
static WObjectsender ()
 Returns the sender of the current slot call. More...
 

Detailed Description

A media player.

This widget implements a media player, suitable to play video or audio, and with a customizable user-interface.

To support cross-browser playing of video or audio content, you may need to provide the contents appropriately encoded. For audio, at least an MP3 or MP4 audio (M4A) encoding should be supplied, while for video the M4V encoding should be provided. Additional encodings are beneficial since they increase the chance that native HTML <video> or <audio> elements can be used (which may be hardware accelerated), instead of the flash player. See HTML5 browser media support.

You need to specify the encoding types you are going to use when instantiating the media player, since based on the chosen encodings, a particular suitable implementation will be used. Thus, you need to call addSource() immediately, but you may pass empty URLs if you do not yet want to load media.

The player provides a user-interface to control the playback which may be freely customized, and which is independent of the underlying media technology (HTML video or Flash player). The controls user-interface may be implemented as a Wt widget, where the controls (buttons, progress bars, and text widgets) are bound directly to the video player component (client-side).

This widget relies on a third-party JavaScript component jPlayer, which is distributed together with Wt.

The default user-interface can be themed using jPlayer themes. The theme is global (it applies to all media player instances), and is configured by loading a CSS stylesheet.

The following code creates a video using the default controls:

useStyleSheet(WApplication::relativeRsourcesUrl() + "jPlayer/skin/jplayer.blue.monday.css");
player->addSource(WMediaPlayer::M4V, "video.m4v");
player->addSource(WMediaPlayer::OGV, "video.ogv");
player->addSource(WMediaPlayer::PosterImage, "poster.png");

Alternatively, a custom widget may be set which implements the controls, using setControlsWidget(). In this case, you should add to this widget the buttons, text place holders, and progress bars and bind them to the media player using the setButton(), setText() and setProgressBar() methods. The controls widget is integrated in the media player, and this has as unique benefit (for a video player) that they may also be shown when the video player is maximized.

Finally, you may want to control the media player only through widgets external to the media player. This may be configured by setting 0 as controlsWidget. In this case however, full screen mode should not be used since there is no way to restore the original size.

Member Enumeration Documentation

◆ BarControlId

An enumeration for a progressbar function.

See also
setProgressBar(), progressBar()
Enumerator
Time 

The time bar.

Volume 

The volume bar.

◆ ButtonControlId

An enumeration for a button function.

See also
setButton(), button()
Enumerator
VideoPlay 

Play button which overlays the video (for Video only)

Play 

Play button, is hidden while playing.

Pause 

Pause button, is hidden while paused.

Stop 

Stop button.

VolumeMute 

Volume mute button.

VolumeUnmute 

Volume unmute button.

VolumeMax 

Volume max button.

FullScreen 

Toggle button for full screen, is hidden while full screen (for Video only)

RestoreScreen 

Toggle button to restore the screen, is shown only in full screen (for Video only)

RepeatOn 

Toggle button to enable looping, is hidden while repeating is on

RepeatOff 

Toggle button to disable looping, is hidden while repeat is off

◆ Encoding

An enumeration for a media encoding.

See also
addSource()
http://www.jplayer.org/latest/developer-guide/#jPlayer-media-encoding
Enumerator
PosterImage 

The poster image (e.g. JPG/PNG) for a video.

MP3 

Audio: MP3 encoding (essential audio format)

M4A 

Audio: MP4 encoding (essential audio format)

OGA 

Audio: OGG encoding.

WAV 

Audio: WAV (uncompressed) format.

WEBMA 

Audio: WebM encoding.

FLA 

Audio: Flash format.

M4V 

Video: MP4 encoding (essential video format)

OGV 

Video: OGG encoding.

WEBMV 

Video: WebM encoding.

FLV 

Video: Flash format.

◆ MediaType

An enumeration for a media type.

Enumerator
Audio 

Defines an audio player.

Video 

Defines a video player.

◆ ReadyState

An enumeration for the player state.

See also
readyState()
Enumerator
HaveNothing 

No information available.

HaveMetaData 

Metadata loaded: duration, width, height.

HaveCurrentData 

Data at playback position is available.

HaveFutureData 

Have data to play for a while.

HaveEnoughData 

Enough to reach the end without stalling.

◆ TextId

An enumeration for a text.

See also
setText(), text()
Enumerator
CurrentTime 

Displays the current time.

Duration 

Displays the total duration.

Title 

Displays the title set in setTitle()

Constructor & Destructor Documentation

◆ WMediaPlayer()

Wt::WMediaPlayer::WMediaPlayer ( MediaType  mediaType,
WContainerWidget parent = 0 
)

Creates a new media player.

The player is instantiated with default controls.

See also
setControlsWidget()

Member Function Documentation

◆ addSource()

void Wt::WMediaPlayer::addSource ( Encoding  encoding,
const WLink link 
)

Adds a source.

Adds a media source. The source may be specified as a URL or as a dynamic resource.

You may pass a null link if you want to indicate the media types you will use (later) without already loading data.

◆ button()

WInteractWidget * Wt::WMediaPlayer::button ( ButtonControlId  id) const

Returns a control button.

See also
setButton()

◆ clearSources()

void Wt::WMediaPlayer::clearSources ( )

Clears all sources.

See also
addSource()

◆ controlsWidget()

WWidget * Wt::WMediaPlayer::controlsWidget ( ) const

Returns the user-interface controls widget.

See also
setControlsWidget()

◆ currentTime()

double Wt::WMediaPlayer::currentTime ( ) const

Returns the current playback time.

Returns the current playback time, expressed in seconds.

See also
seek()

◆ duration()

double Wt::WMediaPlayer::duration ( ) const

Returns the duration.

The duration may be reported as 0 if the player has not yet loaded the media to determine the duration. Otherwise the duration is the duration of the loaded media, expressed in seconds.

See also
readyState(), currentTime()

◆ getSource()

WLink Wt::WMediaPlayer::getSource ( Encoding  encoding) const

Returns a source.

Returns the media source for the given encoding, which must have previously been added using addSource().

◆ mute()

void Wt::WMediaPlayer::mute ( bool  mute)

Mutes or unmutes the playback volume.

See also
setVolume()

◆ pause()

void Wt::WMediaPlayer::pause ( )

Pauses the player.

See also
play()

◆ play()

void Wt::WMediaPlayer::play ( )

Start or resume playing.

The player starts or resumes playing at the current time.

See also
seek()

◆ playbackPaused()

JSignal & Wt::WMediaPlayer::playbackPaused ( )

Event that indicates that playback paused.

The event is fired when playback has been paused.

◆ playbackRate()

double Wt::WMediaPlayer::playbackRate ( ) const

Returns the current playback rate.

See also
setPlaybackRate()

◆ playbackStarted()

JSignal & Wt::WMediaPlayer::playbackStarted ( )

Event that indicates that playback started.

The event is fired when playback has started (or is being continued).

◆ playing()

bool Wt::WMediaPlayer::playing ( ) const

Returns whether the media is currently playing.

See also
play()

◆ progressBar()

WProgressBar * Wt::WMediaPlayer::progressBar ( BarControlId  id) const

Returns a control progress bar.

See also
setProgressBar()

◆ readyState()

ReadyState Wt::WMediaPlayer::readyState ( ) const

Returns the current player state.

The state reflects in how far the media player has loaded the media, and has determined its characteristics.

◆ refresh()

void Wt::WMediaPlayer::refresh ( )
virtual

Refresh the widget.

The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.

The widget must actualize its contents in response.

Note
This does *not* rerender the widget! Calling refresh() usually does not have any effect (unless you've reimplemented refresh() to attach to it an effect).

Reimplemented from Wt::WCompositeWidget.

◆ render()

void Wt::WMediaPlayer::render ( WFlags< RenderFlag flags)
protectedvirtual

Renders the widget.

This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

Reimplemented from Wt::WCompositeWidget.

◆ seek()

void Wt::WMediaPlayer::seek ( double  time)

Seeks to a time.

If possible, the player sets the current time to the indicated time (expressed in seconds).

Note
It may be the case that this only works after the player has already loaded the media.

◆ setButton()

void Wt::WMediaPlayer::setButton ( ButtonControlId  id,
WInteractWidget btn 
)

Binds a control button.

A control button is typically implemented as a WAnchor or a WPushButton (although any WInteractWidget can work).

You should use this method in conjunction with setControlsWidget() to bind buttons in a custom control interface to media player functions.

The default control widget implements all buttons using a WAnchor.

◆ setControlsWidget()

void Wt::WMediaPlayer::setControlsWidget ( WWidget controls)

Sets the user-interface controls widget.

This sets a widget that contains the controls (buttons, text widgets, etc...) to allow the user to control the player.

Widgets that implement the buttons, bars, and text holders should be bound to the player using setButton(), setText() and setProgressBar() calls.

Setting a 0 widget will result in a player without controls. For an audio player this has the effect of being entirely invisible.

The default controls widget is a widget that can be styled using a jPlayer CSS theme.

◆ setPlaybackRate()

void Wt::WMediaPlayer::setPlaybackRate ( double  rate)

Sets the playback rate.

This modifies the playback rate, expressed as a ratio of the normal (natural) playback rate.

The default value is 1.0

Note
Not all browsers support this function.

◆ setProgressBar()

void Wt::WMediaPlayer::setProgressBar ( BarControlId  id,
WProgressBar progressBar 
)

Binds a control progress bar.

The progress bar for the WMediaPlayer::Time indication should be contained in a WContainerWidget which bounds the width of the progress bar, rather than setting a width on the progress bar. This is because the progress bar may, in some cases, also be used to indicate which part of the media can be seeked, and for this its width is being manipulated.

You should use this method in conjunction with setControlsWidget() to bind progress bars in a custom control interface to media player functions.

◆ setText()

void Wt::WMediaPlayer::setText ( TextId  id,
WText text 
)

Sets a text place-holder widget.

This binds the widget that displays text such as current time and total duration of the loaded media.

You should use this method in conjunction with setControlsWidget() to bind progress bars in a custom control interface to media player functions.

◆ setTitle()

void Wt::WMediaPlayer::setTitle ( const WString title)

Sets the media title.

See also
WMediaPlayer::Title

◆ setVideoSize()

void Wt::WMediaPlayer::setVideoSize ( int  width,
int  height 
)

Sets the video size.

This sets the size for the video. The actual size of the media player may be slightly larger, if the controlWidget take additional space (i.e. is not overlayed on top of the video).

CSS Themes for the default jPlayer controls support two formats (480 x 270 and 640 x 360).

The default video size is 480 x 270.

◆ setVolume()

void Wt::WMediaPlayer::setVolume ( double  volume)

Sets the volume.

This modifies the volume, which must be a number between 0 and 1.0.

The default value is 0.8

◆ stop()

void Wt::WMediaPlayer::stop ( )

Stops the player.

See also
play()

◆ text()

WText * Wt::WMediaPlayer::text ( TextId  id) const

Returns a text place-holder widget.

See also
setText()

◆ timeUpdated()

JSignal< double > & Wt::WMediaPlayer::timeUpdated ( )

Event that indicates a time update.

The event indicates that the currentTime() has changed.

◆ videoHeight()

int Wt::WMediaPlayer::videoHeight ( ) const

Returns the video height.

See also
setVideoSize()

◆ videoWidth()

int Wt::WMediaPlayer::videoWidth ( ) const

Returns the video width.

See also
setVideoSize()

◆ volume()

double Wt::WMediaPlayer::volume ( ) const

Returns the volume.

See also
setVolume()

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13