Skip to content
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

Play Audio From Captcha In Browser Not From .wav File. #178

Open
9mido opened this issue Mar 6, 2020 · 5 comments
Open

Play Audio From Captcha In Browser Not From .wav File. #178

9mido opened this issue Mar 6, 2020 · 5 comments

Comments

@9mido
Copy link

9mido commented Mar 6, 2020

This is a feature request. In addition to being able to click on a captcha image and download a .wav file of the captcha (since some people might like this), there should be an additional way to change this default behavior - to listen to the audio by doing something like clicking an audio play button in the browser web page to directly hear the captcha text without downloading it. Or maybe leave both options or choose one or the other for downloading the .wav file and playing in the browser.

One additional feature for the audio that would be nice is to have some more options for the audio playback that might sound better. Flite is okay, but it doesn't sound that great especially with sox brown noise rainbow table protection. Using alternatives that sound like Google Text To Speech or others would be nice (but GTTS requires an API / internet connection which might be problematic). It would probably be best to not use any third party text to audio programs to accomplish this. The whole reason I am using this project is to avoid cookies and to be GDPR / Cookie Law Compliant. If nothing other than Flite could be used, it is not a big deal. I am more concerned with being able to play the audio in the browser.

If neither of these features are possible, can someone so kindly provide some code below to be able to accomplish one or both of these things universally to work anywhere (regular template forms, allauth forms, etc.)

A main reason for requesting this is to be compliant with ADA laws.

@SilverStrings024
Copy link

Please let me know if anyone would like some help coding this. I did this for myself and would like to help make the project even better!

@mbi
Copy link
Owner

mbi commented Mar 13, 2020

@SilverStrings024 pull requests are always welcome! 🙇‍♂️

@SilverStrings024
Copy link

@SilverStrings024 pull requests are always welcome! bowing_man

I'm not sure what branch to do this to. I've never done a pull request so I'll need to read into it and see if I can use the existing code so it is automatically rendered instead of needing to be rendered after the page loads because currently it's just taking the existing captcha, breaking it apart and implanting an audio player to the browser after the document is ready.

@9mido
Copy link
Author

9mido commented Apr 4, 2020

@mbi Take a look at code written by SilverStrings024. It did not work when he tried to help me with it (we still need to do a remote session together) but maybe it can give you some ideas of how to do implement a feature like this since I had trouble trying to implement it in my project.

https://pastebin.com/hXAzVbcv

@9mido
Copy link
Author

9mido commented Apr 23, 2020

Update: I was able to accomplish playing the audio in the browser using https://django-simple-captcha.readthedocs.io/en/latest/advanced.html#rendering and adding

<audio controls>
  <source src="{{ audio }}" />
</audio>

to custom_field.html

https://stackoverflow.com/questions/18972515/how-to-create-ajax-refresh-for-django-simple-captcha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants