Search in sources :

Example 6 with EventEmitter

use of com.brightcove.player.event.EventEmitter in project android-player-samples by BrightcoveOS.

the class MainActivity method registerEventHandlers.

// Private instance methods
/**
 * Procedural abstraction used to setup event handlers for the OnceUX plugin.
 */
private void registerEventHandlers() {
    // Handle the case where the ad data URL has not been supplied to the plugin.
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    eventEmitter.on(OnceUxEventType.NO_AD_DATA_URL, new EventListener() {

        @Override
        public void processEvent(Event event) {
            // Log the event and display a warning message (later)
            Log.e(TAG, event.getType());
        // TODO: throw up a stock Android warning widget.
        }
    });
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Event(com.brightcove.player.event.Event) EventListener(com.brightcove.player.event.EventListener)

Example 7 with EventEmitter

use of com.brightcove.player.event.EventEmitter in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

/**
 * Sets up the view when created.
 */
private void onCreate() {
    connectivityMonitor = ConnectivityMonitor.getInstance(this);
    videoListLabel = ViewUtil.findView(this, R.id.video_list_label);
    videoListView = ViewUtil.findView(this, R.id.video_list_view);
    emptyListMessage = ViewUtil.findView(this, R.id.empty_list_message);
    brightcoveVideoView = ViewUtil.findView(this, R.id.brightcove_video_view);
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    catalog = new OfflineCatalog(this, eventEmitter, ACCOUNT_ID, POLICY_KEY);
    // Configure downloads through the catalog.
    catalog.setMobileDownloadAllowed(true);
    catalog.setMeteredDownloadAllowed(false);
    catalog.setRoamingDownloadAllowed(false);
    videoListAdapter = new VideoListAdapter(catalog, videoListListener);
    // Connect the video list view to the adapter
    RecyclerView videoListView = ViewUtil.findView(this, R.id.video_list_view);
    videoListView.setAdapter(videoListAdapter);
    // Setup an adapter to render the playlist items in the spinner view Adapter that
    // will be used to bind the playlist spinner to the underlying data source.
    ArrayAdapter<PlaylistModel> playlistAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
    playlistAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) OfflineCatalog(com.brightcove.player.edge.OfflineCatalog) RecyclerView(android.support.v7.widget.RecyclerView) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

EventEmitter (com.brightcove.player.event.EventEmitter)7 Catalog (com.brightcove.player.edge.Catalog)5 VideoListener (com.brightcove.player.edge.VideoListener)5 Video (com.brightcove.player.model.Video)5 RecyclerView (android.support.v7.widget.RecyclerView)1 ArrayAdapter (android.widget.ArrayAdapter)1 OfflineCatalog (com.brightcove.player.edge.OfflineCatalog)1 Event (com.brightcove.player.event.Event)1 EventListener (com.brightcove.player.event.EventListener)1