如何获取mp3文件的大小和持续时间? [英] How to get the size and duration of an mp3 file?

查看:450
本文介绍了如何获取mp3文件的大小和持续时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要计算一个mp3文件的总长度.

I need to calculate the total length of an mp3 file.

当前,我正在使用一个PHP类,该类已找到@ http://www.zedwood.com/article/php-calculate-duration-of-mp3 .

Currently I am using a PHP class which I found @ http://www.zedwood.com/article/php-calculate-duration-of-mp3.

如果mp3文件位于同一服务器中,则此方法可以正常工作.

This is working perfectly if the mp3 file in same server.

但是,如果我有其他站点的URL,则会引发错误.请帮助我.

but if I have a URL from other site it throwing error. Please help me.

是否有任何JavaScript J-Query函数来获取mp3文件的长度

Is there any JavaScript J-Query function to get the length of the mp3 file

<?php include("mp3.class.php");
$f = 'http://cdn.enjoypur.vc/upload_file/5570/5738/5739/7924/Blue%20Eyes%20-%20Yo%20Yo%20Honey%20Singh%20(PagalWorld.com)%20-192Kbps%20.mp3';
$m = new mp3file($f);
$a = $m->get_metadata();

if ($a['Encoding']=='Unknown')
    echo "?";
else if ($a['Encoding']=='VBR')
    print_r($a);
else if ($a['Encoding']=='CBR')
    print_r($a);
unset($a);
?>

推荐答案

实际上有一个可以在客户端运行的库,试图获取足够多的MP3以读取ID3标签:

There is actually a library that can run at client-side, attempting to fetch just enough of the MP3 to read the ID3 tags:

http://github.com/aadsm/JavaScript-ID3-Reader

尝试

HTML文件API.

HTML File API.

查看全文

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