Search in sources :

Example 1 with BrightcoveExoPlayerVideoView

use of com.brightcove.player.view.BrightcoveExoPlayerVideoView 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 brightcoveVideoView before
    // entering the superclass.  This allows for some stock video player lifecycle
    // management.
    setContentView(R.layout.onceux_activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    // Setup the event handlers for the OnceUX plugin, set the companion ad container,
    // register the VMAP data URL inside the plugin and start the video.  The plugin will
    // detect that the video has been started and pause it until the ad data is ready or an
    // error condition is detected.  On either event the plugin will continue playing the
    // video.
    registerEventHandlers();
    plugin = new OnceUxComponent(this, brightcoveVideoView);
    View view = findViewById(R.id.ad_frame);
    if (view != null && view instanceof ViewGroup) {
        plugin.addCompanionContainer((ViewGroup) view);
    }
    plugin.processVideo(onceUxAdDataUrl);
}
Also used : ViewGroup(android.view.ViewGroup) OnceUxComponent(com.brightcove.onceux.OnceUxComponent) BrightcoveExoPlayerVideoView(com.brightcove.player.view.BrightcoveExoPlayerVideoView) View(android.view.View)

Example 2 with BrightcoveExoPlayerVideoView

use of com.brightcove.player.view.BrightcoveExoPlayerVideoView in project android-player-samples by BrightcoveOS.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    brightcoveVideoView = (BrightcoveExoPlayerVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);
    vmapComponent = new VMAPComponent(brightcoveVideoView);
    View view = findViewById(R.id.ad_frame);
    if ((view != null) && (view instanceof ViewGroup)) {
        vmapComponent.addCompanionContainer((ViewGroup) view);
    } else {
        Log.e(TAG, "Companion container must be an instance of a ViewGroup");
    }
    Video video = Video.createVideo("http://media.w3.org/2010/05/sintel/trailer.mp4", DeliveryType.MP4);
    video.getProperties().put(VMAPComponent.VMAP_URL, "http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=");
    brightcoveVideoView.add(video);
    brightcoveVideoView.start();
}
Also used : ViewGroup(android.view.ViewGroup) Video(com.brightcove.player.model.Video) BrightcoveExoPlayerVideoView(com.brightcove.player.view.BrightcoveExoPlayerVideoView) View(android.view.View) VideoView(android.widget.VideoView) VMAPComponent(com.brightcove.vmap.VMAPComponent)

Aggregations

View (android.view.View)2 ViewGroup (android.view.ViewGroup)2 BrightcoveExoPlayerVideoView (com.brightcove.player.view.BrightcoveExoPlayerVideoView)2 VideoView (android.widget.VideoView)1 OnceUxComponent (com.brightcove.onceux.OnceUxComponent)1 Video (com.brightcove.player.model.Video)1 VMAPComponent (com.brightcove.vmap.VMAPComponent)1