Skip to content

Sound option does not work in iOS devices #22

@nitrox007

Description

@nitrox007

I have been working on replacing Google's reCaptcha with VisualCaptcha and during my testing, I noticed the sound option does not work in mobile safari in iOS. I did some googling and found some references about mobile safari needing a file extension in the tag being used in the accessibility section. I then tried streaming the sound data in a .php file in the tag and that didn't work either. I then tried to process an .mp3 file as php and stream the data from it, having where file.mp3 was a .php file streaming the actual .mp3 data, that works only if i hard-code the path of the actual .mp3 file in file.mp3. But when I concatenate the path to the .mp3 file from $_SESSION['visualcaptcha']['validAudioOption']['path'], it doesn't work. I have confirmed that the path is correct, and the file exists. I copied the resulting path from the session variable and hard-coded it to stream it, and it doesn't work.

Here's the code I've used for file.mp3:

`<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);

$audiofile = $_SESSION['path_to_file'];

$filepath1 = "path". $audiofile . ".mp3";

$filepath2 = 'path\filename.mp3';

$filename=$filepath;

if(file_exists($filename)) {
header('Content-Type: audio/mpeg');
header('Content-Disposition: inline; filename="'.$filepath.'"');
header('Content-length: '.filesize($filepath));
header('Cache-Control: no-cache');
header("Content-Transfer-Encoding: binary");

readfile($filepath);

} else {
header("HTTP/1.0 404 Not Found");
}
?>`

Here, $filepath1 fails, and $filepath2 works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions