mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Allow player session changes
This commit is contained in:
parent
ddadcc9ea0
commit
c6b62b82d4
1 changed files with 8 additions and 0 deletions
|
@ -105,6 +105,7 @@ enum PlayerCommand {
|
|||
Pause,
|
||||
Stop,
|
||||
Seek(u32),
|
||||
SetSession(Session),
|
||||
AddEventSender(mpsc::UnboundedSender<PlayerEvent>),
|
||||
SetSinkEventCallback(Option<SinkEventCallback>),
|
||||
EmitVolumeChangedEvent(u16),
|
||||
|
@ -538,6 +539,10 @@ impl Player {
|
|||
self.command(PlayerCommand::Seek(position_ms));
|
||||
}
|
||||
|
||||
pub fn set_session(&self, session: Session) {
|
||||
self.command(PlayerCommand::SetSession(session));
|
||||
}
|
||||
|
||||
pub fn get_player_event_channel(&self) -> PlayerEventChannel {
|
||||
let (event_sender, event_receiver) = mpsc::unbounded_channel();
|
||||
self.command(PlayerCommand::AddEventSender(event_sender));
|
||||
|
@ -2092,6 +2097,8 @@ impl PlayerInternal {
|
|||
|
||||
PlayerCommand::Stop => self.handle_player_stop(),
|
||||
|
||||
PlayerCommand::SetSession(session) => self.session = session,
|
||||
|
||||
PlayerCommand::AddEventSender(sender) => self.event_senders.push(sender),
|
||||
|
||||
PlayerCommand::SetSinkEventCallback(callback) => self.sink_event_callback = callback,
|
||||
|
@ -2282,6 +2289,7 @@ impl fmt::Debug for PlayerCommand {
|
|||
PlayerCommand::Pause => f.debug_tuple("Pause").finish(),
|
||||
PlayerCommand::Stop => f.debug_tuple("Stop").finish(),
|
||||
PlayerCommand::Seek(position) => f.debug_tuple("Seek").field(&position).finish(),
|
||||
PlayerCommand::SetSession(_) => f.debug_tuple("SetSession").finish(),
|
||||
PlayerCommand::AddEventSender(_) => f.debug_tuple("AddEventSender").finish(),
|
||||
PlayerCommand::SetSinkEventCallback(_) => {
|
||||
f.debug_tuple("SetSinkEventCallback").finish()
|
||||
|
|
Loading…
Reference in a new issue