public void start() { if (streamReader != null && streamReader.isAlive()) { System.out.println("Camera already started"); return; } streamReader = new Thread(this, "HTTP Stream reader"); keepAlive = true; streamReader.start(); }
public void stop() { if (streamReader == null || !streamReader.isAlive()) { System.out.println("Camera already stopped"); return; } keepAlive = false; try { streamReader.join(); } catch (InterruptedException e) { System.err.println(e.getMessage()); } }
public boolean isAlive() { return streamReader.isAlive(); }