# MediaPlayer

    @objc open class MediaPlayer: NSObject

This class is wrapper which handle tv media calls. its basic functionality is to launch DMP on TV and whatever notification comes from TV side it passes on to further module.

- `PlayerNotice`

  Namespace for constants that describe notices from media player on TV.

  See more

  #### Declaration

  Swift

      public struct PlayerNotice

- `service`

  TV service name

  #### Declaration

  Swift

      open fileprivate(set) var service: Service

- `connected`

  Application Connection Status with TV.

  #### Declaration

  Swift

      open fileprivate(set) var connected: Bool = false

- `onMessage(_:)`

  Notification of any data received from TV player

  #### Declaration

  Swift

      public func onMessage(_ message: Message)

  #### Parameters

  `notification` | contains player queue event and action

- `onConnect(_:error:)`

  event occur when connection occur with channel

  - client: The client that is connecting which is yourself
  - error: An error info if connect fails

  #### Declaration

  Swift

      public func onConnect(_ client: ChannelClient?, error: NSError?)

- `onDisconnect(_:error:)`

  event occur when disconnection occur with channel.

  - client: The client that is disconnecting which is yourself
  - error: An error info if disconnect fails

  #### Declaration

  Swift

      public func onDisconnect(_ client: ChannelClient?, error: NSError?)

- `onClientConnect(_:)`

  #### Declaration

  Swift

      public func onClientConnect(_ client: ChannelClient)

  #### Parameters

  `client` | The Client that just connected to the Channel

- `onClientDisconnect(_:)`

  #### Declaration

  Swift

      public func onClientDisconnect(_ client: ChannelClient)

  #### Parameters

  `client` | The Client that just disconnected from the Channel

- `onError(_:)`

  #### Declaration

  Swift

      public func onError(_ error: NSError)

  #### Parameters

  `error` | The error

- `onReady()`

  #### Declaration

  Swift

      public func onReady()