DanWin / le-chat-php

A PHP Chat based on LE CHAT
https://danwin1210.de/chat/
GNU General Public License v3.0
267 stars 98 forks source link

Feature request: different sounds on PM and room message receiving #95

Open Finnboy94 opened 3 years ago

Finnboy94 commented 3 years ago

Hello,

I am asking this as a blind user. Could it be possible to get sounds for the PMs and room-wide messages? Also, could it be possible to get SAPI to read the messages. Asking this for other blind users as well who have to refresh the page and read it with their screen readers to get the new messages.

Thanks.

Finnboy94 commented 3 years ago

Any idea on this?

DanWin commented 3 years ago

Hello @Finnboy94 ,

thanks for the feature request. That's a great idea. This would require tracking the last shown message in the user session and injecting an auto-play sound file on a new message. There should also be an option in the users profile settings on whether they want a notification for all types of messages, only PMs, or disable the sound all together. Perhaps also an option for the admins to set a default. It would also be nice to have several sounds to select from.

SAPI seems to be a Microsoft product meant for applications. There is however also a Web Speech API, which is directly built into browsers. To make use of it, JavaScript would be required and language information needs to be associated with each message, since attempting to speak a text of another language than the reader's setting would be hard to understand.

Finnboy94 commented 3 years ago

Ah, a great amount of work I see. Would this be perhaps doable at some point? I can provide sound files to choose from on the different types of messages. I don't know much about JavaScript and PHP myself - this just came into my mind when discussing this chat with a few other blidn people.

DanWin commented 3 years ago

Yes, it's certainly doable and a great addition to have. Overall there are probably several accessibility improvements that could be made and have so far been overlooked or not adequately thought of. For example correctly labelling each input field with aria attributes, that can be accessed by screen readers and other accessibility tools. Also another interesting aspect could be the captcha implementation, that is supposed to stop spam bots. Currently there is only a visual image with different levels of complexity/distortion. As a blind person it would be impossible to solve this captcha, unless you have a good OCR software, which can read the captcha. At the most basic level this would probably still be readable to an OCR software, but the more difficult levels need specific training on how to read those properly. Here a server-generated audio sample comes to mind, which may also receive different levels of distortion in terms of pitch, different voices, background noise, etc.

ghost commented 3 years ago

Also, could it be possible to get SAPI to read the messages. Asking this for other blind users as well who have to refresh the page and read it with their screen readers to get the new messages.

I'd enjoy hearing you go into further detail about SAPI and how it relates with this (given that is is a Microsoft Application).

ghost commented 3 years ago

Also, any suggestions on the sounds?

Finnboy94 commented 3 years ago

SAPI was only a suggestion - the web speech API that is directly built into browsers is probably far better. As for the CAPTCHA, I have just disabled it for my own chat as it is being used by many blind users. Something I have noticed is that the refresh seems to throw the focus of a screen reader to the buttons in the bar (like Messages, Administration etc). I have solved this, at least somehow, by globally hiding the user list. That way it does not come in between the messages and hte buttons when a blind person views the page with their screen reader.

Finnboy94 commented 3 years ago

Also, any suggestions on the sounds?

I can add a sounds folder with a few suggestions to my fork. I have many sound ideas in mind.

Finnboy94 commented 3 years ago

PR #109 has some sample files.

ghost commented 3 years ago

Nice! I definitely want to give that a look.