'android.graphics.Bitmap com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame()' on a null object reference
My English is not good, use google translation for help.
The following error occurs when I repeat open and stopPlayback.
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame()' on a null object reference at com.github.niqdev.mjpeg.MjpegViewDefault$MjpegViewThread.run(MjpegViewDefault.java:139)
No worries for your english! Did you try the sample app? Could you C&P the code to replicate the issue? Thanks
I have an open and close button on the page. The close button will call stopPlayback and clearStream. This error occurs when I continuously trigger close and open for a while. The code looks like this.
@OnClick(R.id.imgClose)
public void onClose() {
mMjpegView.stopPlayback();
mMjpegView.clearStream();
}
@OnClick(R.id.imgOpen)
public void onOpen() {
loadIpCam();
}
private void loadIpCam() {
if (mJpegDTO != null) {
mLoading.show();
Mjpeg.newInstance()
.credential(mJpegDTO.getUser(), mJpegDTO.getPass())
.open(mJpegDTO.getUrl())
.subscribe(
inputStream -> {
mLoading.hide();
mMjpegView.setSource(inputStream);
mMjpegView.setDisplayMode(DisplayMode.BEST_FIT);
},
throwable -> {
mLoading.hide();
Logger.d("error : " + throwable.getMessage());
}
);
}
}
i am facing same issue can you please give me solution