com.samsung.multiscreen

## Class Player

- java.lang.Object
- - com.samsung.multiscreen.Player

- Direct Known Subclasses:
    AudioPlayer, PhotoPlayer, VideoPlayer

      public class Player
      extends Object

  The `Player` class allows control Default Media Player (DMP) on TV side. It provides basic APIs to control DMP and acts as base class for deriving classes - Audio, Video and Photo player classes.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Player.RepeatMode` Defines all possible values for Repeat.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `disconnect()` Disconnect from the specified channel.
    `void` | `disconnect(boolean stopOnDisconnect, Result<Client> callback)` Disconnect from the media player.
    `void` | `disconnect(Result<Client> result)` Disconnect from the specified channel.
    `void` | `getControlStatus()` fetches the control status - volume, mute, shuffle and repeat
    `boolean` | `isConnected()` Returns if the channel is connected and the host is ready to listen for messages.
    `boolean` | `isDebug()` Get whether debug is set.
    `void` | `mute()` Mute
    `void` | `next()` Launch Next Content
    `void` | `pause()` Pause Content
    `void` | `play()` Play Content
    `void` | `previous()` Launch Previous Content
    `void` | `removePlayerWatermark()` Removes watermark from player.
    `void` | `resumeApplicationInForeground()` resumes TV widget/application from background process.
    `void` | `setDebug(boolean debug)` Get whether debug is set.
    `void` | `setOnClientConnectListener(Channel.OnClientConnectListener onClientConnectListener)` Set channel client connect Listener
    `void` | `setOnClientDisconnectListener(Channel.OnClientDisconnectListener onClientDisconnectListener)` Set channel client disconnect Listener
    `void` | `setOnConnectListener(Channel.OnConnectListener onConnectListener)` Set connect channel Listener
    `void` | `setOnDisconnectListener(Channel.OnDisconnectListener onDisconnectListener)` Set disconnect channel Listener
    `void` | `setOnErrorListener(Channel.OnErrorListener onErrorListener)` Remove all listeners from remote control channel.
    `void` | `setOnReadyListener(Channel.OnReadyListener OnReadyListener)` Set ready channel Listener
    `void` | `setPlayerWatermark(Uri watermarkUrl)` Sets watermark on player's screen.
    `void` | `setVolume(int volume)` sets the volume
    `void` | `standbyConnect(Result<Boolean> result)` Establish DMP Connection with a standby screen.
    `void` | `standbyConnect(Uri bgImageUrl1, Result<Boolean> result)` Establish DMP Connection with a standby screen.
    `void` | `standbyConnect(Uri bgImageUrl1, Uri bgImageUrl2, Result<Boolean> result)` Establish DMP Connection with a standby screen.
    `void` | `standbyConnect(Uri bgImageUrl1, Uri bgImageUrl2, Uri bgImageUrl3, Result<Boolean> result)` Establish DMP Connection with a standby screen.
    `void` | `stop()` Stop Content
    `void` | `unMute()` Un-mute
    `void` | `volumeDown()` Decreases the volume by 1
    `void` | `volumeUp()` Increases the volume by 1

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### disconnect

          public void disconnect()

      Disconnect from the specified channel.

    - #### disconnect

          public void disconnect(Result<Client> result)

      Disconnect from the specified channel.
      Parameters:
        `result` - the callback to invoke with the result of the disconnect request

    - #### disconnect

          public void disconnect(boolean stopOnDisconnect,
                        Result<Client> callback)

      Disconnect from the media player.
      Parameters:
        `stopOnDisconnect` - stop the media player application, if true. Otherwise, disconnect and leave the media player application running.
        `callback` - the callback to invoke with the result of the disconnect request

    - #### isConnected

          public boolean isConnected()

      Returns if the channel is connected and the host is ready to listen for messages.
      Returns:
        true, if connected and the host is ready. false, otherwise.

    - #### setOnConnectListener

          public void setOnConnectListener(Channel.OnConnectListener onConnectListener)

      Set connect channel Listener
      Parameters:
        `onConnectListener` - - the callback to invoke when Media Player is connected

    - #### setOnDisconnectListener

          public void setOnDisconnectListener(Channel.OnDisconnectListener onDisconnectListener)

      Set disconnect channel Listener
      Parameters:
        `onDisconnectListener` - - the callback to invoke when Media Player is disconnected

    - #### setOnClientConnectListener

          public void setOnClientConnectListener(Channel.OnClientConnectListener onClientConnectListener)

      Set channel client connect Listener
      Parameters:
        `onClientConnectListener` - - the callback to invoke when Media Player client is connected

    - #### setOnClientDisconnectListener

          public void setOnClientDisconnectListener(Channel.OnClientDisconnectListener onClientDisconnectListener)

      Set channel client disconnect Listener
      Parameters:
        `onClientDisconnectListener` - - the callback to invoke when Media Player client is disconnected

    - #### setOnReadyListener

          public void setOnReadyListener(Channel.OnReadyListener OnReadyListener)

      Set ready channel Listener
      Parameters:
        `OnReadyListener` - - the callback to invoke when Media Player channel is ready

    - #### setOnErrorListener

          public void setOnErrorListener(Channel.OnErrorListener onErrorListener)

      Remove all listeners from remote control channel.
      Parameters:
        `onErrorListener` - - the callback to invoke when Media Player channel has some error

    - #### standbyConnect

          public final void standbyConnect(Result<Boolean> result)

      Establish DMP Connection with a standby screen.
      Parameters:
        `result` - callback

    - #### standbyConnect

          public final void standbyConnect(Uri bgImageUrl1,
                            Result<Boolean> result)

      Establish DMP Connection with a standby screen.
      Parameters:
        `bgImageUrl1` - background image 1 url
        `result` - callback

    - #### standbyConnect

          public final void standbyConnect(Uri bgImageUrl1,
                            Uri bgImageUrl2,
                            Result<Boolean> result)

      Establish DMP Connection with a standby screen.
      Parameters:
        `bgImageUrl1` - background image 1 url
        `bgImageUrl2` - background image 2 url
        `result` - callback

    - #### standbyConnect

          public final void standbyConnect(Uri bgImageUrl1,
                            Uri bgImageUrl2,
                            Uri bgImageUrl3,
                            Result<Boolean> result)

      Establish DMP Connection with a standby screen.
      Parameters:
        `bgImageUrl1` - background image 1 url
        `bgImageUrl2` - background image 2 url
        `bgImageUrl3` - background image 3 url
        `result` - callback

    - #### resumeApplicationInForeground

          public final void resumeApplicationInForeground()

      resumes TV widget/application from background process.

    - #### setPlayerWatermark

          public final void setPlayerWatermark(Uri watermarkUrl)

      Sets watermark on player's screen.
      Parameters:
        `watermarkUrl` - URL to the Watermark image

    - #### removePlayerWatermark

          public final void removePlayerWatermark()

      Removes watermark from player.

    - #### play

          public void play()

      Play Content

    - #### pause

          public void pause()

      Pause Content

    - #### stop

          public void stop()

      Stop Content

    - #### mute

          public void mute()

      Mute

    - #### unMute

          public void unMute()

      Un-mute

    - #### setVolume

          public void setVolume(int volume)

      sets the volume
      Parameters:
        `volume` - - volume value in range 0 to 100 (%).

    - #### getControlStatus

          public void getControlStatus()

      fetches the control status - volume, mute, shuffle and repeat

    - #### volumeUp

          public void volumeUp()

      Increases the volume by 1

    - #### volumeDown

          public void volumeDown()

      Decreases the volume by 1

    - #### previous

          public void previous()

      Launch Previous Content

    - #### next

          public void next()

      Launch Next Content

    - #### setDebug

          public void setDebug(boolean debug)

      Get whether debug is set.

    - #### isDebug

          public boolean isDebug()

      Get whether debug is set.