New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio is not working on iOS / Safari (with no mp3 support) #52
Comments
This page would seem to indicate Safari on iOS supports uncompressed WAV.
Would you mind going to http://hpr.dogphilosophy.net/test/ on the device it isn't working on and pressing the "click to try it" button next to the wav format and let me know the result? |
I've run the test as you asked on my iPad: the wave audio file is played correctly. |
Thanks for confirming wav on the test site played on the iPad. I don't have access to one but am having someone try it on another site with wav only to see if it works. If you try it on your iPad at this url is it also not working? That page should present only a wav audio source and I made sure it works there using Chrome on Windows & Linux as well as Chrome on Android and the Android stock browser. Thanks. |
Okay I figured out the issue. Apple devices and/or Safari sends a "Range: 0-1" header when it wants to download media and since the response doesn't reply with the appropriate range, it essentially discards the response without any indication of it. I will be implementing a change to support range requests for audio files that will store the audio data in the session (due to open_basedir and possible file permissions issues writing to tmp or other directories on some systems) so the audio file can be sent in ranges without corrupting the audio stream since the files are dynamically generated and don't exist on the filesystem anywhere. Stay tuned. |
Thanks for investigating about this issue. I've tried the audio provided in the page you gave me (https://www.phpcaptcha.org/securimage/example_form.php) but it doesn't work on my iPad. But it seems that you've already figured out why. |
Hi, if you wouldn't mind running some tests I have some code ready. Unfortunately I don't have physical access to an iPod/iPhone/iPad so I've been bugging a friend remotely to hit a test URL while I run a packet sniffer to see how it works. He says it's working fine on his end but I am observing some weird range requests from his device that aren't making much sense. When I run some command line tests simulating different range requests and scenarios they work as expected. Just can't quite figure out what his phone is doing but I want to make sure it's working reliably before I release the update. If you are able, for starters, you can test at https://www.phpcaptcha.org/securimage/example_form.php This url will only return WAV files (will test mp3 later) and will respond to range requests. I think some good tests are: If it seems to work well in those cases I can probably move on to clean up and release the code. Thank you, your help and feedback is much appreciated. |
Hi, I've run the tests as you asked. Unfortunately, it doesn't work for me (tested on both iPad - iOS 9.0.2 and iPhone - iOS 9.0). When I click the audio button, it switches to the loading icon (without rotating - but this is a detail), the "network loading" icon is played at the top of this iPad (so an HTTP request is being sent), but it never stops loading and the audio isn't played. Nothing else works by then: I'm not able to refresh the image using your refresh icon, neither refresh the whole page using the refresh button of Safari. The page starts to be loaded (according to the progress bar of the browser), but it is never completed. I'm also not able to open a new tab and then access your testing page again: the browser starts to load it, but without any success (like after a refresh). I have to close the browser's tab, quit Safari (force the application to close) and then restart it to access your page again. But the audio is still not working... I've also tried as you asked to start by loading a new captcha before playing the audio, but the result is still the same... |
Hi again, I made some revisions, had someone test on an iPad running iOS 9.0.2 as well as an iPhone on 4G and they said that it worked. I also tested on an iPod touch running 9.0.2 and it worked. Would you mind trying again at http://www.phpcaptcha.org/securimage/example_form.php when you can? HSTS may prevent it from loading over http but that's okay. This URL is working with range requests on Android 4.4.2 using Chrome, Firefox, and the native browser. It is also working in Iron (chromium) on Linux, and Firefox on Linux which send open ended range requests. Hopefully now it'll work for you. Thanks! |
Hi, |
Thanks for checking. I'm glad it worked at least partially, it's a start. What must be happening is that after one of the requests, a PHP request doesn't end correctly (maybe specific to running as a CGI on my server) and the session stays locked which will cause subsequent requests to hang as it waits for the session file to become available. I have observed some odd behavior I can honestly say I don't understand (especially if you are testing over a mobile network). What I see in my tests with iOS (I can only see your basic requests since I am not running any packet logging on that server) is a sequence of requests that looks like this: Browser request: bytes 0-1 Every time I've had someone test with iOS I see this behavior over WiFi and mobile. My packet traces show it sends the entire file, then the two large chunks again so the entire audio file is sent almost twice (which seems inefficient especially over mobile). My best guess is that this is done as some method to try to assure reliable streaming (in case the first request for the entire file stalls or has high latency) but overall it's using almost twice the bandwidth for the client and server. Probably in your testing of multiple refreshes and playbacks, these crossed up requests might have caused the device to keep one of the connections open. In any case, if I call session_write_close() as soon as possible in regards to audio streaming, it should prevent the hangups from occurring (this won't be an issue with database only storage either). I may just add that session change in and make a release or see if you can test again before doing so. Again, I really appreciate your time and feedback on the matter. Update: I checked my server logs and I see some problems while you were testing. I am using a less-than-ideal FastCGI configuration which might explain the problems you ran into and I think are totally unrelated to the PHP code, it just happened to break your tests. It looks like Apache tried to restart around the time you were testing and that may have caused problems. In any case these errors correspond to you and seem to be server issues. [Mon Oct 12 00:31:55.785330 2015] [fcgid:warn] pid 24022:tid 140197538772736Connection reset by peer: [client 92.xxx.xxx.xxx:51618] mod_fcgid: error reading data from FastCGI server, referer: https://www.phpcaptcha.org/securimage/example_form.php |
I went ahead and released a new version, 3.6.2, to address this issue as I think it is working. I am going to try to upgrade my server in a couple of days to fix the CGI issues that I think were affecting your tests. In any case, you can try again at https://www.phpcaptcha.org/securimage/example_form.php and see if it's any better now if you wish. Thanks again. |
Hi, I've just run a dozen of tests on my iPad and... all worked well! That's great! I admit I've just refresh the image a dozen of times, not fully refresh the page nor restart Safari, but I think this is enough to conclude that all is OK. |
Very happy to hear it, thanks again for all of your help! |
Hi,
I'm trying to make the audio work on my iPad / iPhone (with Safari), but it doesn't. The audio button renders the "loading" image after clicking it, but it stays in this state and no audio is played. The HTTP request is well processed (I checked in the Apache's log), and no error is triggered in the outputAudioFile() method either. I also tested using the "captcha.html" file provided with the package, and it doesn't work too (whereas everything works well on my computer, using Chrome, Firefox or MSIE). I've tested the demo on the phpcaptcha.org site, and I have no issue with my iPad. The only difference between your site and my server seems to be that Lame is not enabled on my side, so only wave audio is supported. Is that the point? Are iOS devices only supporting MP3 audio files?
Could you please check out that the audio works for you on iOS if the MP3 / Lame support is not available?
Thanks a lot for your help.
ML.
The text was updated successfully, but these errors were encountered: