Ronophobia
Ronophobia

Reputation: 349

IE8 error for .play() method

I wrote some code for playing a .mp3 file on my page. It works on FF and Chrome.

JS

aSound = document.createElement("audio");
aSound.setAttribute("src", "content/audio/gameIntro.mp3");
aSound.play();

However, IE8 displays this error: Object doesn't support this property or method for the 3rd line of code,that is, aSound.play();. What can I do to solve this error?

Upvotes: 0

Views: 497

Answers (2)

Gourav khanna
Gourav khanna

Reputation: 79

Only latest version of IE support audio video support as of now. So you need to upgrade you browser to write your HTML5 code.

Upvotes: 0

Joseph
Joseph

Reputation: 119867

Because IE 8 has no support for the audio element. You can fall back to Flash if you want some audio happening on your page.

Upvotes: 2

Related Questions