Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'android.graphics.Bitmap com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame()' on a null object reference #82

Open
weizhi9958 opened this issue Aug 13, 2019 · 3 comments

Comments

@weizhi9958
Copy link

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)

@niqdev
Copy link
Owner

niqdev commented Aug 13, 2019

No worries for your english!
Did you try the sample app? Could you C&P the code to replicate the issue?
Thanks

@weizhi9958
Copy link
Author

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());
                        }
                );
    }
}

@savan15
Copy link

savan15 commented Feb 15, 2021

i am facing same issue can you please give me solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants