Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pajatopmr/e277cddf711a7b531116 to your computer and use it in GitHub Desktop.
Save pajatopmr/e277cddf711a7b531116 to your computer and use it in GitHub Desktop.
Shows how to hide a button, the captions button.
/**
* This app illustrates the basic behavior of the Android default media controller.
*
* @author Paul Michael Reilly
*/
public class MainActivity extends BrightcovePlayer {
// Private class constants
private final String TAG = this.getClass().getSimpleName();
@Override protected void onCreate(Bundle savedInstanceState) {
// When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before
// entering the superclass. This allows for some stock video player lifecycle
// management. Establish the video object and use it's event emitter to get important
// notifications and to control logging.
setContentView(R.layout.default_activity_main);
brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
brightcoveVideoView.setMediaController(new BrightcoveMediaController(brightcoveVideoView));
super.onCreate(savedInstanceState);
// Hide the captions button.
View captions = this.findViewById(R.id.captions);
captions.setVisibility(View.GONE);
// Add a test video from the res/raw directory to the BrightcoveVideoView.
String PACKAGE_NAME = getApplicationContext().getPackageName();
Uri video = Uri.parse("android.resource://" + PACKAGE_NAME + "/" + R.raw.shark);
brightcoveVideoView.add(Video.createVideo(video.toString()));
}
}
@amatigianc
Copy link

Hi, it's Giancarlo here. I tried to include the statements for hiding the 'caption buttons' as you did in this example but, at first they don't show up, but as soon as the video starts playing back, the button pops up.

@amatigianc
Copy link

Hi, the only way to make the caption button permanetly gone, was to do this:

em.on(EventType.ANY, new EventListener() {
@OverRide
public void processEvent(Event event) {
brightcoveVideoView.getBrightcoveMediaController().getBrightcoveControlBar().findViewById(R.id.captions).setVisibility(View.GONE);
}
});

is it the right way of doing it?

@rameshandroid
Copy link

I have tried for endtime, it's not working
brightcoveVideoView.getBrightcoveMediaController().getBrightcoveControlBar().findViewById(R.id.end_time).setVisibility(View.GONE);

Thanks
Ramesh

@gorjanz
Copy link

gorjanz commented Jun 28, 2016

Where do you get the resource id for "captions" (the generated one)?
In my project, there is no reference anywhere in the project towards any other UI element except the main brightcoveVideoView, referenced in the activity layout by its name: com.brightcove.player.view.BrightcoveVideoView

So anytime I try to get the resource id, in order to get the view, I get null.

View fullScreenButton = this.findViewById(com.brightcove.player.R.id.exit_full_screen); fullScreenButton.setVisibility(View.INVISIBLE);
=> results in NullPointerException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment