3

How can i play an mp3 file using jquery in website.I m using servlets or http to play a song.Also how can i calculate total time of song played.

Regards Angelina

Jesper
  • 202,709
  • 46
  • 318
  • 350
angelina
  • 111
  • 1
  • 4
  • 8
  • See this: http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript – nc3b May 27 '10 at 11:19
  • Note: jQuery is a Java*Script* library. JavaScript is something totally different from Java. I edited the tags. – Jesper May 27 '10 at 11:47

2 Answers2

3

You can add an element with your sound to the page:

var sound = $('<embed autoplay="true" height="0" width="0" />');
sound.attr('src', urlOfMyMp3);
$('body').append(sound);

Source: Embed MP3 in website

Sjoerd
  • 74,049
  • 16
  • 131
  • 175
3

Try something like jPlayer.

Nikola Kotur
  • 1,954
  • 3
  • 13
  • 15