I know this is not a proper answer to your question, but around 10 months ago, I struggled with the YouTube API myself. I really wanted to use the proper YouTube API from Google because that’s the official API. Because of future support, it being made inhouse, and so on.
After facing many challenges such as your own, I finally gave another third-party library a chance and it was night and day
com.pierfrancescosoffritti.androidyoutubeplayer this is the name of the dependency by Pier Francesco Soffritti and if you continue facing challenges, I seriously recommend you give it a try. When I tried using the YouTube API it hadn’t been maintained for several years and I read about and personally faced bugs everywhere.
Here an article written by the man himself about why a third-party library is the way to go here.