
Android player reload
Sometimes, if the internet is bad, the player will show error, is there any way to reload it, so I dont need to quit and enter again to reload the video?
Is there any way to auto reload if detecting error?
Sometimes, if the internet is bad, the player will show error, is there any way to reload it, so I dont need to quit and enter again to reload the video?
Is there any way to auto reload if detecting error?
Hi,
Is this for Android Web or Android SDK?
Thanks for replying, its for android sdk, ideally, I wish touch the error icon to reload if it shows error.
@Override
public void onError(String message) {
if(message.equals(“YOUR_ERROR_MESSAGE”)){
PlayerConfig config = mPlayerView.getConfig();
// Make any modifications you need to the config then setup
mPlayerView.setup(config);
}
}
Thanks George, if I am using jw player in a fragment, how do I set the listener?
Call getPlayer() on the Fragment then use .addOnErrorListener() to the JWPlayerView
How do I reload my playerView?
I used the following code to initialize
PlayerConfig playerConfig = new PlayerConfig.Builder()
.file(playUrl)
.skinUrl("file:///android_assets/vapor.css")
.skinName("vapor")
.autostart(true)
.build();
mPlayerView = new JWPlayerView(getActivity(), playerConfig);
FrameLayout jwPlayerViewContainer = (FrameLayout) getActivity().findViewById(R.id.fragmentContainer);
// Add fragment to layout
jwPlayerViewContainer.addView(mPlayerView);
I’m a bit confused, if you have the fragment, it already contains a player and all you should do is use getPlayer().setup(). Not sure what you’re trying to do in the code above.