簡體   English   中英

Apache,CentOS,Kloxo和ogg模仿類型

[英]Apache, CentOS, Kloxo and ogg mimetype

幾個小時后嘗試解決問題,我想我瘋了:S

我的網站上有ogg聲音,該聲音在本地(XAMPP的Apache)上運行良好,但是即使在我的.htaccess文件中,我都有所有的mimetypes(音頻/ ogg ogg)和(應用程序/ ogg ogg)。

這是我在本地工作的標頭:

Request URL:http://127.0.0.1/bass.ogg
Request Method:GET
Status Code:206 Partial Content
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:identity;q=1, *;q=0
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:PHPSESSID=08e4d19b19720f0a5491c20a7bba20c7
Host:127.0.0.1
Range:bytes=0-
Referer:http://127.0.0.1/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22
Response Headersview source
Accept-Ranges:bytes
Cache-Control:max-age=2592000
Connection:Keep-Alive
Content-Length:59290
Content-Range:bytes 0-59289/59290
Content-Type:audio/ogg
Date:Fri, 15 Mar 2013 08:58:14 GMT
Expires:Sun, 14 Apr 2013 08:58:14 GMT
Keep-Alive:timeout=5, max=98
Last-Modified:Sat, 09 Mar 2013 14:23:45 GMT
Server:Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1

這是我在VPS上獲得的標頭(不起作用):

Request URL:http://www.mysite.com/jazz.ogg
Request Headersview source
Accept-Encoding:identity;q=1, *;q=0
Cache-Control:max-age=0
Range:bytes=0-
Referer:http://www.mysicians.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22

希望您能幫到我,讓我終於可以睡個好覺:)謝謝

我自己找到了一個解決方案,希望對您有所幫助。

像您一樣,在我的本地服務器Wamp上一切正常。 問題出在我使用Apache的VPS上。 在我的.htaccess文件中添加以下幾行后(第1行對於ogg擴展名就足夠了):

AddType audio/ogg .oga
AddType video/ogg .ogv .ogg
AddType video/webm .webm
AddType video/mp4 .mp4

我在使用谷歌瀏覽器時仍然遇到問題,可以在Firefox,Internet Explorer,Safari和Chrome中播放聲音。 我搜索了幾個小時卻找不到解決方案。 它可能與編解碼器有關,但我不確定。

最后,我通過調用適當播放聲音的遠距離源解決了該錯誤。

以不同來源的html5為例,以確保聲音在所有瀏覽器中都能播放:

<audio id="sound">
  <source src="sound.wav" />
  <source src="http://www.another-website.com/sound.mp3" />
  <source src="sound.mp3" />
  <source src="sound.ogg" />
  <embed  src="sound.mp3"></embed>
</audio>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM