Home >Backend Development >PHP Tutorial >Get the playback time of music files in php_PHP tutorial

Get the playback time of music files in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:55:21999browse

The article briefly introduces the PHP music file playback time code. Friends in need can take a closer look. // mp3, wav or other formats supported by media player.

 代码如下 复制代码
$file = "C:/Users/Public/Music/Sample Music/Kalimba.mp3";
 
if (!file_exists($file)) {
    exit('媒体文件不存在.');
}
 
// 创建一个Windows Media Player接口
$player = new COM("WMPlayer.OCX");
$media  = $player->newMedia($file);
 
// 获取歌曲时间 (单位秒)
echo $media->duration.'秒';

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631688.htmlTechArticleThe article briefly introduces the PHP music file playback time code. Friends in need can take a closer look. // mp3, wav or other formats supported by media player. The code is as follows Copy...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn