Search in sources :

Example 6 with Catalog

use of com.brightcove.player.edge.Catalog in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.ima_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    mediaController = new BrightcoveMediaController(brightcoveVideoView);
    brightcoveVideoView.setMediaController(mediaController);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    // Use a procedural abstraction to setup the Google IMA SDK via the plugin and establish
    // a playlist listener object for our sample video: the Potter Puppet show.
    setupGoogleIMA();
    // Remove the HLS_URL field from the catalog request to allow
    // midrolls to work.  Midrolls don't work with HLS due to
    // seeking bugs in the Android OS.
    Map<String, String> options = new HashMap<String, String>();
    List<String> values = new ArrayList<String>(Arrays.asList(VideoFields.DEFAULT_FIELDS));
    values.remove(VideoFields.HLS_URL);
    options.put("video_fields", StringUtil.join(values, ","));
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account_id), getString(R.string.policy_key));
    catalog.findPlaylistByReferenceID("play_2017_4_videos", new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) HashMap(java.util.HashMap) PlaylistListener(com.brightcove.player.edge.PlaylistListener) ArrayList(java.util.ArrayList) Catalog(com.brightcove.player.edge.Catalog) BrightcoveMediaController(com.brightcove.player.mediacontroller.BrightcoveMediaController)

Example 7 with Catalog

use of com.brightcove.player.edge.Catalog in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@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.
    setContentView(R.layout.omniture_activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    setupOmniture();
    // Add a test video to the BrightcoveVideoView.
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account_id), getString(R.string.policy_key));
    catalog.findPlaylistByReferenceID("play_2017_4_videos", new PlaylistListener() {

        public void onPlaylist(Playlist playlist) {
            brightcoveVideoView.addAll(playlist.getVideos());
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) PlaylistListener(com.brightcove.player.edge.PlaylistListener) Catalog(com.brightcove.player.edge.Catalog)

Example 8 with Catalog

use of com.brightcove.player.edge.Catalog in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    brightcoveVideoView = (BrightcoveTextureVideoView) findViewById(R.id.brightcove_video_view);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    super.onCreate(savedInstanceState);
    // Add a test video to the BrightcoveVideoView.
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account_id), getString(R.string.policy_key));
    catalog.findVideoByID("4866305819001", new VideoListener() {

        public void onVideo(Video video) {
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 9 with Catalog

use of com.brightcove.player.edge.Catalog in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // When extending the BrightcovePlayer, we must assign the BrightcoveExoPlayerVideoView before
    // entering the superclass. This allows for some stock video player lifecycle
    // management.
    setContentView(R.layout.ima_activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    // *** This method call is optional *** //
    setupAdMarkers(brightcoveVideoView);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    // Use a procedural abstraction to setup the Google IMA SDK via the plugin.
    setupGoogleIMA();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        public void onVideo(Video video) {
            brightcoveVideoView.add(video);
            // Auto play: the GoogleIMAComponent will postpone
            // playback until the Ad Rules are loaded.
            brightcoveVideoView.start();
        }

        public void onError(String error) {
            Log.e(TAG, error);
        }
    });
}
Also used : Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 10 with Catalog

use of com.brightcove.player.edge.Catalog in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    videoListView = (RecyclerView) findViewById(R.id.video_list_view);
    adapterView = new AdapterView();
    videoListView.setAdapter(adapterView);
    catalog = new Catalog(eventEmitter, ACCOUNT_ID, POLICY_KEY);
    catalog.findPlaylistByReferenceID(PLAYLIST_REF, new PlaylistListener() {

        @Override
        public void onPlaylist(Playlist playlist) {
            adapterView.setVideoList(playlist.getVideos());
        }
    });
}
Also used : Playlist(com.brightcove.player.model.Playlist) PlaylistListener(com.brightcove.player.edge.PlaylistListener) Catalog(com.brightcove.player.edge.Catalog)

Aggregations

Catalog (com.brightcove.player.edge.Catalog)15 VideoListener (com.brightcove.player.edge.VideoListener)11 Video (com.brightcove.player.model.Video)11 EventEmitter (com.brightcove.player.event.EventEmitter)5 PlaylistListener (com.brightcove.player.edge.PlaylistListener)4 Playlist (com.brightcove.player.model.Playlist)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 BrightcoveMediaController (com.brightcove.player.mediacontroller.BrightcoveMediaController)1