问题与iOS的HTML5音频元素的持续时间值 [英] Problem with duration value of HTML5 audio element in iOs

查看:358
本文介绍了问题与iOS的HTML5音频元素的持续时间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发iOS设备的web应用程序,但我有一个HTML5的音频标签的问题...
我设计了一个自定义的音频播放器,我管这首歌用JavaScript函数。
Safari浏览器的桌面应用程序运作良好,但在Safari移动不承认的音频的持续时间;持续时间属性的值是NaN。
我要玩,停止和回放音频检索正确的值。
可能的原因是,媒体preLOAD是在移动Safari浏览器禁用了...
有没有一种方法来读取第一枪正确的价值?

I'm developing a web app for iOs device, but I have a problem with the html5 audio tag... I designed a custom audio player, and I control the song with javascript functions. With safari desktop the app works well, but on safari mobile it doesn't recognize the duration of the audio; the value of the duration property is NaN. I have to play, stop and replay the audio for retrieve the correct value. Probably the cause is that the media preload is disabled on safari mobile... Is there a way to read the correct value at the first shot?

推荐答案

该medata可用此事件后,已触发:

The medata is available after this event has fired:

 loadedmetadata

更多信息

https://developer.mozilla.org/en/Introducing_the_Audio_API_Extension

这篇关于问题与iOS的HTML5音频元素的持续时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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