@Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view);
    super.onCreate(savedInstanceState);

    brightcoveVideoView.setVideoURI(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer));

    BrightcoveCaptionFormat brightcoveCaptionFormat =
        BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "de");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_de),
        brightcoveCaptionFormat);
    brightcoveCaptionFormat = BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "en");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_en),
        brightcoveCaptionFormat);
    brightcoveCaptionFormat = BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "es");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_es),
        brightcoveCaptionFormat);
    brightcoveCaptionFormat = BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "fr");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_fr),
        brightcoveCaptionFormat);
    brightcoveCaptionFormat = BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "it");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_it),
        brightcoveCaptionFormat);
    brightcoveCaptionFormat = BrightcoveCaptionFormat.createCaptionFormat("text/vtt", "nl");
    brightcoveVideoView.addSubtitleSource(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sintel_trailer_nl),
        brightcoveCaptionFormat);
  }
  @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);
  }