PHP与MP3头浏览器媒体播放器无法确定长度 [英] php with mp3 header browser media player can't determine length

查看:131
本文介绍了PHP与MP3头浏览器媒体播放器无法确定长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

test.php code:

test.php code:

$path = 'audio.mp3';

header("Content-type: audio/mpeg");
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: inline; filename="'.$path.'"');
header("Content-length: ".filesize($path));

readfile($path);

html代码:

html code:

<iframe src="test.php"></iframe>

这会将.php作为.mp3播放,但我无法访问导航浏览器媒体播放器中的滑块。我在几个不同的地方点击滑块,但什么都不会发生。当我将音源更改为audio.mp3时,我可以再次控制滑块。我很确定它与标题有关。任何想法我可以使用什么标题来解决这个问题?

this will play the .php as a .mp3, but i will not be able to access the navigation slider in the browser media player. i click on the slider in several different places, but nothing will happen. when i change the source to "audio.mp3" i am able to control the slider again. im pretty sure that it has something to do with the headers. any idea what headers i can use to fix this?

推荐答案

它实际上与所使用的浏览器和插件有关,流媒体mp3或媒体文件不应该这样做。使用许多开源且易于使用的Flash播放器,它们可以为您的服务器上的mp3文件处理缓冲,控制,显示/隐藏以及所有内容。

It actually has everything to do with what browser and plugin you are using, "streaming" mp3 or media files for that matter should not be done this way. Use any of the many open source and easy to use Flash players, they handle buffering, controls, display/hidden, and everything for you, for a mp3 file on your server.

这篇关于PHP与MP3头浏览器媒体播放器无法确定长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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