Player

public enum Player

Manages all available players (Kodi Namespace & Kodi Global Type)

Note

Fuctions in Player that will give a response are ‘Asynchronous’; others are not
  • The audio details of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Audio
  • The direction for goTo(playerID:position:) (SwiftlyKodi Type)

    See more

    Declaration

    Swift

    enum GoToDirection : String, Codable
  • ID

    The ID of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum ID : Int, Codable
  • The type of player (SwiftlyKodi Type)

    See more

    Declaration

    Swift

    enum MediaType : String, Decodable
  • Party mode of the player (SwiftlyKodi Type)

    See more

    Declaration

    Swift

    enum PartyMode : String, Encodable
  • The position details of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Position
  • The properties of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Property
  • The repeat mode of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Repeat : String, Decodable
  • The current subtitle of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    struct Subtitle : Decodable
  • The video details of the player (Global Kodi Type)

    See more

    Declaration

    Swift

    enum Video

getActivePlayers

  • getActivePlayers() Asynchronous

    Returns all active players, if any (Kodi API)

    Declaration

    Swift

    public static func getActivePlayers() async -> [Player.ID]?

    Return Value

    The active players in an ID array

getItem

  • getItem(playerID:) Asynchronous

    Retrieves the currently played item (Kodi API)

    If the result has an ID, it is from the Library and media details will be asked

    Note

    This method does not depend on a ‘loaded library’

    Declaration

    Swift

    public static func getItem(playerID: Player.ID) async -> (any KodiItem)?

    Parameters

    playerID

    The ID of the player

    Return Value

    a KodiItem if there is a current item

getProperties

  • Retrieves the properties of the player (Kodi API)

    Declaration

    Swift

    public static func getProperties(playerID: Player.ID) async -> Player.Property.Value

    Parameters

    playerID

    The ID of the player

    Return Value

    The Value

goTo

open

  • Start playback of a playlist with the given ID (Kodi API)

    Declaration

    Swift

    public static func open(playlistID: Playlist.ID, shuffle: Bool = false)

    Parameters

    playlistID

    The ID of the playlist

    shuffle

    Shuffle the playlist

  • Start playback in party mode (Kodi API)

    Declaration

    Swift

    public static func open(partyMode: Player.PartyMode)

    Parameters

    partyMode

    The PartyMode

playPause

  • Pauses or unpause playback of the player (Kodi API)

    Note

    When there is nothing in the player, this function will do nothing

    Declaration

    Swift

    public static func playPause(playerID: Player.ID)

    Parameters

    playerID

    The ID of the player

setPartyMode

  • Turn partymode on or off (Kodi API)

    Declaration

    Swift

    public static func setPartyMode(playerID: Player.ID)

    Parameters

    playerID

    The ID of the player

setRepeat

  • Set the repeat mode of the player (Kodi API)

    Declaration

    Swift

    public static func setRepeat(playerID: Player.ID)

    Parameters

    playerID

    The ID of the player