Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show how to customize the Brightcove media controls so that they are always visible.
package com.brightcove.player.demo.ootbp;
/**
* This app illustrates the basic behavior of the Android default media controller. In this case the media controls
* are always shown.
*
* @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);
// 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()));
// Disable the automatic hiding of the media controls.
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(Event.SHOW_HIDE_TIMEOUT, 0);
brightcoveVideoView.getEventEmitter().emit(EventType.SHOW_MEDIA_CONTROLS, properties);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment