开发者

Is there a way to get the progress of an mp3 download on the ipad?

开发者 https://www.devze.com 2023-04-11 02:46 出处:网络
We are developing a Javascript web app for the Ipad that requires sounds to be preloaded before it loads. We don\'t know what sounds the user needs until they click on an exercise and then they need m

We are developing a Javascript web app for the Ipad that requires sounds to be preloaded before it loads. We don't know what sounds the user needs until they click on an exercise and then they need multiple sounds to be preloaded before the exercise starts.

I am aware there is no preload method, and that the download needs to be bound to a direct tap / click event. We have spent a considerable amount of time trying many combinations of adding media elements dynamically on every click (loaded with dummy sounds) and then trying to swap them with the mp3's we need at the time.

We have given up on that approach and thought we could just join the sounds into one file and move the play head to the desired ranges (contained in a JSON file). We got this working successfully on the desktop but we can't do it on the Ipad because we don't know when the sound is completely downloaded.

Even after the user initiates the sound to be played, the device has no method for checking when the sound is fully downloaded. In fact, it doesn't download the whole file unless it is playing. What we have discovered is that we can not consistently get the duration unless the play head has reached the end in a linear fashion. We have tried to check the buffered.start() and buffered.end() properties against our own duration (we have the JSON file with all the times) but as soon as we try and set audioElement.currentTime and stopTime, it just plays the whole sound from beginning to end.

We have found that the seekable prope开发者_如何学JAVArty to be unreliable as well.

We are now working with ios5 and I believe that older versions work differently in regards to the duration property.

Has anyone been able to get this working?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号