Page 1 of 1
VLC download bug - fails if VLC is put into the background
Posted: 11 Mar 2015 03:28
by TheBigTime001
An annoying bug I have noticed is that when downloading videos is that if you put VLC into the background and then come back to the app, the download will fail. I could understand this happening if I closed the app completely or put the device to sleep, but VLC should keep downloading in the background unless something truly does go wrong with the download. I don't know if this is necessarily a bug or just a current limitation of the MobileVLCKit framework, but I think that this should definitely be fixed. It's annoying to have to keep the app open the whole time the download is in progress. Please, can this be fixed? This is the biggest headache fr me, as I in general find the app to be very stable. Thank you in advance for whatever replies come, as they are sure to be filled with helpful advice or comments.
Re: VLC download bug - fails if VLC is put into the background
Posted: 11 Mar 2015 10:52
by fkuehne
In fact VLC should continue the download in the background for up to 2 minutes. However, after that time-out, the operating system kills the app so download is stopped. We should implement a local notification to remind the user to go back to our app in time to prevent this from happening.
Re: VLC download bug - fails if VLC is put into the background
Posted: 12 Mar 2015 03:36
by TheBigTime001
Such a thing would naturally come at the expense of battery life, but is there a way to trick iOS into thinking that the app is still being interacted with and thus cannot be ignored safely? I see this all the time on desktop apps, where a monitoring thread watches the process/thread/daemon and prevents the OS from closing it or shoving it aside. Perhaps VLC on iOS could have such a helper thread that sleeps until a network transaction occurs? This is how I have seen it done in lots of systems, where the processes keep each other alive through a messaging system. If the app is still receiving input, even a dummy string, the OS should take that into consideration, and thus such a time-out should no longer apply. Chrome for iOS can do background downloads as of last I heard, and I assume that such a system must be used there to ensure that the OS cannot force-close the process mid-download. I am very techie but not that much of a programmer, so I naturally could be wrong, but could such a dual-process system be implemented so that uninterruptible downloads would be possible? This still would not help if the device was put to sleep, but I think it would be a big positive step. Please give your thoughts on this. Thanks!
Re: VLC download bug - fails if VLC is put into the background
Posted: 12 Mar 2015 08:50
by fkuehne
is there a way to trick iOS into thinking that the app is still being interacted with and thus cannot be ignored safely?
No, Apple is really strict about it and kills every backgrounded app after 2 minutes unless it is doing something endorsed in the background like maps navigation or audio playback. In fact, a reliable work-around with VLC is starting the download and afterwards playing a piece of music. Note that iOS will also kill the app if we just played silence while in background..
Re: VLC download bug - fails if VLC is put into the background
Posted: 13 Mar 2015 02:37
by mattack
I don't deny that there are times when the user would like something like this to happen.. but iOS enforces this on purpose, for battery and other reasons.
Re: VLC download bug - fails if VLC is put into the background
Posted: 14 Mar 2015 16:54
by TheBigTime001
Hmm... I see a way to use the background audio restriction to actually make this work. I can play something while VLC downloads, so perhaps a dummy audio file, 15 seconds of silence that loops in the background? It could be enabled via a toggle switch under the download button, and then this dummy audio file would begin looping. It would then be stoppable by untoggling the switch, say after the download was complete. Or, to save battery life, VLC could monitor when the download was done and automatically turn off this dummy stream. I could even try coding this myself, if a dev could tell me which files would need to be modded for:
Creating this toggle switch in the interface
Having the toggle begin the looped audio
Automatically disabling the dummy stream upon download completion
Manually shutting down the dummy stream
Displaying a battery life warning message before allowing toggling on the dummy stream
I am a little bit of a beginner at programming, and I have no Mac (unfortunately), so coding and testing could be difficult, but if an admin is willing to let me try and to help, I can send patches and recieve IPAs via PM, which would help significantly. I can't promise immediate results, but I can certainly try to make this work.
Re: VLC download bug - fails if VLC is put into the background
Posted: 19 Mar 2015 05:14
by TheBigTime001
I wish a response would be made; unlike so many feature/bug requests on the forum, I have offered to write the code. As I said, making packages is not within my current capabilities, but testing private packages is. I am fully willing to do the code if someone would tell me where to put it. Hopefully this would help lots of people and also help the devs' plates to be a little less full as only package-building would be needed on their part, not actually coding it. Once again, thanks for any help or tips that come my way!
Re: VLC download bug - fails if VLC is put into the background
Posted: 19 Mar 2015 09:34
by fkuehne
Hello,
We always welcome code contributions. However, developing for iOS is just impossible without a Mac. You can't test your code as you can't even compile it.
Regarding your suggestion: as I said before: iOS does kill apps in the background which play silence only, so playing a silent audio file in the background wouldn't change a thing.
What we have to do is implementing a background downloading spin-off process which is a new feature in iOS 8, but I'm not sure yet when I'll have the time to do so.
Re: VLC download bug - fails if VLC is put into the background
Posted: 19 Mar 2015 13:03
by TheBigTime001
Hmm... So my silent audio idea won't work. I have decent skills with then open-source audio editor Audacity, so I could create a file with pseudo-random wave forms, varying between 1 dB and 5 dB, or slightly quieter at the high end to avoid annoyance if necessary, or would that count as silence to the OS as well? Is there a well defined "silence border" where iOS is concerned? Is it low enough that this idea could work without really annoying the user due to incessant background noise? Is there a frequency it could be modulated to that would be practically inaudible without violating the specifications of common audio formats? Also, would 30 seconds be an okay length to repeat without bloating the app too much? I ask all these questions because at least I could create the dummy file and give someone something to work around. If even this kind of small contrib would help, I would be glad, but as I said, I can code this, I have done slightly harder OS tweaking before, but that is enough bragging already. I just need someone who can compile the code, as I am quite capable of testing the packages that result and tweaking the code to make it work. If that won't work either, then maybe I could write the basic Objective-C framework for this, so at least it wouldn't have to be developed completely from scratch. As always, your replies are appreciated. Maybe this project will, sadly enough, just beat me, but then again, maybe it won't. I don't honestly know if the coding bit is completely outside of my capabilities, but I would like to do whatever I can here. All the best!
Re: VLC download bug - fails if VLC is put into the background
Posted: 19 Mar 2015 13:09
by TheBigTime001
Also, I could try to tackle the background process thing if the audio suggestion simply will not work. I am new to the iOS bit, but fortunately I am not a complete newbie when it comes to programming. As I am busy with other things, this will only be doable in whatever spare time I have, so it will likely take at least a month, but that is better than it never getting done because the devs have tons on their plate and as you said, you just don't know when you'll have the time. All I need is someone on the inside to compile with my modifications and PM me the resulting packages. I am starting here because it bugs me (pun absolutely intended) that I have never before even tried to help fix problems with any version of VLC. All the best!