Open abhihasabe opened 3 years ago
I have created CustomActions Button for forwarding and Backword video, but how to do this fun.
Please check given code,
private void initYouTubePlayerView() { initPlayerMenu();
getLifecycle().addObserver(youTubePlayerView); youTubePlayerView.addYouTubePlayerListener(new AbstractYouTubePlayerListener() { @Override public void onReady(@NonNull YouTubePlayer youTubePlayer) { YouTubePlayerUtils.loadOrCueVideo( youTubePlayer, getLifecycle(), videoIds, 0f ); addCustomActionsToPlayer(); //addFullScreenListenerToPlayer(); //setPlayNextVideoButtonClickListener(youTubePlayer); } }); }
private void addCustomActionsToPlayer() { youTubePlayerView.getPlayerUiController().showCustomAction1(true); youTubePlayerView.getPlayerUiController().showCustomAction2(true); Drawable customAction1Icon = ContextCompat.getDrawable(this, R.drawable.ic_fast_rewind_white_24dp); Drawable customAction2Icon = ContextCompat.getDrawable(this, R.drawable.ic_fast_forward_white_24dp); assert customAction1Icon != null; assert customAction2Icon != null;
youTubePlayerView.getPlayerUiController().setCustomAction1(customAction1Icon, view -> Toast.makeText(this, "custom action1 clicked", Toast.LENGTH_SHORT).show()); youTubePlayerView.getPlayerUiController().setCustomAction2(customAction2Icon, view -> Toast.makeText(this, "custom action1 clicked", Toast.LENGTH_SHORT).show()); }
chalega nhi yaar
I have created CustomActions Button for forwarding and Backword video, but how to do this fun.
Please check given code,
private void initYouTubePlayerView() { initPlayerMenu();
private void addCustomActionsToPlayer() { youTubePlayerView.getPlayerUiController().showCustomAction1(true); youTubePlayerView.getPlayerUiController().showCustomAction2(true); Drawable customAction1Icon = ContextCompat.getDrawable(this, R.drawable.ic_fast_rewind_white_24dp); Drawable customAction2Icon = ContextCompat.getDrawable(this, R.drawable.ic_fast_forward_white_24dp); assert customAction1Icon != null; assert customAction2Icon != null;