Android Question How show Camera in httpserver?

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hi Erel.
I programming httpserver
acctualy start httpserver and in chrome connect address example 192.168.1.2:5555
and send picutre with :

Response.SetContentType("image/jpeg")
Response.SendFile(File.DirRootExternal,"a.jpg")

"a.jpg" is file that i save it with camera

and in server(192.168.1.2:5555) i download picutre with ajax :
PHP:
var img;
$(document).ready(function() {
download();
  img = document.createElement('img');
  document.body.appendChild(img);
});
    function hexToBase64(str) {
        return btoa(String.fromCharCode.apply(null, str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" ")));
    }
function download() {
setInterval(function() {
    this.xhr = $.ajax({
    type: 'GET',
    dataType: 'image/jpg',
        url: "a.jpg",
    }).success(function (data) {
     
        img.src = 'data:image/jpeg;base64,' + hexToBase64(data);
       
   
    });
},200);
}
when use ajax,httpserver detect request and send image to it but i cannot show it
how Erel(Thank's)?
 

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
This is a community forum. Don't limit your questions to a single member.

Are you able to show the image with a standard request (not ajax)?
Yes i can show image without ajax but i can show camera live so i must be use ajax
is there solution this problem?
 
Upvote 0
Top