--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
I managed to send the image data to webpage using Socket.io
i send a json object like this
{"data": HERE IS THE BINARY DATA OF THE PNG IMAGE, "width":
320,"height":480}
Now i the webpage i read this data into a buffer, so now i need to
create a "in memory" image from this buffer and draw into a webpage.
Maybe i can draw into canvas or using img tag , but i don't know how
to "create the image" in the client side.
(maybe this is off-topic,.. if so. i'm sorry)
You do mention video in the title so if you want to do video (xx frames
pr second) I would make a node.js app which does stream video and
display it in a html5 video tag and then stay away of using WebSockets
for it.
But; if your goal is to push a image from the server to the client on a
regular basis you can just base64 encode the image on the server and
send the base64 string over a WebSocket to the browser. In the browser
you can simply pass the base64 string to a img tag.
I've recently done the same where I grab a image from the camera on a
mobile device and pipe it trough a node.js WebSocket server to other
clients:
http://www.youtube.com/watch?v=jqXo-AEVhK4
It's fairly simple code. The code for it is here:
https://github.com/trygve-lie/demos-html5-realtime
(see under "Demo II - Instant Camera")
Kind regards
Trygve
@trygve_lie
> --
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nodejs/-/ZUhhWWJlV3hfSFFK.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs
Also, if this really is a video stream, +1 for JPEG vs. PNG: JPEG has better compression for camera-captured images. I doubt you'll get very good compression of image data with zlib since images are already compressed.
-Matt
Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.