为了账号安全,请及时绑定邮箱和手机立即绑定

部分手机上duration不起作用

部分手机上duration不起作用

我写一个移动web的页面,里面有一个播放器,总时长的显示用的是vedio的duration属性,用函数将秒换算成00:00的格式,但是在测试的时候部分手机显示时长,部分手机显示00:01,部分手机显示00:NaN,当前时间用的是vedio.currentTime,也是用那个函数换算的,就一直显示正常。测试了四五部手机,苹果下显示正常,安卓里UC下部分显示不正常,这是为什么?秒数换算代码:function formatSeconds(timer){        var theTime = parseInt(timer);// 秒        var theTime1 = 0;// 分 var theTimer=0        if(theTime > 60) {           theTime1 = parseInt(theTime/60);           theTime = parseInt(theTime%60);   if(theTime1<10){theTime1="0"+theTime1;}   if(theTime<10){theTime="0"+theTime;}   theTimer=theTime1+":"+theTime; }else{ if(theTime<10){theTime="0"+theTime;} theTimer="00"+":"+theTime; } return theTimer; }插入当前时长和总时长的代码:var starttime=document.getElementById("starttime"); var timer=setInterval(function(){ starttime.innerHTML=formatSeconds(myVedio.currentTime); },500); var stoptime=document.getElementById("stoptime");        stoptime.innerHTML=formatSeconds(myVedio.duration);
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1860 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信