I am trying to use YouTubeStandalonePlayer from https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeStandalonePlayer
With this code inside onCreate()
:
Intent intent = YouTubeStandalonePlayer.createVideoIntent(this, DeveloperKey.DEVELOPER_KEY, VIDEO_ID);
startActivity(intent);
But application fails with error.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.youtubestandalone/com.example.youtubestandalone.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.youtube.api.StandalonePlayerActivity.START (has extras) }
How to fix this?
Add this line to your AndroidManifest.xml
<activity
android:name="com.google.android.youtube.api.StandalonePlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
/>