Module one.jpro.platform.media
Package one.jpro.platform.media.player
package one.jpro.platform.media.player
Media playback via MediaPlayer
The basic steps required to play media are:
- Create a
MediaSourceobject for the desired media source. - Create a
MediaPlayerobject from theMediaSourceobject viaMediaPlayer.create(javafx.stage.Stage, MediaSource). - Create a
MediaViewobject viaMediaView.create(MediaPlayer). - Add the
MediaViewto the scene graph. - Invoke
MediaPlayer.play().
MediaView class documentation.
Some things which should be noted are:
- One
MediaSourceobject may be shared among multipleMediaPlayers. - Currently, one
MediaPlayermay be shared among multipleMediaViews only in desktop/mobile application. In web application, eachMediaViewmust have its ownMediaPlayerobject. - Media may be played directly by a
MediaPlayerwithout creating aMediaViewalthough a view is required for display. - Instead of
MediaPlayer.play(),MediaPlayer.setAutoPlay(true)may be used to request that playing start as soon as possible. In web applications, theMediaPlayermay not start playing automatically when the web page is shown for the first time due to autoplay blocking policy of the browsers. MediaPlayerhas several operational states defined byMediaPlayer.Status.
- Author:
- Besmir Beqiri
-
ClassDescriptionThe MediaPlayer offers functionalities for media playback across desktop/mobile and web platforms with ease.Media player exception.