Search in sources :

Example 1 with BrightcoveVideoView

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

the class GoogleCastComponentTest method testCastMediaToRemoteDeviceAndBackFromPaused.

/**
     * Test the successful local to remote playback and then remote to local
     * with the media starting in the PAUSE state on the local device.
     *
     * @throws InterruptedException
     */
public void testCastMediaToRemoteDeviceAndBackFromPaused() throws InterruptedException {
    Log.v(TAG, "testCastMediaToRemoteDeviceAndBackFromPaused");
    final CountDownLatch countDownLatch = new CountDownLatch(2);
    brightcoveVideoView.pause();
    solo.sleep(3000);
    eventEmitter.once(EventType.DID_STOP, new EventListener() {

        @Override
        public void processEvent(Event event) {
            assertFalse("BrightVideoVideo is not playing.", brightcoveVideoView.isPlaying());
            countDownLatch.countDown();
        }
    });
    solo.clickOnActionBarItem(R.id.media_router_menu_item);
    solo.clickInList(0);
    solo.sleep(6000);
    brightcoveVideoView.start();
    assertFalse("BrightcoveVideoView playback did not start.", brightcoveVideoView.isPlaying());
    solo.waitForActivity(VideoCastControllerActivity.class);
    solo.sleep(10000);
    solo.assertCurrentActivity("VideoCastControllerActivity is displayed", VideoCastControllerActivity.class);
    List<View> views = solo.getCurrentViews();
    for (View v : views) {
        if (v instanceof android.support.v7.app.MediaRouteButton) {
            solo.clickOnView(v);
        }
    }
    solo.sleep(3000);
    solo.clickOnButton("Disconnect");
    solo.sleep(3000);
    countDownLatch.countDown();
    assertTrue("Timeout occurred.", countDownLatch.await(3, TimeUnit.MINUTES));
}
Also used : Event(com.brightcove.player.event.Event) EventListener(com.brightcove.player.event.EventListener) CountDownLatch(java.util.concurrent.CountDownLatch) BrightcoveVideoView(com.brightcove.player.view.BrightcoveVideoView) View(android.view.View)

Example 2 with BrightcoveVideoView

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

the class GoogleCastSampleFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Initialize the Cast Companion Library's VideCastManager, so
    // the MiniController can find it when it's inflated.
    String applicationId = getResources().getString(R.string.application_id);
    GoogleCastComponent.initializeVideoCastManager(getActivity(), applicationId, null);
    // Perform the internal wiring to be able to make use of the BrightcovePlayerFragment.
    View view = inflater.inflate(R.layout.basic_cast_fragment, container, false);
    brightcoveVideoView = (BrightcoveVideoView) view.findViewById(R.id.brightcove_video_view);
    eventEmitter = brightcoveVideoView.getEventEmitter();
    super.onCreateView(inflater, container, savedInstanceState);
    // Initialize the android_cast_plugin which requires the application id of your Cast
    // receiver application.
    googleCastComponent = new GoogleCastComponent(eventEmitter, applicationId, getActivity());
    // Initialize the MiniController widget which will allow control of remote media playback.
    miniController = (MiniController) view.findViewById(R.id.miniController1);
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(GoogleCastComponent.CAST_MINICONTROLLER, miniController);
    eventEmitter.emit(GoogleCastEventType.SET_MINI_CONTROLLER, properties);
    // Send the location of the media (url) and its metadata information for remote playback.
    Resources resources = getResources();
    String title = resources.getString(R.string.media_title);
    String studio = resources.getString(R.string.media_studio);
    String url = resources.getString(R.string.media_url);
    String thumbnailUrl = resources.getString(R.string.media_thumbnail);
    String imageUrl = resources.getString(R.string.media_image);
    eventEmitter.emit(GoogleCastEventType.SET_MEDIA_METADATA, buildMetadataProperties("subTitle", title, studio, thumbnailUrl, imageUrl, url));
    brightcoveVideoView.setVideoPath(url);
    return view;
}
Also used : HashMap(java.util.HashMap) Resources(android.content.res.Resources) BrightcoveVideoView(com.brightcove.player.view.BrightcoveVideoView) View(android.view.View) GoogleCastComponent(com.brightcove.cast.GoogleCastComponent)

Example 3 with BrightcoveVideoView

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

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    brightcoveVideoView = (BrightcoveVideoView) 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) BrightcoveVideoView(com.brightcove.player.view.BrightcoveVideoView) View(android.view.View) VideoView(android.widget.VideoView) VMAPComponent(com.brightcove.vmap.VMAPComponent)

Aggregations

View (android.view.View)3 BrightcoveVideoView (com.brightcove.player.view.BrightcoveVideoView)3 Resources (android.content.res.Resources)1 ViewGroup (android.view.ViewGroup)1 VideoView (android.widget.VideoView)1 GoogleCastComponent (com.brightcove.cast.GoogleCastComponent)1 Event (com.brightcove.player.event.Event)1 EventListener (com.brightcove.player.event.EventListener)1 Video (com.brightcove.player.model.Video)1 VMAPComponent (com.brightcove.vmap.VMAPComponent)1 HashMap (java.util.HashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1