i am using an youtube player api of google to play youtube videos, it specifies three different styles of player view, is this any way to customize the player view in android.
Thank you
I don't know what kind of style you want, but you can use YouTube Player as Activity or Fragment or a View.
So you can basically customise your player easily with new YouTubePlayer API
If you want some simple youtube player with fullscreen (no titlebar mode), You are welcome to use my code!!
This source handle "Orientation Problem", "Media Volume Problem", "Youtube Url Parsing Problem"
Here is open source library
https://github.com/TheFinestArtist/SimpleYouTubePlayer
This is sample codes
https://gist.github.com/TheFinestArtist/5545437
I also made sample app you can download
https://play.google.com/store/apps/details?id=com.thefinestartist.simpleyoutubeplayer
Try this link for youtube video play in my layout : http://www.techrepublic.com/blog/software-engineer/using-googles-youtube-api-in-your-android-apps/
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "add your own key here!";
static private final String VIDEO = "4SK0cUNMnMM";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView)
findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, this);
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! "+error.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player,
boolean wasRestored) {
player.loadVideo(VIDEO);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With