Limit bandwidth within app

Discussion in 'iOS Programming' started by newtoiphonesdk, Sep 24, 2010.

  1. newtoiphonesdk macrumors 6502a

    Joined:
    Jul 30, 2010
    #1
    I have an app that accesses this site in a WebView.
    Every .mp3 file there has less MB than minutes of Audio. According to 9.3 of App Review Guidelines an app can't receive more than 5 MB in 5 minutes. The .mp3 files fit this ratio, but the issue is that the phone will download it all at once. Meaning in about 5 minutes it may download the whole 21 MB file, and for the next 25 minutes of the file not download anymore. Is there any way I can change it to where it will download it over a slower amount of time, or any other way to meet the requirements?
     
  2. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #2
    Limit bandwidth within app

    I had an app rejected because the mp3 it was playing within the app was using more than 5 mb of data in 5 minutes. Someone suggested I could throughput the bandwidth of the app so this wouldn't happen, but they didn't know how to do this. I've looked online, and haven't been able to find any solutions for this. Is it really possible to do and not well documented, or can limiting the bandwidth not be done?
     
  3. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #3
    Just to be clear, the mp3 you are playing is located on a server somewhere, not on the device right? Generally speaking it is definitely possible to limit the bandwidth of an arbitrary transmission. The question is whether it is possible in this case where you apparently need to download and play an mp3 in real time.
     
  4. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #4
    Yes it is an mp3 stored on a webserver and not the device.
     
  5. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #5
    Honestly I think about the only workaround is to make it so your app requires a WiFi connection. Otherwise you would have to write a custom file downloader that would manually insert some waits or something to stay under the limit.
     
  6. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #6
    yea, I can't really do the wifi only thing. The audio part is only 1 of 5 different views in the app, and the others connect to the internet just to read blog articles or post them to facebook. If there's a way I can make just one of the view controllers wifi only it would be great. I just think the 5 mb in 5 minutes rule is too rigid. Yes, my app is downloading 17 mb in 5 minutes, but for the rest of the 43 minute audio file, it's downloading nothing. Shouldn't that count for something?
     
  7. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #7
    ha, sadly between Apple and AT&T I doubt you have any recourse. You will either have to make the app WiFi only or not release it to the app store.
     
  8. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #8
    If you control the server then you might find it easier to throttle the connection on the server side. Otherwise you're going to have to write a custom downloader for the client.
     
  9. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #9
    I control the server side, adn that is where the .php is at that will access the .mp3s, but I don't control the server that has the .mp3s. How do you write a custom downloader for it?
     
  10. 87vert macrumors 6502

    87vert

    Joined:
    Oct 7, 2008
    Location:
    Pittsburgh, PA
  11. newtoiphonesdk thread starter macrumors 6502a

    Joined:
    Jul 30, 2010
    #11
    They're plenty small already. 1 hour audio and only 17 MB. The issue is that the entire 17 MB is getting downloaded in less than 5 minutes. I just need a way to throttle the bandwidth to only allow 5 MB in a 5 minute time for the app.
     
  12. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #12
    Well... since it is in PHP you would just fopen the URL of the MP3, read a set number of bytes and spit them out, then sleep for however long you want. Rinse and repeat.
     

Share This Page