0

I am currently getting an MJPEG stream of data in Swift using NSURLSession.

Is there anyway to get data every X seconds instead of continuously as it does currently?

Incase you are not sure what I mean, here is a graphical representation:

Currently:

Incoming JPEG data
... (small delay, displaying the image)
Incoming JPEG data
... (etc.)

What I want:

Incoming JPEG data
... (displaying image)
... (5 seconds delay)
Incoming JPEG data

EDIT: This is not about the progress on the data download. This is about a delay between each time the didReceiveData delegate function is called.

I receive image A. I want a X second delay between receiving image A and receiving image B.

  • About the delay displaying image you need to use dispatch async get main queue to update the UI – Leo Dabus Jan 15 '16 at 03:41
  • My aim is not to delay the image displaying. My aim is to delay the session so it receives data every X seconds. @LeoDabus –  Jan 15 '16 at 03:50
  • 1
    Why don't you manage the display timing instead of the receiving timing? If you don't need it now just delay the download start – Leo Dabus Jan 15 '16 at 03:53

0 Answers0