Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect the current playing video in the official Youtube app

I want to implement an application that listens for events from the official Youtube Application, I've been digging into a lot of question here in Stackoverflow but I couldn't find a good answer.

I want to listen when a video start and pause/stop, I've seen in the logcat some relevant information. The only thing that is missing is the video ID. But maybe there is another better way to get this information.

enter image description here

And I know It is possible because that's exactly what Musixmatch does:

enter image description here

Thank you

like image 709
Miguel Avatar asked Jan 01 '26 22:01

Miguel


1 Answers

Please refer to Android MediaController (https://developer.android.com/reference/androidx/media2/session/MediaController) which -

Allows an app to interact with an active MediaSession or a MediaSessionService which would provide MediaSession. Media buttons and other commands can be sent to the session.

like image 88
Namachivayam Chelladurai Avatar answered Jan 03 '26 12:01

Namachivayam Chelladurai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!