Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect states #7

Open
marcpabst opened this issue Sep 7, 2016 · 17 comments
Open

Incorrect states #7

marcpabst opened this issue Sep 7, 2016 · 17 comments

Comments

@marcpabst
Copy link

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.

@happyleavesaoc
Copy link
Owner

Video in an app, or in the standard Fire TV gui?

@marcpabst
Copy link
Author

marcpabst commented Sep 7, 2016

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.

@marcpabst
Copy link
Author

marcpabst commented Sep 7, 2016

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.

@kdvlr
Copy link

kdvlr commented Oct 8, 2016

Just checking, if there is a way to resolve this? I only get two states, "play" or "off".

@happyleavesaoc
Copy link
Owner

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.

@kdvlr
Copy link

kdvlr commented Oct 14, 2016

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.

@happyleavesaoc
Copy link
Owner

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

@kdvlr
Copy link

kdvlr commented Oct 15, 2016

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 ?

@juliangeiges
Copy link
Contributor

does someone work on this?

@kdvlr
Copy link

kdvlr commented Oct 17, 2016

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.

  1. If Navigation sounds are turned on, just navigating changes the state to Play.
  2. 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.

@fabianbrunke
Copy link

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.

@ppacher
Copy link

ppacher commented Mar 1, 2018

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

@rytilahti
Copy link
Contributor

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!

@JeffLIrion
Copy link
Collaborator

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 #80. Feel free to contribute state detection for different apps or to improve on the existing state detection.

@zUpm4n
Copy link

zUpm4n commented Mar 10, 2019

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.

@derekgdicamillo
Copy link

I also only see paused.

@pattyland
Copy link

@zUpm4n @derekgdicamillo I guess you read this issue and the advices: home-assistant/core#23346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests