python-firetv
python-firetv copied to clipboard
Incorrect states
When a video is running (also when paused vie pause or the home key) the API alsways shows "play" which is obviously not correct. Running v. 1.0.2 and latest FireTV-OS.
Video in an app, or in the standard Fire TV gui?
Standard GUI. You method of using wake locks seems to fail, although I don't fully understand why. I'm trying to fix it by checking if audio is played via adb instead of using wake locks.
I found a solution. If you run cat /proc/asound/card*/pcm*/sub*/status | grep "state" in adb, when audio is played, the last line will always contain "RUNNING". This seems to be pretty reliable.
Just checking, if there is a way to resolve this? I only get two states, "play" or "off".
I took a look at this. I get the correct states without any changes. My stick is on Fire OS 5.2.1.1. Are you guys running a different version?
I tried implementing @mxtra's solution anyway, but my version does not produce the same output.
I am using it with a fire tv box. That might explain why.
Let me verify with a stick. Meanwhile can you share a version with @mxtra's suggestion , so I can verify if that works wth the fire tv box ?
On Oct 13, 2016, at 8:53 PM, happyleavesaoc [email protected] wrote:
I took a look at this. I get the correct states without any changes. My stick is on Fire OS 5.2.1.1. Are you guys running a different version?
I tried implementing @mxtra's solution anyway, but my version does not produce the same output.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Sure, clone the repo and checkout branch fix-states. Run from the checked out directory like python -m firetv -d 192.168.2.55:5555
I tried with a fire TV stick and the states were completely off. My stick has problems staying on a network, so could not spend too much time on it.
On my FireTV box, I tried the fix-states branch. This time, it changes between standby, play and pause. While playing a media, if I pause the video, it works correctly and recognizes. However, if i go back or press the Home button from a video, the status still remains on Play and does not go to Idle or Standby .
Any hints on what I should try next ?
does someone work on this?
I am trying to see if I can do something. I am not a python or a android/adb expert, so it takes some time.
Here's what I found, looking for the audio process to be running is not reliable because other than a video playing these are the times that the audio is active.
- If Navigation sounds are turned on, just navigating changes the state to Play.
- If you use Alexa, then that turns on the audio process as well causing the state to change to play.
Looks like we still need to identify a foolproof way of identifying if the fire tv is actually playing a media or not.
I know its been a while, but I still get incorrect states. Any updates on this issue?
States which are not working for me are "Pause" and "Disconnected". If I play media and press pause, using the remote or in HA, status remains "play". "Disconnected" is not working at all. If I unplug my Fire TV Stick, it shows the last state.
Running on Fire TV Stick, Fire OS 5.2.6.0 and Home Assistant 0.57.2.
Hi,
Thanks for the awesome work here!
I just ported the library to typescript/JavaScript and came across the same state problem with my FireTV gen 3. python-firetv always reported "play" when not in idle/standby (e.g. netflix app in foreground but playback paused).
I found a possible fix by parsing the output of dumpsys media_session which includes all active audio streams as well as an active and state=PlaybackState{...} property. It actually provides more detailed information as the PlaybackState includes values for Playing, Paused, Stop, Buffering, Connecting, ... (https://developer.android.com/reference/android/media/session/PlaybackState.html). Maybe this helps.
Cheers Patrick
I looked into using that at some point, but unfortunately not all apps leverage that API, so the detection with it would still be spotty. Nevertheless, I think that would be an enhancement to the current situation, so I would gladly see support for using it as the primary source for playback state!
I don't think there's a universal solution for this, I think state detection might need to be app-specific. I merged in some initial work in https://github.com/happyleavesaoc/python-firetv/pull/80. Feel free to contribute state detection for different apps or to improve on the existing state detection.
Hi, after update to homeassistant 0.89 .. before the only thing that worked was play, pause and stop. Now it's ok source, forward, reverse, standby ... but it say always paused during viewing .. It change from "standby" .. to "paused" during viewing (Netflix, Amazon Video and all other app .. also listening music) but it don't change in "playing". Before update it switched also in Netflix menu .. for me was ok.
I also only see paused.
@zUpm4n @derekgdicamillo I guess you read this issue and the advices: https://github.com/home-assistant/home-assistant/issues/23346