Class RemoteControlListener

java.lang.Object
com.codename1.media.RemoteControlListener

public class RemoteControlListener extends Object

A base class that is meant to be overridden to implement functionality that responds to the device's remote control for media playback. This allows you to tie into the media buttons on the lock screen for background media.

Apps should implement their own subclass and register it with the app using MediaManager#setRemoteControlListener(com.codename1.media.RemoteControlListener)

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when user presses the "fast forward" button on remote control.
    Should return the meta data about the currently playing media.
    boolean
    Is used by remote control to determine if the media is currently playing.
    void
    Called when user presses the pause button on remote control.
    void
    Called when user presses play button on remote control.
    void
    Called when user presses the "rewind" button on remote control.
    void
    seekTo(long pos)
    Called when user seeks to a position of the currently playing media on the remote control.
    void
    setVolume(float leftVolume, float rightVolume)
    Is called when the user adjusts the volume on the remote control
    void
    Called when user presses the "next" button on remote control.
    void
    Called when user presses the "previous" button on remote control.
    void
    Called when user presses the "Stop" button on remote control.
    void
    Called when user presses the toggle play/pause button on remote control.

    Methods inherited from class Object

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

    • RemoteControlListener

      public RemoteControlListener()
  • Method Details

    • play

      public void play()
      Called when user presses play button on remote control.
    • pause

      public void pause()
      Called when user presses the pause button on remote control.
    • togglePlayPause

      public void togglePlayPause()
      Called when user presses the toggle play/pause button on remote control.
    • seekTo

      public void seekTo(long pos)

      Called when user seeks to a position of the currently playing media on the remote control.

      Parameters
      • pos
    • skipToNext

      public void skipToNext()
      Called when user presses the "next" button on remote control.
    • skipToPrevious

      public void skipToPrevious()
      Called when user presses the "previous" button on remote control.
    • stop

      public void stop()
      Called when user presses the "Stop" button on remote control.
    • fastForward

      public void fastForward()
      Called when user presses the "fast forward" button on remote control.
    • rewind

      public void rewind()
      Called when user presses the "rewind" button on remote control.
    • isPlaying

      public boolean isPlaying()
      Is used by remote control to determine if the media is currently playing.
    • setVolume

      public void setVolume(float leftVolume, float rightVolume)

      Is called when the user adjusts the volume on the remote control

      Parameters
      • leftVolume

      • rightVolume

    • getMetaData

      public MediaMetaData getMetaData()
      Should return the meta data about the currently playing media.