在客户端,供以后使用$ P $对 - 负载的音频文件 [英] Pre-load audio files at the client-side for later use

查看:239
本文介绍了在客户端,供以后使用$ P $对 - 负载的音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立使用本机的音频播放器的在线测试,它实现音频(MP3)(的非基于Flash的)。

I'm building an online test which implements audio (mp3) using the native audio player (i.e. non Flash-based).

测试显示的时间和负载一个问题,每一个后续的问题是异步的。

The test shows one question at a time and loads each subsequent question asynchronously.

一些问题有一个附带的音频文件,别人不和音频文件的大小可以为几MB。

Some questions have an accompanying audio file, others don't, and the audio files can be several MB in size.

那么,我希望做的是preLOAD的音频文件,客户端在测试开始,然后移动到这些地方,当相关的问题来了。

So what I'm hoping to do is to preload the audio files client-side at the start of the test and then move these into place when the relevant question comes up.

到目前为止,我已经试过加载音频文件到QuickTime播放器,那么当这个问题出现我使用jQuery的克隆(真)方法将它复制到其中显示网页的一部分。然而,当我这样做的QuickTime播放器必须重新从源的音频文件。同样适用于Windows Media Player的事实。

So far I've tried loading an audio file into a QuickTime player, then when that question comes up I use jQuery's clone(true) method to copy this into a part of the page which is displayed. However, when I do this the QuickTime player has to reload the audio file from source. Same is true for Windows Media Player.

有没有人有任何建议,我怎么能preLOAD音频客户端,然后在需要的时候向前称呼呢?

Does anyone have any suggestions as to how I can preload the audio client-side and then call it forward when needed?

推荐答案

你需要做的,我认为是什么让你的手,像的 jPlayer SoundManager类然后阿贾克斯之类的函数这preLOAD音频:

what you need to do I think is to get your hands on something like jPlayer or soundmanager and then ajax function like this to preload the audio:

$(document).ready(function() {
    $.ajax({
        url: "soundfile.mp3",
        success: function() {
            $("#play_button").show();
        }
    });
});

这篇关于在客户端,供以后使用$ P $对 - 负载的音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆