Pavel
Pavel

Reputation: 5662

jPlayer with Playlist: Any way to preload?

Suppose I have a sound file "ding" and a couple of other sound files (s1, s2, s3, ...). They are each to be played after the "ding". That is, if Button 1 is pressed, I'd like to hear a sequence of "ding" followed by "s1".

If Button 2 is pressed before ["ding", "s1"] is done playing, I would like to stop the current playback and begin ["ding", "s2"].

Currently, I've achieved this with jPlayer's playlist add-on. I simply set the playlist to ["ding", "s1"] and it plays. Life is good. Well, almost.

Problem is that jPlayer doesn't even begin downloading s1 until "ding" is done playing, so the user hears a potentially long pause between "ding" and s1.

Additional info:

Questions:

  1. What would be the best way to set this up to minimize the delay (if any) between "ding" and "s1"? Should I even use the "playlist" add-on for this?

  2. Am I in the best spot to have .mp3 and .ogg for each sound, or should I use a different mix of formats? Goal is compatibility, but the size matters too.

  3. Do you recommend using HTML5 as a primary and Flash as a fallback?

Thanks :-)

Upvotes: 1

Views: 1255

Answers (1)

Lloyd
Lloyd

Reputation: 8396

  1. you will need a separate jPlayer instance with the preload:auto constructor option set for each sound you want preloaded. The jPlaylist add-on will not preload the files in its playlist in advance.
  2. the more different formats you supply to jPlayer, the more compatibility you gain. Here is a good list showing which browsers support which audio. Target the audio formats supported by your target browsers.
  3. Generally, yes but experiment: first try solution: "html, flash" then solution: "flash, html" in your jPlayer constructor options.

Upvotes: 1

Related Questions