My app has an embedded Youtube player. I am using the latest version of the Youtube Android Player (1.2.1). I am using the YouTubePlayerSupportFragment and this fragment is nested inside another fragment of my app.
It works on Android 4.4 and Android 5.0.
On Android 5.1 it works at the beginning, but after playing some videos the problem arises. The entire device slows down up to the point of it becoming nearly unresponsive. If I kill the app (if the Youtube Android Player gets killed) the device goes back to normality. However, from now on the Youtube Android Player cannot play any more videos (the device becomes unresponsive again).
Edit: in case the problem was in the fact that it is an embedded fragment, I have tested with an Intent (YouTubeIntents.createPlayVideoIntentWithOptions). The problem remains the same.
Has anybody experienced this kind of problems?
Solved! I was compiling with targetSDK 21, but Android 5.1 is SDK 22. It looks like compiling with an older SDK was causing the problem. After updating the targetSDK to 22, now it work like a charm.