perthcpe23 / android-mjpeg-view

Custom View to display MJPEG
MIT License
64 stars 20 forks source link

Credentials in URL #12

Open zaptoopa opened 2 years ago

zaptoopa commented 2 years ago

Hi perthcpe23,

im not able to display the mjpeg stream when the URL looks like this:

viewer.setUrl("http://$username:$password@$ip:$port/?action=stream");

Without the credentials ($username:$password@) in the URL it works properly.

Do you have a suggestion to solve the problem?

punyapat-s commented 2 years ago

It is possible that you have to escape url string first.

zaptoopa commented 2 years ago

thanks for the quick reply, i actually used the string in plain text without variables, but there was no success here either viewer.setUrl("http://myuser:mypass@10.10.10.101:8080/?action=stream");

or with encoding the character: viewer.setUrl("http%3A%2F%2Fmyuser%3Amypass%4010.10.10.101%3A8080%2F%3Faction%3Dstream");

as i noted before, the following string works without the credentials: viewer.setUrl("http://$ip:$port/?action=stream");

Edit: for the string in plain text without variables the debug error i get with the credentials is:

W/MjpegView: Cannot extract a boundary string from HTTP header with message: Unable to find mjpeg boundary. Use a default value instead. E/MjpegView: http://myuser:mypass@10.10.10.101:8080/?action=stream

I guess extracting the boundaries doesn't work for this kind of string ("http://a:b@1.2.3.4:1234"), does it?

BTW: i am using mjpg-streamer with the following command: ./mjpg_streamer -i input_uvc.so -o "output_http.so -c myuser:mypass"