简体   繁体   English

带有播放列表的jPlayer:有什么预加载方式吗?

[英]jPlayer with Playlist: Any way to preload?

Suppose I have a sound file "ding" and a couple of other sound files (s1, s2, s3, ...). 假设我有一个声音文件“ ding”和几个其他声音文件(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". 也就是说,如果按下了按钮1,我想听到一个序列“ ding”和“ s1”。

If Button 2 is pressed before ["ding", "s1"] is done playing, I would like to stop the current playback and begin ["ding", "s2"]. 如果在完成[“ ding”,“ s1”]播放之前按了按钮2,我想停止当前播放并开始[“ ding”,“ s2”]。

Currently, I've achieved this with jPlayer's playlist add-on. 目前,我已经通过jPlayer的播放列表插件实现了这一目标。 I simply set the playlist to ["ding", "s1"] and it plays. 我只需将播放列表设置为[“ ding”,“ s1”]即可播放。 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. 问题是jPlayer直到播放“ ding”都没有开始下载s1,因此用户听到“ ding”和s1之间可能有很长的暂停。

Additional info : 附加信息

  • There are only 5 of these sound clips, all of which are very short (few seconds of voice). 这些声音剪辑只有5个,它们都很短(几秒钟的声音)。

  • Flash fallback is important. 闪存回退很重要。

Questions : 问题

  1. What would be the best way to set this up to minimize the delay (if any) between "ding" and "s1"? 设置此设置以最小化“ ding”和“ 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? 我是每个声音都有.mp3和.ogg的最佳人选还是应该使用其他格式的混合? Goal is compatibility, but the size matters too. 目标是兼容性,但大小也很重要。

  3. Do you recommend using HTML5 as a primary and Flash as a fallback? 您是否建议将HTML5用作主要内容,并将Flash用作后备内容?

Thanks :-) 谢谢 :-)

  1. you will need a separate jPlayer instance with the preload:auto constructor option set for each sound you want preloaded. 您将需要一个单独的jPlayer实例,并为每个要预加载的声音设置preload:auto构造函数选项。 The jPlaylist add-on will not preload the files in its playlist in advance. jPlaylist加载项不会预先将文件预加载到其播放列表中。
  2. the more different formats you supply to jPlayer, the more compatibility you gain. 提供给jPlayer的格式越多,您获得的兼容性就越多。 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. 通常,可以,但可以进行实验:首先在jPlayer构造函数选项中尝试solution: "html, flash"然后solution: "flash, html"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM