MultiViewerForF1

A class for querying and controlling MultiViewerForF1 players.

class mvf1.MultiViewerForF1(uri='http://localhost:10101/api/graphql')

A class to control video players for MultiViewerForF1, the best way to watch Formula 1.

To download the app, visit their website at https://multiviewer.app/.

Parameters

uri: str, optional Uri to control the MultiViewerForF1 install. Defaults to http://localhost:101010/api/graphql

Attributes

endpoint: HTTPEndpoint

GraphQL API Endpoint of MultiViewerForF1.

property f1_live_timing_clock: dict

Returns the time for an event when it is live.

Returns

dict

Current time.

property f1_live_timing_state: dict

Returns state of live timing at current time.

Returns

dict

Current state.

property fiawec_live_timing_state: dict

Returns state of live timing at current time.

Returns

dict

Current state.

property live_timing_clock: dict

Returns the time for an event when it is live.

Returns

dict

Current time.

property live_timing_state: dict

Returns state of live timing at current time.

Returns

dict

Current state.

perform_operation(operation: Operation) dict

Performs the GraphQL operation.

Parameters

operation: Operation

GraphQL Operation.

Returns

dict

MultiViewerForF1 API Response.

player(id: int) Player

Returns the player with specific id.

Parameters

id: int

Id of player.

Returns

dict

Player object.

player_create(content_id: int, driver_tla: str | None = None, driver_number: int | None = None, stream_title: str | None = None, x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None, fullscreen: bool | None = False, always_on_top: bool | None = False, maintain_aspect_ratio: bool | None = True) dict

Creates a new player.

Parameters

content_id: int

Content Id.

driver_tla: str, optional

Driver three letter acronym (e.g. ‘PER’ or ‘HAM’).

driver_number: int, optional

Driver Number.

stream_title: str, optional

Stream Title.

x: int, optional

X coordinate of player’s top left corner.

y: int, optional

Y coordinate of player’s top left corner.

width: int, optional

Width of player.

height: int, optional

Height of player.

fullscreen: bool, optional

Fullscreen status.

always_on_top: bool, optional

Always on top status.

maintain_aspect_ratio: bool, optional

Maintain aspect ratio status.

Returns

dict

Dict with result of playerCreate operation. If successful, will include the player_id.

Implementation note: we return a player_id instead of a Player object is that there is ~200-800 millisecond lag in between the invocation of player_create and the player_id being accessible via the MultiViewer For F1 GraphQL API. Player creation is non-blocking and there is no callback when it is complete. As a consequence, we leave this as an implmentation decision for you.

Most folks put a sleep in between player creation and player access.

player_delete(id: int) dict

Deletes a player.

Parameters

id: int

Id of player.

Returns

dict

Deletion response.

player_seek_to(id: int, absolute: int | None = None, relative: int | None = None) dict

Seeks to a specific position.

Parameters

id: int

Id of player.

absolute: int, optional

Absolute position.

relative: int, optional

Relative position.

Returns

dict

Seek response.

player_set_always_on_top(id: int, always_on_top: bool | None = None) dict

Sets player on/off always on top.

Parameters

id: int

Id of player.

always_on_top: bool, optional

Is the player always on top?

Returns

dict

True if operation is successful.

player_set_bounds(id: int, x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) dict

Set the bounds of a player.

Parameters

id: int

Id of player.

x: int, optional

X coordinate of player’s top left corner.

y: int, optional

Y coordinate of player’s top left corner.

width: int, optional

Width of player.

height: int, optional

Height of player.

Returns

dict

True if operation is successful.

player_set_driver_header_mode(id: int, mode: str | None = None) dict

Sets the overlay display for a driver stream.

Parameters

id: int

Id of player.

mode: str, optional

Desired overlay of the player - can be DRIVER_HEADER, NONE or OBC_LIVE_TIMING

Returns

dict

True if operation is successful.

player_set_fullscreen(id: int, fullscreen: bool | None = None) dict

Toggles fullscreen for a player or specifies fullscreen state for player.

Parameters

id: int

Id of player.

fullscreen: bool, optional

Desired fullscreen state of player.

Returns

dict

True if operation is successful.

player_set_muted(id: int, muted: bool | None = None) dict

Mutes/unmutes player or specifies muted state for player.

Parameters

id: int

Id of player.

muted: bool, optional

Desired muted state of player.

Returns

dict

True if operation is successful.

player_set_paused(id: int, paused: bool | None = None) dict

Pauses/unpauses player or specifies pause state for player.

Parameters

id: int

Id of player.

paused: bool, optional

Desired pause state for player.

Returns

dict

True if operation is successful.

player_set_speedometer_visibility(id: int, visible: bool | None = None) dict

Makes speedometer overlay on player visible/invisible or specifies visibility.

Parameters

id: int

Id of player.

visible: bool, optional

Visibility state of speedometer of player.

Returns

dict

True if operation is successful.

player_set_volume(id: int, volume: int) dict

Set the volume of a player.

Parameters

id: int

Id of player.

volume: int

Volume of player.

Returns

dict

True if operation is successful.

player_sync(id: int) dict

Synchronizes all players to the timestamp of specified player.

Parameters

id: int

Id of player.

Returns

dict

True if operation is successful.

player_sync_to_commentary() dict

Synchronizes all players to the player with a broadcast commentary stream.

Returns

dict

True if operation is successful.

property players: list

Returns a list of active MultiViewerForF1 players.

Returns

list

List of Player objects.

property system_info: dict

Returns the system information.

Returns

dict

System information.

property version: dict

Returns the MultiViewerForF1 version.

Returns

dict

Version information.