I was testing the MJPEG decoder example from here: https://www.b4x.com/android/forum/threads/b4x-class-mjpeg-decoder.73702/post-468057 on an Android tablet whose SDK version shows up as 22. The example from that link was ported to B4A 8.50. The video showed up ok when I tested on some random mjpg camera. However there was an odd symptom a little while after exiting the application:
I added an extra line of code to log each time astream_newdata sub was entered and it seems that the activity pause event did not trigger for quite a while after I actually exited the application (at least according to data appearing in log) and even after that point something seems to be going on.
I then found this implementation using OKhttp instead of raw sockets: https://www.b4x.com/android/forum/threads/consuming-http-streams.111542/post-695615
Again ported to B4A 8.50. Same kind of symptom but obviously different target, eg.:
Another interesting thing I noted is that the image update rate in the B4A implementation was quite poor, e.g sometimes a few seconds before a new frame appeared (the video camera handily had a time label), whereas in the B4J implementation the streaming looked smooth. Also no such after exit queue symptoms for the b4J implementations. Suppose frame slowness aspect could also be some function of the Android tablet I was testing with, but I do know that using a webview on the tablet it does stream ok. Problem with webview I gather is that not all support mjpeg decoding, also I'm finding it difficult to consistently control the image scaling for webview (https://www.b4x.com/android/forum/threads/webview-retain-zoom-setting.161923/post-993118)
The ported version of the OKhttp version is attached.
B4X:
** Activity (main) Pause, UserClosed = true **
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
...
...
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
I added an extra line of code to log each time astream_newdata sub was entered and it seems that the activity pause event did not trigger for quite a while after I actually exited the application (at least according to data appearing in log) and even after that point something seems to be going on.
I then found this implementation using OKhttp instead of raw sockets: https://www.b4x.com/android/forum/threads/consuming-http-streams.111542/post-695615
Again ported to B4A 8.50. Same kind of symptom but obviously different target, eg.:
B4X:
sending message to waiting queue (data_available)
Ignoring event (too many queued events: data_available)
Another interesting thing I noted is that the image update rate in the B4A implementation was quite poor, e.g sometimes a few seconds before a new frame appeared (the video camera handily had a time label), whereas in the B4J implementation the streaming looked smooth. Also no such after exit queue symptoms for the b4J implementations. Suppose frame slowness aspect could also be some function of the Android tablet I was testing with, but I do know that using a webview on the tablet it does stream ok. Problem with webview I gather is that not all support mjpeg decoding, also I'm finding it difficult to consistently control the image scaling for webview (https://www.b4x.com/android/forum/threads/webview-retain-zoom-setting.161923/post-993118)
The ported version of the OKhttp version is attached.