使用JavaCV在Android设备中录制视频并使用视频播放进行播放。现在想要在播放时在视频上显示文本,这是在录制视频后输入的。播放视频时必须在所有视频播放器中看到此文本。
我已经通过链接How to add text on video recording?,这也是预期的
这是录制视频后调用的方法。
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));
}