Search in sources :

Example 1 with BrightcoveCaptionFormat

use of com.brightcove.player.captioning.BrightcoveCaptionFormat 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);
    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);
    brightcoveVideoView.getEventEmitter().once(EventType.CAPTIONS_LANGUAGES, new EventListener() {

        @Override
        public void processEvent(Event event) {
            brightcoveVideoView.setClosedCaptioningEnabled(true);
            brightcoveVideoView.setSubtitleLocale("en");
        }
    });
}
Also used : BrightcoveCaptionFormat(com.brightcove.player.captioning.BrightcoveCaptionFormat) Event(com.brightcove.player.event.Event) EventListener(com.brightcove.player.event.EventListener)

Aggregations

BrightcoveCaptionFormat (com.brightcove.player.captioning.BrightcoveCaptionFormat)1 Event (com.brightcove.player.event.Event)1 EventListener (com.brightcove.player.event.EventListener)1