HTML5 audio cross-browser compatibility

I work for a company and am trying to create a new demo page. I'd love to go down to the page so it doesn't work for sure, but unfortunately it's tied to a lot of scripts on my server as well as AJAX requests that need to go to the same domain name. I will report what is happening as soon as possible.

Basically, my session code works almost as expected. This is not where the problems lie. The problem is that the sound played after clicking Say It works as expected in Chrome, but firefox only plays the first audio recording, even after subsequent ones with different text, and nothing plays in Internet Explorer. The relevant code is in the main section, where a group of three functions controls everything that happens. formSubmit () is called when the "Say It" button is clicked, onAudioLoad () is called after the sound has been loaded, and limitText () does, well, this limits the number of text messages that can be inserted.

This is how formSumbmit () sends an AJAX request to my server script that returns one of two things:

1) HTML5 HTML tag with original elements with correct src attributes or 2) p element saying your session has expired.

I'm just trying to play sound without the horrible echo (which may or may not be caused by the actual mp3 / ogg conversion software) and get it to work as expected in all browsers.

onAudioLoad sends an audio removal request to avoid stealing our product too easily: D

Expected Behavior:

Regardless of the text present in the demo text area, the server name will be sent for synthesis, and then the sound will be played through the client's speakers.

If you have any further questions, I will check them periodically.

Here is the demo url:

http://www.cepstral.com/demos/temp/cepstral_tts_demo.php

Thanks for any help.

Final question:

Why does this work in Chrome but not Firefox 11 and IE9?

In firefox, it will only play the first sound request.

In IE9, no sound is played.

I know that sound will never be safe. We're just trying to make it more difficult for regular users.

+3


source to share


1 answer


After you figured out what was happening in the chat ( transcript ) too , I came to the following conclusion: this is a caching problem.

When trying to change the text in FF and requesting a new sound file, it still plays the old sound. Checking the requests and responses, it looks like you always respond with the same name (for the audio file), although the sound itself is different.

By loading that sound file, or opening it in a new tab and refreshing it without cache, it plays the correct sound (with new text), so I am confident about caching.

You should find a way to return unique filenames for different texts so that the browser doesn't play cached versions.



The same applies when testing on IE on my machine.

EDIT OP

Would like to add that the reason it didn't work in my IE is because I am using Windows 7 N. The release notes for IE9 indicate that Windows 7 N requires special updates to play HTML5 videos. They don't mention HTML5 audio, but I suppose this is the problem.

+2


source







All Articles