0

I have a question, my app is a short video share application just like vine, but now I encounter questions when used in subway or some places with weak signals, it will fail sometimes and have poor user experience.

I am a newbie for network programming and iOS. I did a lot search on Google, and have some general sense, let me sum up my finds and pls help to give some suggestions for it.

My requirement is:1. support resume when uploading interrupt. 2. can success upload in weak signal. Actually I do NOT need to think about the realtime problems or how to compress the video, just think the video as a file is totally ok. BTW the server is a REST style, I use post to upload datas.

Questions:

  1. which is the better way for my requirement, using stream(stream NOT mean live stream video just data stream like NSOutStream&NSInputStream, just play the video after all of it has uploaded, NOT the live stream video playing and downloading at meantime) or divide the whole file into several chunks and upload chunk by chunk. someone said, using stream is good for resource efficiency since the stream will read files into memory and control the size of the buffer and after setup connection with server we use delegate to control the failure so easy to use. Upload chunk by chunk is good at speed, I have puzzled with this statement, upload by chunks after successfully upload one chunk we need to release the connection resources and setup another connection then do upload I think this will spend time to do these preparation stuffs.

  2. If upload by chunks which size should be good, one video file is almost 1M bytes, someone said 8k is a safe choice, but......

  3. since the app needs to adapt to different signal strength, is there any way? for example the chunk size is depended on the bandwidth or other ways

  4. Is there any private API already support resume uploading interrupt or is there any apple api can support this, my app needs to run on iOS 5 and above so can NOT use NSURLSession

  5. Concurrent uploading is a way to speed up? If so how to implement or any API available?

Thank you in advance for helping a newbie like me. Thank you very much.

1 Answers1

1

It takes o lot of topics your question. iOS doesn't have an public API to stream video (such as the face time components). The main issue here is sending frame by frame will require a lot of network traffic, instead if you use the normal video writer you get hardware compression, that will be a lot better. There's more and you can check here: Realtime Audio/Video Streaming FROM iPhone to another device (Browser, or iPhone), Upload live streaming video from iPhone like Ustream or Qik, How send to stream video from iOS device to server? and here
If real time is not your problem I would suggest you just to use a good network manager such as: MKNetworkkit or AFNetworking 2.0 . They will take care of most of the aspect that you asked.

Community
  • 1
  • 1
Andrea
  • 26,120
  • 10
  • 85
  • 131
  • Thank you Andrea for your quick response, actually realtime is NOT my issue, I do NOT need to use live stream video, I just need to upload the whole files, so do you have some suggestions for upload by chunks or by stream? – OddQuestionar Dec 13 '13 at 07:50
  • Try to use one of the download manager that I suggested, they are built up on NSURLConnection and NSURLSession, they are able to send big files avoiding memory issues reading directly from a file few bytes at time. I don't really know if after all the use just a single stream or chunks they abstract this sort of low level concepts. – Andrea Dec 13 '13 at 09:49
  • thank you andrea, but seems I still need suggestions for my specific questions. – OddQuestionar Dec 15 '13 at 06:11