Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming video over WiFi and Bluetooth on iOS

This question is going to be quite generic since I'm novice in iOS, video-streaming, and Bluetooth (going to be an interesting project).

Basically I wish to be able to stream low-res video from one iOS device to another iOS device, either through WiFi or Bluetooth depending on which one is available. Bonjour is used for initial service discovery. (I know streaming video over Bluetooth is non-ideal but it's one of the project's requirements)

So the question is what video-streaming framework/library can be used in order to maximize the amount of code shared between streaming video over WiFi and streaming video over Bluetooth.

like image 777
Kai Avatar asked Feb 15 '23 19:02

Kai


2 Answers

Here are the instructions to test video streaming through Multipeer Conectivity:

You need Cocoapods, if you have not installed it yet, go to http://cocoapods.org/#install

  1. Clone the transmitter from https://github.com/pj4533/AVCaptureMultipeerVideoDataOutput
  2. Navigate to AVCaptureMultipeerVideoDataOutput/Sample directory in the Terminal and execute pod install
  3. Clone the receiver from https://github.com/pj4533/SGSMultipeerVideoMixer
  4. Run the transmitter in a physical device, you will see the back camera on screen
  5. Run one or more receivers in the simulator or physical devices, the image of the emitter should appear in the receivers.

NOTE: The Multipeer Connectivity requires iOS 7 and both devices should have either WiFi or Bluetooth activated, I have tested it successfully on WiFi, Bluetooth may be too slow.

like image 95
apascual Avatar answered Feb 23 '23 23:02

apascual


I will suggest to use the MultipeerConnectivity framework. Here are the few delegate methods provided by MCSessionDelegate

MCSessionDelegate <NSObject>


// Received a byte stream from remote peer

- (void)session:(MCSession *)session didReceiveStream:(NSInputStream *)stream withName:(NSString *)streamName fromPeer:(MCPeerID *)peerID;


// Start receiving a resource from remote peer

- (void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress;


// Finished receiving a resource from remote peer and saved the content in a temporary location - the app is responsible for moving the file to a permanent location within its sandbox

- (void)session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID atURL:(NSURL *)localURL withError:(NSError *)error;`

Try to read http://nshipster.com/multipeer-connectivity/

like image 31
Paragon Avatar answered Feb 23 '23 21:02

Paragon