Created
April 12, 2015 06:43
-
-
Save pajatopmr/7e3050c4394787578842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | |
// Have the media controls display for five seconds before being automatically hidden. | |
Map<String, Object> properties = new HashMap<String, Object>(); | |
properties.put(Event.SHOW_HIDE_TIMEOUT, 5000); | |
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