First off thanks for this excellent library! I'm excited to add MJPG support to my app. I was able to test this library out and it worked great - but I had a few questions too.. for reference, I used the IP Webcam Android app to stream video from another phone.
1) when I stopped the webcam server (IP Webcam) - I noticed a lot of failures in the log about the connection which didn't stop or slow down in any way that I can see. Also, I see a NPE in the logs as well. Is there a way to slow down the reconnection attempts?
2) since MjpegView extends View, can/should it listen for view events (such as onViewDetachedFromWindow) to automatically pause/stop the video streaming? I can do this in my app too but it seems like that logic would be better served here to stop the feed. In my case I'm using 1+ MjpegView's in a recyclerView so I just want to make sure there's no extra bandwidth being used when the view goes away.
3) I'm still learning about MJPG but is there any options when it comes to how fast the frames are updated? Or, is that determined by the server? I was just wondering if I could give my users control over how frequently the frames are updated (fewer updates would mean less 'live' video but possibly better performance/bandwidth)
thanks!
joe
here's what I see in the log when the server was stopped:
10-30 10:22:13.307 com.jpage4500.hubitat 1610 2701 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:13.308 com.jpage4500.hubitat 1610 2701 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.338 com.jpage4500.hubitat 1610 2329 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.339 com.jpage4500.hubitat 1610 2329 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.342 com.jpage4500.hubitat 1610 2052 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.342 com.jpage4500.hubitat 1610 2052 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.342 com.jpage4500.hubitat 1610 2364 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.342 com.jpage4500.hubitat 1610 2364 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.340 com.jpage4500.hubitat 1610 2050 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.343 com.jpage4500.hubitat 1610 2050 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.344 com.jpage4500.hubitat 1610 2361 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.344 com.jpage4500.hubitat 1610 2361 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.345 com.jpage4500.hubitat 1610 2051 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.345 com.jpage4500.hubitat 1610 2051 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.346 com.jpage4500.hubitat 1610 2371 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.347 com.jpage4500.hubitat 1610 2371 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.347 com.jpage4500.hubitat 1610 2035 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.347 com.jpage4500.hubitat 1610 2035 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.348 com.jpage4500.hubitat 1610 2319 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.348 com.jpage4500.hubitat 1610 2065 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.348 com.jpage4500.hubitat 1610 2065 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.348 com.jpage4500.hubitat 1610 2319 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.350 com.jpage4500.hubitat 1610 2718 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.350 com.jpage4500.hubitat 1610 2718 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
10-30 10:22:14.351 com.jpage4500.hubitat 1610 2535 E MjpegView Failed to connect to /192.168.0.169:8080
10-30 10:22:14.351 com.jpage4500.hubitat 1610 2535 E MjpegView Attempt to invoke virtual method 'void java.io.BufferedInputStream.close()' on a null object reference
By default I believe it waits 5 seconds before reattempt to connect to server. However, it operates independently with other instance, so if you have multiple viewers, they will all reattempt every 5 seconds. You can set number of second to wait by using setMsecWaitAfterReadImageError(msec)
Yes, that can be done, but I'm not sure if I should give that control to developers. They can extent MjpegView and override those methods.
I believe that can be done. Usually Mjpeg stream fps will determine by a server, but at least a client can purposely disconnect and reconnection after sometime to reduce fps. I will try working on this method. I don't know if there is Mjpeg stream standard way to tell server to set specific fps per client.
Hi,
First off thanks for this excellent library! I'm excited to add MJPG support to my app. I was able to test this library out and it worked great - but I had a few questions too.. for reference, I used the IP Webcam Android app to stream video from another phone.
1) when I stopped the webcam server (IP Webcam) - I noticed a lot of failures in the log about the connection which didn't stop or slow down in any way that I can see. Also, I see a NPE in the logs as well. Is there a way to slow down the reconnection attempts? 2) since MjpegView extends View, can/should it listen for view events (such as onViewDetachedFromWindow) to automatically pause/stop the video streaming? I can do this in my app too but it seems like that logic would be better served here to stop the feed. In my case I'm using 1+ MjpegView's in a recyclerView so I just want to make sure there's no extra bandwidth being used when the view goes away. 3) I'm still learning about MJPG but is there any options when it comes to how fast the frames are updated? Or, is that determined by the server? I was just wondering if I could give my users control over how frequently the frames are updated (fewer updates would mean less 'live' video but possibly better performance/bandwidth)
thanks! joe
here's what I see in the log when the server was stopped: