Class AndroidVideoService

java.lang.Object
com.gluonhq.attach.video.impl.DefaultVideoService
com.gluonhq.attach.video.impl.AndroidVideoService
All Implemented Interfaces:
VideoService

public class AndroidVideoService extends DefaultVideoService
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.IntegerProperty
    Integer property that indicates the current index on the playlist, starting from 0.
    javafx.beans.property.BooleanProperty
    Boolean property that indicates if the media file is playing in full screen mode or in normal mode.
    javafx.beans.property.ReadOnlyObjectProperty<Status>
    Read only property that indicates the media player status.
  • Field Summary

    Fields inherited from class com.gluonhq.attach.video.impl.DefaultVideoService

    debug, playlist, playlistMap
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.beans.property.IntegerProperty
    Integer property that indicates the current index on the playlist, starting from 0.
    javafx.beans.property.BooleanProperty
    Boolean property that indicates if the media file is playing in full screen mode or in normal mode.
    void
    Removes the layer with the control, so the JavaFX layer can resume normal interaction.
    void
    Pauses a playing media file.
    void
    Plays a valid media file.
    void
    setControlsVisible(boolean controlsVisible)
    When set to true the native embedded controls will be displayed on top of the media file.
    void
    setCurrentIndex(int index)
    Sets the value of the property currentIndex.
    void
    setFullScreen(boolean fullScreen)
    Sets the value of the property fullScreen.
    void
    setLooping(boolean looping)
    When looping is set to true the media files in the playlist will be played indefinitely until VideoService.stop() or VideoService.hide() is called.
    void
    setPosition(javafx.geometry.Pos alignment, double topPadding, double rightPadding, double bottomPadding, double leftPadding)
    Allows setting the position of the media file.
    void
    After adding items to the the playlist, this method can be called to prepare the media player and the native layer on top of the JavaFX one.
    javafx.beans.property.ReadOnlyObjectProperty<Status>
    Read only property that indicates the media player status.
    void
    Stops a playing media file.

    Methods inherited from class com.gluonhq.attach.video.impl.DefaultVideoService

    checkFileInResources, getFileFromAssets, getPlaylist

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

    • fullScreen

      public javafx.beans.property.BooleanProperty fullScreenProperty
      Returns:
      A BooleanProperty with the full screen mode status
      See Also:
    • status

      public javafx.beans.property.ReadOnlyObjectProperty<Status> statusProperty
      Returns:
      A ReadOnlyObjectProperty with the Status of the media player
    • currentIndex

      public javafx.beans.property.IntegerProperty currentIndexProperty
      Returns:
      an IntegerProperty indicating the current index on the playlist.
      See Also:
  • Constructor Details

    • AndroidVideoService

      public AndroidVideoService()
  • Method Details

    • show

      public void show()
      Description copied from interface: VideoService
      After adding items to the the playlist, this method can be called to prepare the media player and the native layer on top of the JavaFX one.

      Calling this method doesn't start playing. Alternatively, call VideoService.play() directly.

    • play

      public void play()
      Description copied from interface: VideoService
      Plays a valid media file.

      If the media player control wasn't created yet, it will be created first and placed in a layer on top of the JavaFX layer. If it was already created, it will start or resume playing.

    • stop

      public void stop()
      Description copied from interface: VideoService
      Stops a playing media file. It doesn't remove the media player.

      If VideoService.play() is called again, the playlist will start from the beginning of the playlist.

    • pause

      public void pause()
      Description copied from interface: VideoService
      Pauses a playing media file.

      If VideoService.play() is called again, the playlist will resume from the position the media file was at when it was paused.

    • hide

      public void hide()
      Description copied from interface: VideoService
      Removes the layer with the control, so the JavaFX layer can resume normal interaction. If a media file is currently playing, it will be stopped.

      This method can be called at any time to stop and hide the media player. It will be called automatically when the last media file in the playlist has ended, unless looping is set to true.

    • setPosition

      public void setPosition(javafx.geometry.Pos alignment, double topPadding, double rightPadding, double bottomPadding, double leftPadding)
      Description copied from interface: VideoService
      Allows setting the position of the media file. Only valid when full screen is disabled.
      Parameters:
      alignment - values for describing vertical and horizontal positioning and alignment
      topPadding - the top padding value, relative to the screen
      rightPadding - the right padding value, relative to the screen
      bottomPadding - the bottom padding value, relative to the screen
      leftPadding - the left padding value, relative to the screen
    • setLooping

      public void setLooping(boolean looping)
      Description copied from interface: VideoService
      When looping is set to true the media files in the playlist will be played indefinitely until VideoService.stop() or VideoService.hide() is called.

      Note: calling this method must be done before starting media playback.

      Parameters:
      looping - When true the playlist will restart from the beginning after all media files have been played. Default value is false.
    • setControlsVisible

      public void setControlsVisible(boolean controlsVisible)
      Description copied from interface: VideoService
      When set to true the native embedded controls will be displayed on top of the media file. Note that the controls are hidden automatically after a few seconds and a tap on the screen might be required to bring the controls back.

      Note: calling this method must be done before starting media playback.

      Media controls are also only visible for video files, not for audio.

      Parameters:
      controlsVisible - true to show the native embedded controls. Default value is false.
    • setFullScreen

      public void setFullScreen(boolean fullScreen)
      Sets the value of the property fullScreen.
      Property description:
      Parameters:
      fullScreen - Sets the media file in full screen. Default is false
    • fullScreenProperty

      public javafx.beans.property.BooleanProperty fullScreenProperty()
      Description copied from interface: VideoService
      Boolean property that indicates if the media file is playing in full screen mode or in normal mode.
      Returns:
      A BooleanProperty with the full screen mode status
      See Also:
    • statusProperty

      public javafx.beans.property.ReadOnlyObjectProperty<Status> statusProperty()
      Description copied from interface: VideoService
      Read only property that indicates the media player status.
      Returns:
      A ReadOnlyObjectProperty with the Status of the media player
    • setCurrentIndex

      public void setCurrentIndex(int index)
      Sets the value of the property currentIndex.
      Property description:
      Parameters:
      index - The index from the playlist that will start playing
    • currentIndexProperty

      public javafx.beans.property.IntegerProperty currentIndexProperty()
      Description copied from interface: VideoService
      Integer property that indicates the current index on the playlist, starting from 0.
      Returns:
      an IntegerProperty indicating the current index on the playlist.
      See Also: