如何在 cakephp 中检索和播放音频文件 [英] How I can retrieve and play audio file in cakephp
问题描述
我正在使用 cakephp 应用上传音频文件.我可以成功地将文件移动到文件夹,也可以更新它在数据库中的路径.但我无法成功检索该文件.服务器以 206 Partial Content
回复,有时以 304 Not Modified
状态回复.谁能帮我弄清楚为什么服务器响应这种状态?
I am uploading audio files using cakephp app. I can move file successfully to folder and can update its path in database too. But I can not retrive that file successfully. server reply with 206 Partial Content
AND some times with 304 Not Modified
status. can anyone help me to figure out why server respondig with such status?
推荐答案
您正在使用铬.ubuntu 的chrome 和firefox 都不支持Mp3.您可以将 mp3
转换为 ogg
以在 Chrome 和 firefox 中播放它们.或者,如果您不想将 mp3 转换为 ogg,也可以安装 chrome.如果你想转换它们,你可以用这个shell脚本来做
You are using chromium. Mp3 is not supported in both chromium and firefox for ubuntu. You can convert mp3
to ogg
to play them in chromium and firefox. Or you can install chrome if you don't want to convert mp3 to ogg. If you want to convert them, you can do it with this shell script
#!/bin/bash
echo "The script convert mp3->ogg or ogg->mp3.";
echo "The script takes one parameter: ";
echo "[mp3ogg] - converting mp3->ogg";
echo "[oggmp3] - converting ogg->mp3";
if [ "$1" = "" ]; then
echo "";
echo "Argument does not exist!!!";
exit 102;
fi
if [ "$1" = "mp3ogg" ]; then
for file in *.mp3; do
avconv -i "$file" "`echo '../ogg/'${file%.mp3}.ogg`";
done
exit 0;
fi
if [ "$1" = "oggmp3" ]; then
for file in *.ogg; do
avconv -i "$file" -acodec libmp3lame "`echo ${file%.ogg}.mp3`";
done
exit 0;
fi
exit 104;
但你唯一的问题是chrome和firefox不支持mp3,它们在ubuntu中只支持ogg.
But you only problem is that chromium and firefox will not support mp3, they will support only ogg in ubuntu.
这篇关于如何在 cakephp 中检索和播放音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!