pyytlounge.YtLoungeApi

class pyytlounge.YtLoungeApi(device_name: str, event_listener: EventListener | None = None, logger: Logger | None = None)

YouTube Lounge API

__init__(device_name: str, event_listener: EventListener | None = None, logger: Logger | None = None)

Create an instance of the API which can connect to a single screen

Parameters:
  • device_name – This name will show up on the screen

  • event_listener – Setting a listener allows you to receive updates from the screen

  • logger – Override the logger with something custom

Methods

__init__(device_name[, event_listener, logger])

Create an instance of the API which can connect to a single screen

close()

connect()

Attempt to connect using the previously set tokens

connected()

Returns true if the screen's session is connected.

disconnect()

Disconnect from the current session

is_available()

Asks YouTube API if the screen is available.

linked()

Returns true if paired and lounge id token is known.

load_auth_state(data)

Use deserialized auth parameters

next()

Sends next command to screen

pair(pairing_code)

Pair with a device using a manual input pairing code

pair_with_screen_id(screen_id[, screen_name])

Pair with a device using a known screen id Optionally specify the screen name if already known

paired()

Returns true if screen id is known.

pause()

Sends pause command to screen

play()

Sends play command to screen

play_video(video_id)

Sends setPlaylist command to screen to play a specific video

previous()

Sends previous command to screen

refresh_auth()

Refresh lounge token using stored refresh token.

seek_to(time)

Seek to given time (seconds)

send_dpad_command(button_input)

Sends a dpad command like a remote.

set_auto_play_mode(enabled)

set_closed_captions(language_code, video_id)

Sets the closed captions to the provided BCP-47 language_code if available.

set_playback_speed(speed)

Sets the playback speed to given value (0.25-2)

set_volume(volume)

Sets volume to given value (0-100)

skip_ad()

Skips ad if possible

store_auth_state()

Return auth parameters as dict which can be serialized for later use

subscribe()

Start listening for events.

Attributes

screen_device_name

Returns device name built from device info returned by YouTube.

screen_name

Returns screen name as returned by YouTube