[SOLVED] Has any one used nanohttpd to run an android web server? lazarus / 43-Android ---------------------------------------------------------------------- hongdusocal · 2023-07-22 00:34 I have read something about using nanohttpd to turn android phone into a web server. Just want to know if it has been integrated to LAMW or someone has tried to use the the nanohttpd library to write a server app. Thanks. ---------------------------------------------------------------------- Handoko · 2023-07-22 15:13 Sorry, for not answering your question but I wonder why anyone would want to use an Android phone as a web server? Is it cheaper or faster than desktop computers? ---------------------------------------------------------------------- benohb · 2023-07-22 22:07 Is nanohttpd necessary? Or you need a http server whatever ---------------------------------------------------------------------- hongdusocal · 2023-07-22 22:31 My intention is to use android phone as a web server so that any other smartphones including Android and iPhone and any computers and tablets can exchange information with the android phone. That’s the easiest way to get instant communication with or without phone service as long as internet or intranet access is established. I need it for a physics experiment that I am developing now. Anyway, I have found it is doable and have implemented one such simple server after reading some articles online. Basically I copied the nanohttpd.java to the main app folder and modified the main app activity class to run a separate thread for the nanohttp class server. The server can receive http requests from any http client including web browsers and send responses back. It works very well, even when the android app is not showing its GUI. Thanks Lazarus for providing such a wonderful platform for android development. Best regards to all. ---------------------------------------------------------------------- Handoko · 2023-07-23 07:17 I ever tried to connect my Android phone to my Linux computer, it worked. I used UDP socket, on the Android code it used UDP socket component (LAMW) and on my Linux system it used blcksock unit (Synapse package). ---------------------------------------------------------------------- hongdusocal · 2023-07-23 21:06 Thank you for the information, Handoko. The advantage of using nanohttpd is that no programming is needed on the side of desktop computer or other cell phones. All the information exchange can be easily achieved by the http post or get method. This saves me time by avoiding the details of socket programming. I am collecting information to make videos from android phone playable on iphones. All linux, windows and android phones can play videos from the android http server, but iPhone cannot. From the information I found at stack overflow, I need to use nanohttpd to provide range capability. ---------------------------------------------------------------------- hongdusocal · 2023-07-24 03:07 It appears that different browsers support or do not support different formats of videos. For example, H.264 and H.263 videos may or may not be played on iPhone browsers or linux browsers. Range capability didn't solve the problem. Just my observations, cannot guarantee to be true. ---------------------------------------------------------------------- Handoko · 2023-07-24 03:52 Quote from: hongdusocal on July 24, 2023, 05:07:18 am... H.264 and H.263 videos may or may not be played on iPhone browsers or linux browsers. I have been using Linux for years, never have any issue playing videos in my web browsers. I use Firefox, Pale Moon and sometimes Sea Monkey and Opera (classic). I checked the libraries installed on my computer using Synaptic Package Manager. I found H.263 and H.264 coders/encoders are provided by the vga driver. I'm using Intel integrated vga. ---------------------------------------------------------------------- hongdusocal · 2023-07-24 06:57 Linux and Windows browsers behave much similar, while iPhone browsers behaves quite differently. I do not have a clear understanding of the way MediaRecorder java code works. For example, I set the audio channel number to 1, hoping to have mono audio, but the actual recorded video does not show mono audio, and number of channel is not 1 either. Switching between H263 and H264 will even cause Nanohddpd server to not work properly and the server has to be restarted. If I use Android phone's own camera app to record video and send it to Nanohttpd, the video has mono channel audio and iPhone browser can play it, but both linux and Windows11 browsers will only show audio progress bar with no video view available. Thanks for the information about linux drivers. I am pretty sure that MediaRecorder produced H263 format that is not supported by linux and Windows browsers. But those files downloaded to local computer can be played by other media player outside browsers. Hard to understand. Best regards, Hong