Search in sources :

Example 21 with Video

use of com.brightcove.player.model.Video 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 22 with Video

use of com.brightcove.player.model.Video in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Establish the video object and use it's event emitter to get important notifications
    // and to control logging and media.
    setContentView(R.layout.basic_widevine);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.bc_video_view);
    super.onCreate(savedInstanceState);
    // Set up the DRM licensing server to be handled by Brightcove with arbitrary device and
    // portal identifiers to fulfill the Widevine API contract.  These arguments will
    // suffice to create a Widevine plugin instance.
    String drmServerUri = "https://wvlic.brightcove.com/widevine/cypherpc/cgi-bin/GetEMMs.cgi";
    String deviceId = "device1234";
    String portalId = "brightcove";
    new WidevinePlugin(this, brightcoveVideoView, drmServerUri, deviceId, portalId);
    // Create the catalog object which will start and play the video.
    Catalog catalog = new Catalog("FqicLlYykdimMML7pj65Gi8IHl8EVReWMJh6rLDcTjTMqdb5ay_xFA..");
    catalog.findVideoByID("2142114984001", new VideoListener() {

        @Override
        public void onError(String error) {
            Log.e(TAG, error);
        }

        @Override
        public void onVideo(Video video) {
            brightcoveVideoView.add(video);
            brightcoveVideoView.start();
        }
    });
}
Also used : Video(com.brightcove.player.model.Video) WidevinePlugin(com.brightcove.drm.widevine.WidevinePlugin) VideoListener(com.brightcove.player.media.VideoListener) Catalog(com.brightcove.player.media.Catalog)

Example 23 with Video

use of com.brightcove.player.model.Video 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.activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    // Add a test video to the BrightcoveVideoView.
    Catalog catalog = new Catalog("ZUPNyrUqRdcAtjytsjcJplyUc9ed8b0cD_eWIe36jXqNWKzIcE6i8A..");
    catalog.findVideoByID("3637288623001", new VideoListener() {

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

        @Override
        public void onError(String s) {
            Log.e(TAG, "Could not load video: " + s);
        }
    });
}
Also used : Video(com.brightcove.player.model.Video) VideoListener(com.brightcove.player.media.VideoListener) Catalog(com.brightcove.player.media.Catalog)

Example 24 with Video

use of com.brightcove.player.model.Video 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)

Example 25 with Video

use of com.brightcove.player.model.Video 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);
    final BrightcoveMediaController mediaController = new BrightcoveMediaController(brightcoveVideoView);
    // Add "Ad Markers" where the Ads Manager says ads will appear.
    mediaController.addListener(GoogleIMAEventType.ADS_MANAGER_LOADED, new EventListener() {

        @Override
        public void processEvent(Event event) {
            AdsManager manager = (AdsManager) event.properties.get("adsManager");
            List<Float> cuepoints = manager.getAdCuePoints();
            for (int i = 0; i < cuepoints.size(); i++) {
                Float cuepoint = cuepoints.get(i);
                mediaController.getBrightcoveSeekBar().addMarker((int) (cuepoint * DateUtils.SECOND_IN_MILLIS));
            }
        }
    });
    brightcoveVideoView.setMediaController(mediaController);
    super.onCreate(savedInstanceState);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    // Use a procedural abstraction to setup the Google IMA SDK via the plugin.
    setupGoogleIMA();
    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("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
    catalog.findVideoByReferenceID("shark", 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 : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Catalog(com.brightcove.player.media.Catalog) BrightcoveMediaController(com.brightcove.player.mediacontroller.BrightcoveMediaController) AdsManager(com.google.ads.interactivemedia.v3.api.AdsManager) Video(com.brightcove.player.model.Video) Event(com.brightcove.player.event.Event) ArrayList(java.util.ArrayList) List(java.util.List) EventListener(com.brightcove.player.event.EventListener) VideoListener(com.brightcove.player.media.VideoListener)

Aggregations

Video (com.brightcove.player.model.Video)26 Catalog (com.brightcove.player.edge.Catalog)8 VideoListener (com.brightcove.player.edge.VideoListener)8 Catalog (com.brightcove.player.media.Catalog)7 VideoListener (com.brightcove.player.media.VideoListener)7 ViewGroup (android.view.ViewGroup)6 Event (com.brightcove.player.event.Event)6 EventListener (com.brightcove.player.event.EventListener)6 List (java.util.List)6 EventEmitter (com.brightcove.player.event.EventEmitter)5 FreeWheelController (com.brightcove.freewheel.controller.FreeWheelController)4 IAdContext (tv.freewheel.ad.interfaces.IAdContext)4 IConstants (tv.freewheel.ad.interfaces.IConstants)4 ISlot (tv.freewheel.ad.interfaces.ISlot)4 View (android.view.View)3 VideoView (android.widget.VideoView)2 VMAPComponent (com.brightcove.vmap.VMAPComponent)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 WidevinePlugin (com.brightcove.drm.widevine.WidevinePlugin)1