I’m having issue on playing audio in asp.net. I have
@if (ViewBag.First != null && ViewBag.First)
{
<audio id="welcome" autoplay="autoplay">
<source src="~/asset/audio/site-music/site-music.mp3" type="audio/mpeg" />
</audio>
}
What is happening now is,
Scenario | Condition | Expected result | Actual Result |
---|---|---|---|
When I start project(clear all cookies) | I’m new visitor | Should Play | Fail |
clear all cookies on the same page and reload | I’m new visitor | Should Play | Fail |
clear all cookies navigate to different page and back to this page. | I’m new visitor | Should Play | Pass |
Cookie are stored, navigated to different page already and back to this page. | I’m not a new visitor | Shouldn’t Play | Pass |
I’m having doubts that whether it will play when I deploy the with changes or not. Here, I have just added one condition, if its first visit then only play audio. Otherwise don’t play audio again and again. When condition doesn’t match. It doesn’t even load the audio element. But when it is loaded it should play which is not working.