I understand how to use embed in html,
My problem is that i need to arrange my music in such a way,that they will be played
with only one player.
Example:1<EMBED SRC="rtggfg.mid" HIDDEN="true" AUTOSTART="true"
STARTTIME="00:10" ENDTIME="00:30">

2<EMBED SRC="adsdsd.mid" HIDDEN="true" AUTOSTART="true"
STARTTIME="00:10" ENDTIME="00:30">

3<EMBED SRC="aladdin.mid" HIDDEN="true" AUTOSTART="true"
STARTTIME="00:10" ENDTIME="00:30">
This will give me three players,
Now i want to do in such a way that they will be played with only one player,
even for Clips.
I hope you will help me in solving this problem.

Dani AI

Generated

A concise, modern solution: drive a single HTML5 audio element with JavaScript and switch or seek between clips. That addresses the multiple-embed problem described and keeps one player on the page. ’s JW/Flash suggestion worked historically, but Flash is deprecated now — prefer HTML5 or the Web Audio API for precise clipping and scheduling.

Example pattern (one audio element, array of clips with start/end in seconds):

var clips = [
  { src: 'track1.mp3', start: 10, end: 30 },
  { src: 'track2.mp3', start: 10, end: 30 },
  { src: 'track3.mp3', start: 10, end: 30 }
];

var player = document.getElementById('player');

function playClip(i) {
  if (i >= clips.length) return;
  var clip = clips[i];

  player.src = clip.src;
  player.load();

  function onMeta() {
    player.currentTime = clip.start;
    player.play();
    player.removeEventListener('loadedmetadata', onMeta);
  }
  player.addEventListener('loadedmetadata', onMeta);

  function onTime() {
    if (player.currentTime >= clip.end) {
      player.removeEventListener('timeupdate', onTime);
      playClip(i + 1);
    }
  }
  player.addEventListener('timeupdate', onTime);
}

// start after a user gesture to satisfy autoplay rules
document.getElementById('startBtn').addEventListener('click', function() {
  playClip(0);
});

Troubleshooting & tips:

  • Modern browsers block autoplay; require a user gesture to start playback (Autoplay guide).
  • Many browsers don’t reliably play raw .mid files — convert to MP3/OGG or use a MIDI library like MIDI.js or Web MIDI for synthesis.
  • For exact timing or many short clips, consider an audio-sprite (one concatenated file) and seek by offsets, or use the Web Audio API for sample-accurate scheduling.
  • Watch CORS and correct MIME types on the server when loading external audio (HTMLAudioElement).

This approach keeps a single player visible/hidden as you prefer, avoids multiple embed tags, and works across modern browsers when audio formats and user-gesture rules are handled.

Recommended Answers

All 2 Replies

The simplest solution I've found, and many others since it seemed to spread across the web like wildfire, is the . It is a flash based media player with an external javascript API. Incredibly easy to use, there are a ton of tutorials and a pretty thorough tutorial within the package itself. That should get you off and running pretty quickly.

thankx it helped a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.