HTML5 audio duration issue

本秂侑毒 提交于 2019-11-28 12:55:52

问题


I am using jplayer to play audio and video files in Ipad, But the issue is if i change video or audio url, sometimes i get duration NaN.

Please help me.


回答1:


The medata is available after onloadedmetadata event has fired.

(c) https://stackoverflow.com/a/7275714/492641

Hope it helps.




回答2:


Check your server has Range requests enabled.

From this page on the Jplayer site:

Your server must enable Range requests. This is easy to check for by seeing if your server's response includes the Accept-Ranges in its header. Most HTML5 browsers enable seeking to new file positions during a download, so the server must allow the new Range to be requested.

Failure to accept byte Range requests will cause problems on some HTML5 browsers. Often the duration cannot be read from the file as some formats require that the start and end of the file is read to know its duration. Chrome tends to be the browser that has most problems if the Range request is not enabled on the server, but all browsers will have some issue even if it is only that you have to wait for all the media to load before jumping close to the end.



来源:https://stackoverflow.com/questions/10101446/html5-audio-duration-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!