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

Unable to Play RTSP stream error thrown E/FFmpegMediaPlayer: Error (0,0) #164

Open
engrtaipu opened this issue Feb 6, 2023 · 0 comments

Comments

@engrtaipu
Copy link

Hi, thanks for the hardworking, but I am unable to play an RTSP stream, directly from an IP camera. here's the code.

`private final FFmpegMediaPlayer.OnPreparedListener mOnPreparedListener = FFmpegMediaPlayer::start;

private final FFmpegMediaPlayer.OnErrorListener mOnErrorListener = (mp, what, extra) -> {
    Log.d(MainScreenActivity.class.getName(), "Error: " + what);
    return true;
};
surfaceHolder.addCallback(new SurfaceHolder.Callback() {
        @Override
        public void surfaceCreated(@NonNull SurfaceHolder surfaceHolder) {
            surface = surfaceHolder.getSurface();
        }

        @Override
        public void surfaceChanged(@NonNull SurfaceHolder surfaceHolder, int i, int i1, int i2) {

        }

        @Override
        public void surfaceDestroyed(@NonNull SurfaceHolder surfaceHolder) {

        }
    });

    fFmpegMediaPlayer = new FFmpegMediaPlayer();
    fFmpegMediaPlayer.setOnPreparedListener(mOnPreparedListener);
    fFmpegMediaPlayer.setOnErrorListener(mOnErrorListener);
    fFmpegMediaPlayer.stop();

try {
        fFmpegMediaPlayer.reset();

        fFmpegMediaPlayer.setDataSource(rtspUrl);
        if (surface != null) {
            fFmpegMediaPlayer.setSurface(surface);
        }
        fFmpegMediaPlayer.prepareAsync();
    } catch (IOException ex) {
        ex.printStackTrace();
    }`
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

1 participant