Unfortunately, our initial API is not powerful enough. Users want to be able to interact with a PlayerStateoutside of the scope of a DefaultUI or UIController, and they want to be able to wrap it to provide a custom API.
This PR extracts the construction of the THEOplayerView and its associated PlayerState into a public rememberPlayer(config) function, returning a Player. This Player can be passed directly to DefaultUI or UIController, which will then "host" the associated THEOplayerView.
A Player can now also be moved into a different UI without losing the player's state. This is shown in the demo app, where switching between the default theme and the Nitflex theme now retains the playback state.
Unfortunately, our initial API is not powerful enough. Users want to be able to interact with a
PlayerState
outside of the scope of aDefaultUI
orUIController
, and they want to be able to wrap it to provide a custom API.This PR extracts the construction of the
THEOplayerView
and its associatedPlayerState
into a publicrememberPlayer(config)
function, returning aPlayer
. ThisPlayer
can be passed directly toDefaultUI
orUIController
, which will then "host" the associatedTHEOplayerView
.A
Player
can now also be moved into a different UI without losing the player's state. This is shown in the demo app, where switching between the default theme and the Nitflex theme now retains the playback state.