Back to project page android-player-samples.
The source code is released under:
Apache License
If you think the Android project android-player-samples listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.brightcove.player.samples.webvtt; // w w w.j a v a 2 s . com import android.media.MediaFormat; import android.net.Uri; import android.os.Bundle; import com.brightcove.player.view.BrightcovePlayer; import com.brightcove.player.view.BrightcoveVideoView; /** * This activity demonstrates how to play a video with closed * captions in multiple languages. */ public class MainActivity extends BrightcovePlayer { @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)); MediaFormat mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "de"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_de), mediaFormat); mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "en"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_en), mediaFormat); mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "es"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_es), mediaFormat); mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "fr"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_fr), mediaFormat); mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "it"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_it), mediaFormat); mediaFormat = MediaFormat.createSubtitleFormat("text/vtt", "nl"); brightcoveVideoView.addSubtitleSource(getResources().openRawResource(R.raw.sintel_trailer_nl), mediaFormat); } }