Closed TechyM closed 5 years ago
the playerManager.setMediaControllerGenerator
should be called before view init,for example in onCreate
before setContentView
thank you so much !! that was great help!
what if I want to change mediacontroller to DefaultMediaController after completion of video.
@Override public void onCompletion(GiraffePlayer giraffePlayer) { super.onCompletion(giraffePlayer); Log.d("MyApp","Video Completed"); Remember.putBoolean(videoCompletedOnce,true); PlayerManager.getInstance().setMediaControllerGenerator(new PlayerManager.MediaControllerGenerator() { @Override public MediaController create(Context context, VideoInfo videoInfo) { Log.d("MyApp","Defaultmedia controller generator"); return new DefaultMediaController(context); } }); }
the media controller is bind in view init.So you can't change it at runtime.In your case the setup video can play in a independent activity and in MediaControllerGenerator create MediaController by video info:
public MediaController create(Context context, VideoInfo videoInfo) {
if("your setupvideo url".equals(videoInfo.getUri())){
return new SimpleMedialController(context);
}
return new DefaultMediaController(context);
}
here when i first time run my app. "setupvideo" is logged first, when i press back button and then run app again only then this "media controller generator" is logged...
i want to set my customized mediacontroller before starting the video.