B4J Question B4J MJPEG DECODER

micro

Well-Known Member
Licensed User
From B4A forum
https://www.b4x.com/android/forum/threads/mjpeg-decoder-example.101957/#content

You will notice two things if you enter this URL in the browser:

1. It redirects to https.
2. The SSL certificate is not recognized.

You need to do two things to get it working:

1. Change the port to 443. This is the "https" port.
2. Create a SSL socket that accepts all certificates: https://www.b4x.com/android/forum/threads/b4x-trust-all-ssl-socket.101952/#content
Replace sock.Initialize with:
B4X:
sock = CreateTrustAllSSLSocket("sock")
Hi Erel
i have the same problem and also with your suggestion not work

If i put into browser or with vlc this link, all work well:
With vlc:
B4X:
http://root:admin@192.168.1.24/axis-cgi/jpg/image.cgi?resolution=1024x768
Into browser also without user and password :
B4X:
http://192.168.1.24/axis-cgi/jpg/image.cgi?resolution=1024x768
I also used the advice of tchart setting the user and password in Base64 but the problem remains

This is the debug answer (with your and tchart suggestion)

B4X:
Waiting for debugger to connect...
Program started.
HTTP/1.1 401 Unauthorized
Date: Mon, 16 Oct 2023 22:07:43 GMT
Server: Apache/2.4.27 (Unix) OpenSSL/1.0.2k
WWW-Authenticate: Digest realm="AXIS_ACCC8EC78757", nonce="78yootwHBgA=3b997f87ad98f387e14bdfb97106b92f10d97478", algorithm=MD5, qop="auth"
Content-Length: 381
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>
Terminated
....always unauthorized.

what I ask is whyI have to use the safe mode if in the browser it also works with http?

is there a simple way to use HTTJOB and download mode? (so much is just a screenshot i need)

Thank's
 

DonManfred

Expert
Licensed User
WWW-Authenticate: Digest
You need to authenticate the request using a Digest Authorisation.
Search the forum; i´m pretty sure i did read something about in the past.

Do you have a link to the camera documentation? It may reveal more infos about the Authentification.
 
Last edited:

Erel

Administrator
Staff member
Licensed User
i have the same problem and also with your suggestion not work
That suggestion is not related to this error. As DonManfred wrote your camera expects the client to support the digest authentication method. This is not implemented in MJPEG decoder class which acts as a primitive http client.

You can read about this method here: https://en.wikipedia.org/wiki/Digest_access_authentication
It shouldn't be too difficult to implement it.
 
Top