IPCapture code example crashes

edited July 2017 in Android Mode

I am trying to use the example code from IPCapture, but it crashes right after start. I think I had it running once, but now I am not so sure. I do have the permissions set as required in the code. The app crashes Nexus 5 with latest LineageOS. The emulator also crashes. The code works fine in Java mode.

Tagged:

Answers

  • What Android Mode version and Processing version are you using? Also what Android API?

    It will b helpful if you can copy and paste the error message below.

    Kf

  • Processing 3.3.4, Android Mode - last official release (0254?), Android API 25. On Android there is no error message other than „app stopped working” (or something like that, I have the Polish version), in the console there is only: at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:761)

    In the emulator the app also stops, but there is nothing in the console.

  • I did some debugging and it seems the problem is related to the Internet connection or the Internet permission.

    If I run the app on the device without the permission, it runs fine. If I run it again just after turning the permission on, it runs fine. I can even restart the phone and the app responds properly.

    The problem starts when I compile it again. Then it crashes and cannot be run at all. Maybe the permission is not reapplied correctly at second and further compilations?

  • Strange -- are you able to strip a copy of your code down to a minimal example that exhibits this second-compile crash bug? If so perhaps you should file a bug report.

  • edited July 2017

    Only now I have managed to experiment with this. This code:

    import ipcapture.*;
    
    IPCapture cam;
    
    void setup() {
      cam = new IPCapture(this, "http://195.235.198.107:3346/axis-cgi/mjpg/video.cgi?resolution=320x240", "", "");
      cam.start();
    
    }
    
    void draw() {
      if (cam.isAvailable()) {
        cam.read();
      }
    }
    

    crashes the app. Commenting out cam.read(); makes it run again. Turning off Internet permissions makes it run again, but then cam.read(); is not executed as cam is not available. This command works only the first time the permissions are set.

  • Thanks! Please edit that post and format your code:

    https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text

    If you have looked at the docs and there is no explanation for this behavior, it looks like a minimal example that could be a very helpful bug report:

    https://github.com/singintime/ipcapture/issues

  • Thanks so much for reporting https://github.com/singintime/ipcapture/issues/4 -- I hope the library maintainer has a suggested solution....

Sign In or Register to comment.