我如何在Cakephp中检索和播放音频文件 [英] How I can retrieve and play audio file in cakephp
问题描述
我正在使用cakephp应用程序上传音频文件.我可以将文件成功移动到文件夹,也可以更新其在数据库中的路径.但是我无法成功检索该文件.服务器以206 Partial Content
答复,有时以304 Not Modified
状态答复.谁能帮我弄清楚为什么服务器responseig处于这种状态?
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,铬和Firefox均不支持Mp3.您可以将mp3
转换为ogg
以在铬和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屋!