# AudioPlayer

    @objc open class AudioPlayer: BasePlayer

Audio Player Class handle the Audio share,control and TV Player queue.

- `playerDelegate`

  The Audio Player delegate protocol defines the event methods available for a Audio.

  #### Declaration

  Swift

      open weak var playerDelegate: AudioPlayerDelegate? = nil

- `AudioRepeatMode`

  Enum for Player list mode Supported mode: repeatAll,repeatOff,repeatSingle

  See more

  #### Declaration

  Swift

      @objc public enum AudioRepeatMode: Int

### Public APIs- objective C compatible

- `playContent(_:completionHandler:)`

  this method play Audio content on TV.

  #### Declaration

  Swift

      @objc open func playContent(_ contentURL: URL, completionHandler: ((NSError?) -> Void)? = nil)

  #### Parameters

  `contentURL` | Audio Url
  `completionHandler` | The response completion closure, it will be executed in the request queue i.e. in a backgound thread.

- `playContent(_:title:albumName:albumArtUrl:completionHandler:)`

  play Audio content on TV.

  #### Declaration

  Swift

      @objc open func playContent(_ contentURL: URL?, title: String, albumName: String, albumArtUrl: URL?, completionHandler: ((NSError?) -> Void)? = nil)

  #### Parameters

  `contentURL` | Content URL
  `title` | Content Title
  `albumName` | Content album name
  `albumArtUrl` | Content thumbnail URL
  `completionHandler` | The response completion closure, it will be executed in the request queue i.e. in a backgound thread.

- `seek(_:)`

  Seek the given time in currently playing media.

  #### Declaration

  Swift

      @objc open func seek(_ time: TimeInterval)

  #### Parameters

  `time` | Time in seconds within length of currently playing media.

- `resumeApplicationInForeground(_:)`

  resumes TV widget/application from background process.

  #### Declaration

  Swift

      @objc open func resumeApplicationInForeground(_ completionHandler: ((NSError?) -> Void)? = nil)

  #### Parameters

  `completionHandler` | The response completion closure, it will be executed in the request queue i.e. in a backgound thread.

### Queue Implementation

- `repeat()`

  repeat player list.

  #### Declaration

  Swift

      @objc open func `repeat`()

- `setRepeat(_:)`

  Set player list mode Supported mode: repeatAll,repeatOff,repeatSingle

  #### Declaration

  Swift

      @objc open func setRepeat(_ mode: AudioRepeatMode)

- `shuffle()`

  shuffle player list.

  #### Declaration

  Swift

      @objc open func shuffle()

- `shuffle(_:)`

  shuffle player list.

  #### Declaration

  Swift

      @objc open func shuffle(_ mode: Bool)

- `getList()`

  request player list i.e currently playing on TV.

  #### Declaration

  Swift

      @objc open func getList()

- `clearList()`

  request to delete(removeAll) player list.

  #### Declaration

  Swift

      @objc open func clearList()

- `removeFromList(_:)`

  remove specific audio from player list.

  #### Declaration

  Swift

      @objc open func removeFromList(_ contentURL: URL)

  #### Parameters

  `contentURL` | Audio URL

- `addToList(_:title:albumName:albumArtUrl:)`

  Add Audio item to player list.

  #### Declaration

  Swift

      @objc open func addToList(_ contentURL: URL, title: String = "", albumName: String = "", albumArtUrl: URL = URL(fileURLWithPath: ""))

  #### Parameters

  `contentURL` | URL
  `title` | Title
  `albumName` | Album NAme
  `albumArtUrl` | thumbnail URL

- `addToList(_:)`

  Add Audio item to player list.

  #### Declaration

  Swift

      @objc public func addToList(_ arrayDictofData: [[String: AnyObject]])

  #### Parameters

  `arrayDictofData` | list data in form array of dictionary

### Notification Method

- `onMessage(_:)`

  Notification of any data received from TV player

  #### Declaration

  Swift

      open func onMessage(_ notification: Notification!)

  #### Parameters

  `notification` | contains player queue event and action