use of com.byoutline.kickmaterial.views.VideoController in project kickmaterial by byoutline.
the class VideoActivity method setDataFromArgs.
private void setDataFromArgs() {
Intent intent = getIntent();
if (intent == null) {
// NOI18E
LogUtils.LOGE(TAG, "Null intent");
return;
}
Bundle args = intent.getExtras();
if (args == null) {
// NOI18E
LogUtils.LOGE(TAG, "Null args");
return;
}
String videoUrl = args.getString(BUNDLE_VIDEO_URL);
String altVideoUrl = args.getString(BUNDLE_ALT_VIDEO_URL);
String webviewUrl = args.getString(BUNDLE_WEBVIEW_URL);
Uri uri = Uri.parse(videoUrl);
videoView.setMediaController(new VideoController(this, webviewUrl));
videoView.setVideoURI(uri);
videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
boolean tryAltVideo = !TextUtils.isEmpty(altVideoUrl);
@Override
public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
if (tryAltVideo) {
tryAltVideo = false;
videoView.setVideoURI(Uri.parse(altVideoUrl));
videoView.start();
return true;
}
return false;
}
});
videoView.setOnCompletionListener(mediaPlayer -> finish());
videoView.requestFocus();
}
Aggregations