question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting informed about user actions

See original GitHub issue

Searched documentation and issues

Official ExoPlayer documentation and source code of MediaControllerCompat, MediaSessionConnector, MediaSession classes.

Question

Is it possible to get notified about user actions? I’m using ExoPlayer and MediaSessionConnector for handling MediaSession, so I’m not able to register MediaSession.Callback, that would have solved my problem, because it can be registered only once and it is done inside of MediaSessionConnector class.

I would like to be informed about user actions like “PLAY”, “PAUSE”, “SKIP TO NEXT”, “SKIP TO PREVIOUS” etc. The only way to do it, I have found, is to register MediaControllerCompat.Callback, that has onPlaybackStateChanged method. The problem is that after testing it, I have found that only states that are dispatched to this method are STATE_NONE, STATE_PAUSED, STATE_PLAYING and STATE_BUFFERING. There are other states like STATE_SKIPPING_TO_PREVIOUS, STATE_SKIPPING_TO_NEXT I would like to be notified about, but it never happens.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcbaechingercommented, Jun 18, 2019

I think in this case it’s best to register an EventListener with player.addListener(eventListener).

The player will call onPositionDiscontinuity(int reason) and pass a reason. If it’s a seek by the user (skip is a seek) the reason is Player.DISCONTINUITY_REASON_SEEK. If playback transitioned automatically the reason is Player.DISCONTINUITY_REASON_PERIOD_TRANSITION.

You may also want to look into AnalyticsListener if you want to collect other events. You can add it by using SimpleExoPlayer.addAnalyticsListener(AnalyticsListener).

0reactions
marcbaechingercommented, Jun 18, 2019

Great to hear. I’m closing this issue. Please re-open if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Tools to Track User Activity on Your Website - Verfacto
User behavior tracking is essential for every online business that wants to grow conversions and enhance the on-site customer experience. Fortunately, modern ...
Read more >
User Behavior: How to Track it on Your Website + Analysis
A 3-step framework for analyzing the behavior of users on your site, plus a list of tools and methods that will help you...
Read more >
Did You Know? The “User Activity Log” Helps Managers Stay ...
For a step–by step video demonstration of how the User Activity Log can help you keep you informed and in control, visit the...
Read more >
How to Effectively Monitor User Activity - Pingdom
Monitoring user activity on your website is a must if you want to run a successful and profitable online business. By implementing real...
Read more >
Involving Users in Web Projects for Better, Easier Accessibility
Involving users early in projects helps you understand real-world accessibility issues, such as how people with disabilities and older people use the web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found