Search in sources :

Example 1 with EventEmitter

use of com.brightcove.player.event.EventEmitter 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.activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerTextureVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    // Get the event emitter from the SDK and create a catalog request to fetch a video from the
    // Brightcove Edge service, given a video id, an account id and a policy key.
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        // Add the video found to the queue with add().
        // Start playback of the video with start().
        @Override
        public void onVideo(Video video) {
            Log.v(TAG, "onVideo: video = " + video);
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 2 with EventEmitter

use of com.brightcove.player.event.EventEmitter 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.default_activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        // Add the video found to the queue with add().
        // Start playback of the video with start().
        @Override
        public void onVideo(Video video) {
            Log.v(TAG, "onVideo: video = " + video);
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 3 with EventEmitter

use of com.brightcove.player.event.EventEmitter 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.activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    // Get the event emitter from the SDK and create a catalog request to fetch a video from the
    // Brightcove Edge service, given a video id, an account id and a policy key.
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        // Add the video found to the queue with add().
        // Start playback of the video with start().
        @Override
        public void onVideo(Video video) {
            Log.v(TAG, "onVideo: video = " + video);
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 4 with EventEmitter

use of com.brightcove.player.event.EventEmitter 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.default_activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    initMediaController(brightcoveVideoView);
    super.onCreate(savedInstanceState);
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        // Add the video found to the queue with add().
        // Start playback of the video with start().
        @Override
        public void onVideo(Video video) {
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

Example 5 with EventEmitter

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

the class MainActivity method onCreate.

@Override
@SuppressWarnings("ResourceType")
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.activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter();
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy));
    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() {

        @Override
        public void onVideo(Video video) {
            Video.ProjectionFormat projectionFormat = video.getProjectionFormat();
            if (projectionFormat == Video.ProjectionFormat.EQUIRECTANGULAR) {
                Log.i(TAG, "This is a 360 video");
            }
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
// You can also create a 360 video by setting the the projection field on creation as shown below:
// Video video = Video.createVideo(VIDEO_URL, VIDEO_TYPE, PROJECTION_FORMAT);
}
Also used : EventEmitter(com.brightcove.player.event.EventEmitter) Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.edge.VideoListener) Catalog(com.brightcove.player.edge.Catalog)

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