Turn on relay for amount of time by continuous input
I would suggest having a buzzerPlaying state, an oldInput state, and a buzzerOffTime (unsigned long millis when you should turn the buzzer off.
Ignore input if buzzerPlaying == true and just check the buzzerOffTime. When buzzerOffTime passes, turn off the buzzer, set buzzerPlaying to false, and start checking the input again.
If the buzzerPlaying == false and input is high:

check buzzerPlaying. If it's true, do nothing.

If buzzerPlaying is false, check oldInput. If oldInput is high, do nothing (The input has not been reset.) else set buzzerPlaying to true, set oldInput to high, turn on the buzzer, and calculate buzzerOffTime.


If the buzzerPlaying == false and input is low, set oldInput to low (Once the buzzer has stopped playing and the input has dropped low, start looking for more inputs.)