audio: Add state_changed(old_state, new_state) event
This commit is contained in:
parent
42fdaf3ff0
commit
76b1fa8e1b
@ -28,3 +28,18 @@ class AudioListener(object):
|
|||||||
*MAY* be implemented by actor.
|
*MAY* be implemented by actor.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def state_changed(self, old_state, new_state):
|
||||||
|
"""
|
||||||
|
Called after the playback state have changed.
|
||||||
|
|
||||||
|
Will be called for both immediate and async state changes in GStreamer.
|
||||||
|
|
||||||
|
*MAY* be implemented by actor.
|
||||||
|
|
||||||
|
:param old_state: the state before the change
|
||||||
|
:type old_state: string from :class:`mopidy.core.PlaybackState` field
|
||||||
|
:param new_state: the state after the change
|
||||||
|
:type new_state: string from :class:`mopidy.core.PlaybackState` field
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
16
tests/audio/listener_test.py
Normal file
16
tests/audio/listener_test.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from mopidy import audio
|
||||||
|
|
||||||
|
from tests import unittest
|
||||||
|
|
||||||
|
|
||||||
|
class AudioListenerTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.listener = audio.AudioListener()
|
||||||
|
|
||||||
|
def test_listener_has_default_impl_for_reached_end_of_stream(self):
|
||||||
|
self.listener.reached_end_of_stream()
|
||||||
|
|
||||||
|
def test_listener_has_default_impl_for_state_changed(self):
|
||||||
|
self.listener.state_changed(None, None)
|
||||||
Loading…
Reference in New Issue
Block a user