I have two iOS devices, and both have a copy of the same video. Both devices are communicating over bluetooth. The video is only playing on one device while the other is the remote control. The "remote control" device needs a scrubber showing where in the duration the video is.
What is the best way to keep the scrubber in sync with the video playing?
I'm using AVPlayer for playing the video and Gamekit for the bluetooth connection.
heh, well that will be fun to get working. Latency is something you will always get, so you need some mitigation strategies. I would suggest looking at certain ways that people deal with lag. One thing i can suggest is dividing your two message types into critical and non critical. so for example, a stop/pause/play/restart command would to me, be critical. You want that message to get through, and you will keep trying till it does.
Messages such as changing the scrubber position, in both directions (player to remote, remote to player), are non critical. You are sending them, but you shouldn't waste time acking the responses or making sure they are delivered. Sort of similar to the difference between UDP and TCP. These will just be sent over the connection, and i would basically have the package being no more complicated than (scrubberposition, position_as_time, identifier_number ). Record the last identifier number you got (identifier number is a monotonically increasing number) and discard any messages with numbers below this, and update to the position for any higher numbers, and update your stored identifier_number.
I hope this makes sense/helps, let me know if i need to explain anything further, and good luck