I am developing an android app which basically connect 2 smartphones over Bluetooth. The purpose of the connection is to control one device camera (slave) and take pictures/videos with the other device(master).
I have created a Bluetooth connection between the devices, one is acting as a client and the other as a server. Server is turning on the camera and listens if the client is making any action(shoot,zoom,etc.).
Now, the question is how the server(slave) is showing the client(master) his camera feed?
I can transfer bytes between the devices and after reading some articles about this issue, I think that the bytes should be compressed into frames(by the slave) and then opened as images and displayed on the screen(on the master).
Anyone knows what will be the best way to do that? Any recommended protocol or API? What are the pros and cons for different approaches?
Any help will be appreciated.
Usually bluetooth is very slow to send image frames, but you don't need to sends each and every frames. One problem you will face is the frame collision. Bluetooth socket sends your data(frames) as byte array. So while receiving the data from other end most of the times the bytes of previous frame and current frame will collide. So you need to make sure that is the first frame is received by the remote mobile and processed successfully. The frames created while the remote mobile is processing should not be stores in buffer to send later, Rather they should be ignored(Should not send). Some frames may miss, but you will work as live feed. Now the android mobile will create big frames of preview according to the camera resolution. So you need to send small size of frame only, on the remaining space of the display you can show camera controls.
I have posted an example project in my Github repo. Bluetooth Camera