javascript - 如何在没有任何外部软件的情况下在php中获取html5视频的观看时间?

标签 javascript php html html5-video

<video id='myVideo' controls autoplay>
    <source src='a.mp4#t=00:00:00' type=video/mp4>
</video>

如何在 php 中获取 html5 视频的观看时间并将其存储到 php 变量中,而无需任何外部软件?

最佳答案

如果我收到您的问题,您想知道视频开始后耗时。解决办法在这里

$(document).ready(function(){
      $("#myvideo").on(
        "timeupdate", 
        function(event){
          onTrackedVideoFrame(this.currentTime, this.duration);
        });
    });

    function onTrackedVideoFrame(currentTime, duration){
        /* Here you can get both currentTIme and duration */
    }

关于javascript - 如何在没有任何外部软件的情况下在php中获取html5视频的观看时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49333077/

相关文章:

javascript - 我将如何以用户使用 Redux 编写的状态存储文本?

javascript - IDB交易 : onabort vs onerror

javascript - 包装 Ant-Design 表单组件

javascript - 如何使用 javascript 创建的元素作为 jQuery 选择器?

javascript - 我对事件函数中的参数感到困惑

javascript - AJAX请求JSON有两种方式

php - 当Composer尝试解决依赖关系时崩溃

php - 在php中将数据导出到csv文件

html - 自动设置 iframe 高度

php - exec中的ffmpeg PHP变量不起作用