Fixed Playing and Pausing when in mode internet radio#11
Fixed Playing and Pausing when in mode internet radio#11wlcrs merged 3 commits intozhelev:masterfrom
Conversation
|
pausing and stopping is not the same. Please remove the override in the pause function and add a dedicated stop function instead. please don't change the forward/rewind functions. They function as desired: they raise an error when the radio is in an invalid mode. |
|
@wlcrs I can't get your suggestions working. |
|
All your questions here are not relevant to the code changes required in this library. So please apply the requested changes if you want me to merge this PR. To answer your HA question: we'll need to add a dynamic "supported_features" property. Cfr. this AI-generated example: from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerEntityFeature
)
class MyDynamicPlayer(MediaPlayerEntity):
def __init__(self):
self._is_streaming_live = False
@property
def supported_features(self) -> MediaPlayerEntityFeature:
# Base features every device has
features = MediaPlayerEntityFeature.PLAY | MediaPlayerEntityFeature.PAUSE
# Dynamically add SEEK only if not a live stream
if not self._is_streaming_live:
features |= MediaPlayerEntityFeature.SEEK
return features
async def async_update_stream_type(self, is_live):
"""Call this when your device state changes."""
self._is_streaming_live = is_live
# THIS IS THE SYNC CALL: It tells HA to re-read 'supported_features'
self.async_write_ha_state() |
SpeedyGoneZales
left a comment
There was a problem hiding this comment.
Added stop method and test for stop method
|
Hi @SpeedyGoneZales , Your changes have been released today. I'm looking into updating the HA integration now (cfr. wlcrs/home-assistant-core@b8acce8) . However, when testing the start/stop when in Internetradio-mode, I notice that trying to start the stream again with http://192.168.1.183/fsapi/SET/netRemote.play.control?pin=1234&value=2 does not work. However, http://192.168.1.183/fsapi/SET/netRemote.play.control?pin=1234&value=0 does work for me. This is strange, as 2 is generally used for |
Yes, that is exactly what misled me into trying all the things with somehow persisting the last played station. |
When in mode Internet Radio, playing and stopping a stream is achieved running
http://<IP>/fsapi/SET/netRemote.play.control?pin=1234&value=0, whereas in other modes value is 1 for Play and 2 for Pause.This pull request checks which mode the radio is in, and send 0 (aka STOP) when in Internet radio mode.