lib/sonos/features/voiceover.rb
# Interrupts the speaker and plays the provided URI. When finished, returns the play head
# and state to their original position. Useful for doorbell sounds, announcements, etc.
Interrupts the speaker and plays the provided URI. When finished, returns the play head
and state to their original position. Useful for doorbell sounds, announcements, etc.
Interrupts the speaker and plays the provided URI . When finished returns the play head and state to their original position . Useful for doorbell sounds announcements etc .
def with_isolated_state
    pause if was_playing = is_playing?
    unmute if was_muted = muted?
    previous_volume = volume
    previous = now_playing
    yield
    play uid.gsub('uuid', 'x-rincon-queue') + '#0'
    if previous
      select_track previous[:queue_position]
      seek Time.parse("1/1/1970 #{previous[:current_position]} -0000" ).to_i
      self.volume = previous_volume
      mute if was_muted
    end
    play if was_playing
    {
      original_volume: previous_volume,
      original_state: (was_playing ? 'playing' : 'paused')
    }
  end
def with_isolated_state pause if was_playing = is_playing? unmute if was_muted = muted? previous_volume = volume previous = now_playing yield play uid . gsub ( 'uuid' , 'x-rincon-queue' ) + '#0' if previous select_track previous [ :queue_position ] seek Time . parse ( "1/1/1970 #{previous[:current_position]} -0000" ) . to_i self . volume = previous_volume mute if was_muted end play if was_playing { original_volume : previous_volume , original_state : ( was_playing ? 'playing' : 'paused' ) } end
Interrupts the speaker and plays the provided URI.
Interrupts the speaker and plays the provided URI .
# the sonos app does this. I think it tells the player to think of the master queue as active again