trakt / Plex-Trakt-Scrobbler

Add what you are watching on Plex to trakt.tv
1.45k stars 166 forks source link

Android clients have "fuzzy" scrobbling logic with default (Plex internal) player #425

Open dgw opened 7 years ago

dgw commented 7 years ago

Playing items in Plex Media Player on Windows and Mac works great for me (assuming I remember to work around #405). They show up on Trakt when playing, and then appear in my history once completed.

If I watch anything on Android—phone, tablet, Android TV box—nothing appears in my history. It's likely related to Plex's Android app(s) failing to send the "stop" event back to PMS, and there's probably nothing the plugin can do to catch it…but it's definitely an issue that the plugin doesn't work with all official clients, IMO.

I recall bringing this up in another issue before, in the comments, but I've gotten no traction whatsoever from Plex on the problem. So at the very least, it seems suitable to have an open issue here that can be pointed at as an example of what's broken and how it affects users. @fuzeman, I don't suppose you have the ear of anyone at Plex who might take a look at their Android code?

fuzeman commented 7 years ago

If I watch anything on Android—phone, tablet, Android TV box—nothing appears in my history. It's likely related to Plex's Android app(s) failing to send the "stop" event back to PMS, and there's probably nothing the plugin can do to catch it…but it's definitely an issue that the plugin doesn't work with all official clients, IMO.

Are these items ever marked as watched in Plex Media Server? the next sync in the plugin should pick these items up and update your Trakt.tv profile, but there is a few bugs that have been identified recently which can cause watched items to be ignored during syncs. (these bugs should be fixed in the syncing overhaul currently in development)

@fuzeman, I don't suppose you have the ear of anyone at Plex who might take a look at their Android code?

Nope, have never talked to anyone at Plex.

dgw commented 7 years ago

They are marked as watched, yes. I do not have sync enabled, though—only the real-time scrobbling.

dgw commented 7 years ago

An update on this: I hadn't used my tablet for some time when creating this issue, but scrobbling did not work when last tested. This week I used it for Plex again, and it seems to be scrobbling.

Just this evening I played one episode each of the same show from the same Plex server on both my phone and tablet. Phone play didn't scrobble, but tablet play did. Both devices are running Android 6.0.1 and Plex for Android 5.6.1.505 (25ece77b) — so there is no version discrepancy anywhere to explain the difference in behavior.

dgw commented 7 years ago

So, the identical versions of everything got me curious. Started poking around in the Plex app settings and discovered that, under Video, "Use Android Media Player" was enabled on the tablet and disabled on the phone. Switched those around, played another episode on each, and now the phone scrobbles but the tablet doesn't.

So… Scrobbling from Plex for Android seems to work if it's using the Android Media Player, but not if it's using its own built-in player. If nothing else, assuming it continues working, it's a solid workaround until/unless Plex fix their own player.

dgw commented 7 years ago

Last test for today, I promise!

Dug out my Nexus Player and made sure Plex was up-to-date. Played an episode there—no scrobble. Plex's TV UI doesn't allow access to the "Use Android Media Player" setting (it doesn't appear anywhere in the Settings menu), so the workaround is not possible on Android TV, sadly.

fuzeman commented 7 years ago

Did some more testing and discovered:

"Plex" Media Player ("Use Android Media Player" option disabled)

Android Media Player

In both cases scrobbling did work for me, but Android Media Player is definitely the more reliable option.


The plugin does receive a logging.action.played event instantly in both cases, but this isn't wired up to anything in the plugin yet. Maybe a hybrid websocket + logging scrobbler could be a good idea moving forward, will need to look into this more at a later date.

dgw commented 7 years ago

Since there's no way to apply the "Use Android Media Player" workaround on Nexus Player / Android TV, I confirmed the 3-4 minute delay on scrobbling when the video ends. Interestingly, one of the plays scrobbled seconds before I manually entered the "real" time on Trakt's website; it seems that pausing the video can affect when scrobbling happens relative to when the video reaches its end.

Ultimately, this means that the issue title—Plays from Android clients not scrobbled—is false, haha. They do get scrobbled, but there's a wonk factor involved as far as timing. I still haven't ruled out scrobbling failures if the video is, say, paused for a long time, but I've been somewhat time constrained in watching things lately and haven't wanted to "waste" time testing.

The logging.action.played event you mentioned, fuzeman, sounds like a good way forward. I'll update the issue title to something a bit more accurate, and look forward to further developments. Incidentally, what is the difference between Video reached end and Video stopped?

fuzeman commented 7 years ago

I'll leave this issue open as a "plex" bug for now, as this really should be fixed by Plex. If we can't get this fixed any time soon, the logging.action.played event could be implemented as a workaround.


Incidentally, what is the difference between Video reached end and Video stopped?

dgw commented 7 years ago

Indeed, Plex should fix it… if I (or anyone else) can ever get traction on that front.

As far as Video stopped goes: that's what I thought. Is scrobbling supposed to happen even if the video was not played to the end? Or are we talking a couple seconds before the end?