I record video on an Android device using JavaCV and play it back using video review. Now you want to show the text during playback, which is entered after the video is recorded. This text should be displayed in all video players during video playback.
I clicked on the link How do I add text to the video? too, which is also expected here.
This is the method that is called after the video is recorded.
private void playRecordedVideo(Uri videoUri, boolean playVideoInLoop)
{
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
videoView.setLayoutParams(layoutParams);
videoView.setVisibility(View.VISIBLE);
videoView.setVideoURI(videoUri);
if(playVideoInLoop)
{
MediaController mediaController = new MediaController(MainActivity.this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setOnPreparedListener (new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
}
else
{
videoView.setMediaController(null);
}
videoView.start();
btnStart.setText(getString(R.string.txt_finish));
}
source
share