I'm trying to replace an ExoPlayer2 view with an ImageView if the video media file isn't available.
if(stepVideo != null) {
mPlaceHolderIv.setVisibility(View.GONE);
exoPlayerView.setVisibility(View.VISIBLE);
initializePlayer(Uri.parse(stepVideo));
//initialize MediaSession
initializeMediaSession();
} else if(stepThumbUrl != null) {
mPlaceHolderIv.setVisibility(View.GONE);
exoPlayerView.setVisibility(View.VISIBLE);
initializePlayer(Uri.parse(stepThumbUrl));
//initialize MediaSession
initializeMediaSession();
} else {
exoPlayerView.setVisibility(View.GONE);
releasePlayer();
mPlaceHolderIv.setVisibility(View.VISIBLE);
Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(mPlaceHolderIv);
}
I know the else is being called because the placeholder image is being shown; however, the playback controls are still visible. I've tried all the answers here and still the control view (play, pause, etc.) are shown. Any ideas?
Note: I've overwritten the custom controls with a file labled as exo_playback_control_view.xml
.
Edit: Fixed the problem for showing the controls when view was GONE, but new question is why does the xml for SimpleExoPlayerView need to have a app:use_controller="false"
and then set it to true in java when initialized and false again when released? Why doesn't the control view disappear with the rest of the SimpleExoPlayerView?