Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AppleTV

Hierarchy

Index

Constructors

constructor

  • new AppleTV(service: Service): AppleTV

Properties

address

address: string

credentials

credentials: Credentials

name

name: string

pairingId

pairingId: string = uuid()

port

port: number

uid

uid: string

Static defaultMaxListeners

defaultMaxListeners: number

Methods

_on

  • _on(event: string, callback: function): this

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

closeConnection

  • closeConnection(): void

emit

  • emit(event: keyof Events, payload?: T[keyof T]): boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

  • on(event: keyof Events, callback: function): this
  • Parameters

    • event: keyof Events
    • callback: function
        • (arg: T[keyof T]): void
        • Parameters

          • arg: T[keyof T]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

openConnection

  • Opens a connection to the AppleTV over the MRP protocol.

    Parameters

    • Optional credentials: Credentials

      The credentials object for this AppleTV

    Returns Promise<AppleTV>

    A promise that resolves to the AppleTV object.

pair

  • pair(): Promise<function>
  • Pair with an already discovered AppleTV.

    Returns Promise<function>

    A promise that resolves to the AppleTV object.

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

requestPlaybackQueue

sendKeyCommand

  • Send a key command to the AppleTV.

    Parameters

    • key: Key

      The key to press.

    Returns Promise<AppleTV>

    A promise that resolves to the AppleTV object after the message has been sent.

sendMessage

  • sendMessage(definitionFilename: string, messageType: string, body: __type, waitForResponse: boolean): Promise<Message>
  • Send a Protobuf message to the AppleTV. This is for advanced usage only.

    Parameters

    • definitionFilename: string

      The Protobuf filename of the message type.

    • messageType: string

      The name of the message.

    • body: __type

      The message body

    • waitForResponse: boolean

      Whether or not to wait for a response before resolving the Promise.

    Returns Promise<Message>

    A promise that resolves to the response from the AppleTV.

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static key

  • key(string: string): Key
  • Convert a string representation of a key to the correct enum type.

    Parameters

    • string: string

      The string.

    Returns Key

    The key enum value.

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc