1

我正在使用 jplayer,它会在页面加载时加载所有 mp3 文件。它不仅会减慢页面加载速度,还会占用带宽。有没有办法让 jplayer 在用户单击播放按钮后下载并播放 mp3。或者我是否必须使用可以流式传输音频文件的播放器。

4

1 回答 1

4

jPlayer中有一个预加载选项:

The jPlayer constructor option jPlayer({preload}) is used to control 
when jPlayer begins downloading new media. Some browsers will begin 
the download for the whole media when the preload option is "metadata". 

Others will require that "auto" is used. The only way to ensure 
download does not begin automatically is to use the preload option "none".

Remember that, the media may not download as it depends on the browser 
you are using. Mobile browser such as Mobile Safari on iOS 4.2 require 
a gesture before any media is downloaded or played. ie., The user must 
press a button to initiate the load or play operations the 1st time.

jPlayer-选项-预加载

或者,您可以在初始页面加载时让播放器不使用 mp3,并且仅在用户单击播放时添加它。有关将媒体加载到播放器的示例,请参阅此演示:http: //jplayer.org/latest/demo-02-jPlayerPlaylist/

于 2013-11-25T12:02:04.183 回答