I'm working on a android application and i get mp4 file urls from a json file. Now i want to play these files inside my app using a youtube player. After some research i managed to play my videos within my app. But when i go back from playing videos to other parts of my app,the app seems to be slowed down. I need to know if i'm doing this correctly.
This is my code used to play the video.
if (YouTubeApiServiceUtil.isYouTubeApiServiceAvailable(activity).equals(
YouTubeInitializationResult.SUCCESS)
&& android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Intent intent = YouTubeStandalonePlayer
.createVideoIntent(activity, API_KEY,
video.getFile());
startActivity(intent);
}
from video.getFile();
i'm getting my video url.
i have used YouTubeAndroidPlayerApi.jar as the library.
1.Download YouTubePlyaer API https://developers.google.com/youtube/android/player/downloads/
Register your app on google developer console https://console.developers.google.com
Take an unique API Key and use that in your App.
use below code