Zur Navigation

Welchen Content-Type für mp3 und m3u

1 Anonym (Gast)

Hallo,

ich würde gerne wissen welchen Content-Type ich für die Ausgabe einer mp3-Datei und einer m3u-Datei (einzeln) benutzen sollte.
Für mp3 hab ich bis jetzt "audio/mpeg" gefunden, jedoch weiß ich noch nicht, was ich für m3u übermitteln muss.

Hoffe das weiß jemand von euch ;)

26.06.2012 16:06

2 Jörg

In der Datei /etc/mime.types meines Linux-Systems ist m3u dem Mime-Typ audio/mpegurl zugeordnet

26.06.2012 16:11

3 Rudy

Ich verwende sehr lange schon eine Include-Datei für die Mime-Types, die ich mal von w3schools konvertiert habe. Gerne poste ich sie hier.
Darin ist m3u als audio/x-mpegurl vorgeschlagen.

<?php

//http://www.w3schools.com/media/media_mimeref.asp
switch($extension) {
  case '323'    : $mimetype = 'text/h323'; break; 
  case 'acx'    : $mimetype = 'application/internet-property-stream'; break; 
  case 'ai'     : $mimetype = 'application/postscript'; break; 
  case 'aif'    : $mimetype = 'audio/x-aiff'; break; 
  case 'aifc'   : $mimetype = 'audio/x-aiff'; break; 
  case 'aiff'   : $mimetype = 'audio/x-aiff'; break; 
  case 'asf'    : $mimetype = 'video/x-ms-asf'; break; 
  case 'asr'    : $mimetype = 'video/x-ms-asf'; break; 
  case 'asx'    : $mimetype = 'video/x-ms-asf'; break; 
  case 'au'     : $mimetype = 'audio/basic'; break; 
  case 'avi'    : $mimetype = 'video/x-msvideo'; break; 
  case 'axs'    : $mimetype = 'application/olescript'; break; 
  case 'bas'    : $mimetype = 'text/plain'; break; 
  case 'bcpio'  : $mimetype = 'application/x-bcpio'; break; 
  case 'bin'    : $mimetype = 'application/octet-stream'; break; 
  case 'bmp'    : $mimetype = 'image/bmp'; break; 
  case 'c'      : $mimetype = 'text/plain'; break; 
  case 'cat'    : $mimetype = 'application/vnd.ms-pkiseccat'; break; 
  case 'cdf'    : $mimetype = 'application/x-cdf'; break; 
  case 'cer'    : $mimetype = 'application/x-x509-ca-cert'; break; 
  case 'class'  : $mimetype = 'application/octet-stream'; break; 
  case 'clp'    : $mimetype = 'application/x-msclip'; break; 
  case 'cmx'    : $mimetype = 'image/x-cmx'; break; 
  case 'cod'    : $mimetype = 'image/cis-cod'; break; 
  case 'cpio'   : $mimetype = 'application/x-cpio'; break; 
  case 'crd'    : $mimetype = 'application/x-mscardfile'; break; 
  case 'crl'    : $mimetype = 'application/pkix-crl'; break; 
  case 'crt'    : $mimetype = 'application/x-x509-ca-cert'; break; 
  case 'csh'    : $mimetype = 'application/x-csh'; break; 
  case 'css'    : $mimetype = 'text/css'; break; 
  case 'dcr'    : $mimetype = 'application/x-director'; break; 
  case 'der'    : $mimetype = 'application/x-x509-ca-cert'; break; 
  case 'dir'    : $mimetype = 'application/x-director'; break; 
  case 'dll'    : $mimetype = 'application/x-msdownload'; break; 
  case 'dms'    : $mimetype = 'application/octet-stream'; break; 
  case 'doc'    : $mimetype = 'application/msword'; break; 
  case 'dot'    : $mimetype = 'application/msword'; break; 
  case 'dvi'    : $mimetype = 'application/x-dvi'; break; 
  case 'dxr'    : $mimetype = 'application/x-director'; break; 
  case 'eps'    : $mimetype = 'application/postscript'; break; 
  case 'etx'    : $mimetype = 'text/x-setext'; break; 
  case 'evy'    : $mimetype = 'application/envoy'; break; 
  case 'exe'    : $mimetype = 'application/octet-stream'; break; 
  case 'fif'    : $mimetype = 'application/fractals'; break; 
  case 'flr'    : $mimetype = 'x-world/x-vrml'; break; 
  case 'gif'    : $mimetype = 'image/gif'; break; 
  case 'gtar'   : $mimetype = 'application/x-gtar'; break; 
  case 'gz'     : $mimetype = 'application/x-gzip'; break; 
  case 'h'      : $mimetype = 'text/plain'; break; 
  case 'hdf'    : $mimetype = 'application/x-hdf'; break; 
  case 'hlp'    : $mimetype = 'application/winhlp'; break; 
  case 'hqx'    : $mimetype = 'application/mac-binhex40'; break; 
  case 'hta'    : $mimetype = 'application/hta'; break; 
  case 'htc'    : $mimetype = 'text/x-component'; break; 
  case 'htm'    : $mimetype = 'text/html'; break; 
  case 'html'   : $mimetype = 'text/html'; break; 
  case 'htt'    : $mimetype = 'text/webviewhtml'; break; 
  case 'ico'    : $mimetype = 'image/x-icon'; break; 
  case 'ief'    : $mimetype = 'image/ief'; break; 
  case 'iii'    : $mimetype = 'application/x-iphone'; break; 
  case 'ins'    : $mimetype = 'application/x-internet-signup'; break; 
  case 'isp'    : $mimetype = 'application/x-internet-signup'; break; 
  case 'jfif'   : $mimetype = 'image/pipeg'; break; 
  case 'jpe'    : $mimetype = 'image/jpeg'; break; 
  case 'jpeg'   : $mimetype = 'image/jpeg'; break; 
  case 'jpg'    : $mimetype = 'image/jpeg'; break; 
  case 'js'     : $mimetype = 'application/x-javascript'; break; 
  case 'latex'  : $mimetype = 'application/x-latex'; break; 
  case 'lha'    : $mimetype = 'application/octet-stream'; break; 
  case 'lsf'    : $mimetype = 'video/x-la-asf'; break; 
  case 'lsx'    : $mimetype = 'video/x-la-asf'; break; 
  case 'lzh'    : $mimetype = 'application/octet-stream'; break; 
  case 'm13'    : $mimetype = 'application/x-msmediaview'; break; 
  case 'm14'    : $mimetype = 'application/x-msmediaview'; break; 
  case 'm3u'    : $mimetype = 'audio/x-mpegurl'; break; 
  case 'man'    : $mimetype = 'application/x-troff-man'; break; 
  case 'mdb'    : $mimetype = 'application/x-msaccess'; break; 
  case 'me'     : $mimetype = 'application/x-troff-me'; break; 
  case 'mht'    : $mimetype = 'message/rfc822'; break; 
  case 'mhtml'  : $mimetype = 'message/rfc822'; break; 
  case 'mid'    : $mimetype = 'audio/mid'; break; 
  case 'mny'    : $mimetype = 'application/x-msmoney'; break; 
  case 'mov'    : $mimetype = 'video/quicktime'; break; 
  case 'movie'  : $mimetype = 'video/x-sgi-movie'; break; 
  case 'mp2'    : $mimetype = 'video/mpeg'; break; 
  case 'mp3'    : $mimetype = 'audio/mpeg'; break; 
  case 'mpa'    : $mimetype = 'video/mpeg'; break; 
  case 'mpe'    : $mimetype = 'video/mpeg'; break; 
  case 'mpeg'   : $mimetype = 'video/mpeg'; break; 
  case 'mpg'    : $mimetype = 'video/mpeg'; break; 
  case 'mpp'    : $mimetype = 'application/vnd.ms-project'; break; 
  case 'mpv2'   : $mimetype = 'video/mpeg'; break; 
  case 'ms'     : $mimetype = 'application/x-troff-ms'; break; 
  case 'mvb'    : $mimetype = 'application/x-msmediaview'; break; 
  case 'nws'    : $mimetype = 'message/rfc822'; break; 
  case 'oda'    : $mimetype = 'application/oda'; break; 
  case 'p10'    : $mimetype = 'application/pkcs10'; break; 
  case 'p12'    : $mimetype = 'application/x-pkcs12'; break; 
  case 'p7b'    : $mimetype = 'application/x-pkcs7-certificates'; break; 
  case 'p7c'    : $mimetype = 'application/x-pkcs7-mime'; break; 
  case 'p7m'    : $mimetype = 'application/x-pkcs7-mime'; break; 
  case 'p7r'    : $mimetype = 'application/x-pkcs7-certreqresp'; break; 
  case 'p7s'    : $mimetype = 'application/x-pkcs7-signature'; break; 
  case 'pbm'    : $mimetype = 'image/x-portable-bitmap'; break; 
  case 'pdf'    : $mimetype = 'application/pdf'; break; 
  case 'pfx'    : $mimetype = 'application/x-pkcs12'; break; 
  case 'pgm'    : $mimetype = 'image/x-portable-graymap'; break; 
  case 'pko'    : $mimetype = 'application/ynd.ms-pkipko'; break; 
  case 'pma'    : $mimetype = 'application/x-perfmon'; break; 
  case 'pmc'    : $mimetype = 'application/x-perfmon'; break; 
  case 'pml'    : $mimetype = 'application/x-perfmon'; break; 
  case 'pmr'    : $mimetype = 'application/x-perfmon'; break; 
  case 'pmw'    : $mimetype = 'application/x-perfmon'; break; 
  case 'pnm'    : $mimetype = 'image/x-portable-anymap'; break; 
  case 'pot,'   : $mimetype = 'application/vnd.ms-powerpoint'; break; 
  case 'ppm'    : $mimetype = 'image/x-portable-pixmap'; break; 
  case 'pps'    : $mimetype = 'application/vnd.ms-powerpoint'; break; 
  case 'ppt'    : $mimetype = 'application/vnd.ms-powerpoint'; break; 
  case 'prf'    : $mimetype = 'application/pics-rules'; break; 
  case 'ps'     : $mimetype = 'application/postscript'; break; 
  case 'pub'    : $mimetype = 'application/x-mspublisher'; break; 
  case 'qt'     : $mimetype = 'video/quicktime'; break; 
  case 'ra'     : $mimetype = 'audio/x-pn-realaudio'; break; 
  case 'ram'    : $mimetype = 'audio/x-pn-realaudio'; break; 
  case 'ras'    : $mimetype = 'image/x-cmu-raster'; break; 
  case 'rgb'    : $mimetype = 'image/x-rgb'; break; 
  case 'rmi'    : $mimetype = 'audio/mid'; break; 
  case 'roff'   : $mimetype = 'application/x-troff'; break; 
  case 'rtf'    : $mimetype = 'application/rtf'; break; 
  case 'rtx'    : $mimetype = 'text/richtext'; break; 
  case 'scd'    : $mimetype = 'application/x-msschedule'; break; 
  case 'sct'    : $mimetype = 'text/scriptlet'; break; 
  case 'setpay' : $mimetype = 'application/set-payment-initiation'; break; 
  case 'setreg' : $mimetype = 'application/set-registration-initiation'; break; 
  case 'sh'     : $mimetype = 'application/x-sh'; break; 
  case 'shar'   : $mimetype = 'application/x-shar'; break; 
  case 'sit'    : $mimetype = 'application/x-stuffit'; break; 
  case 'snd'    : $mimetype = 'audio/basic'; break; 
  case 'spc'    : $mimetype = 'application/x-pkcs7-certificates'; break; 
  case 'spl'    : $mimetype = 'application/futuresplash'; break; 
  case 'src'    : $mimetype = 'application/x-wais-source'; break; 
  case 'sst'    : $mimetype = 'application/vnd.ms-pkicertstore'; break; 
  case 'stl'    : $mimetype = 'application/vnd.ms-pkistl'; break; 
  case 'stm'    : $mimetype = 'text/html'; break; 
  case 'sv4cpio': $mimetype = 'application/x-sv4cpio'; break; 
  case 'sv4crc' : $mimetype = 'application/x-sv4crc'; break; 
  case 'svg'    : $mimetype = 'image/svg+xml'; break; 
  case 'swf'    : $mimetype = 'application/x-shockwave-flash'; break; 
  case 't'      : $mimetype = 'application/x-troff'; break; 
  case 'tar'    : $mimetype = 'application/x-tar'; break; 
  case 'tcl'    : $mimetype = 'application/x-tcl'; break; 
  case 'tex'    : $mimetype = 'application/x-tex'; break; 
  case 'texi'   : $mimetype = 'application/x-texinfo'; break; 
  case 'texinfo': $mimetype = 'application/x-texinfo'; break; 
  case 'tgz'    : $mimetype = 'application/x-compressed'; break; 
  case 'tif'    : $mimetype = 'image/tiff'; break; 
  case 'tiff'   : $mimetype = 'image/tiff'; break; 
  case 'tr'     : $mimetype = 'application/x-troff'; break; 
  case 'trm'    : $mimetype = 'application/x-msterminal'; break; 
  case 'tsv'    : $mimetype = 'text/tab-separated-values'; break; 
  case 'txt'    : $mimetype = 'text/plain'; break; 
  case 'uls'    : $mimetype = 'text/iuls'; break; 
  case 'ustar'  : $mimetype = 'application/x-ustar'; break; 
  case 'vcf'    : $mimetype = 'text/x-vcard'; break; 
  case 'vrml'   : $mimetype = 'x-world/x-vrml'; break; 
  case 'wav'    : $mimetype = 'audio/x-wav'; break; 
  case 'wcm'    : $mimetype = 'application/vnd.ms-works'; break; 
  case 'wdb'    : $mimetype = 'application/vnd.ms-works'; break; 
  case 'wks'    : $mimetype = 'application/vnd.ms-works'; break; 
  case 'wmf'    : $mimetype = 'application/x-msmetafile'; break; 
  case 'wps'    : $mimetype = 'application/vnd.ms-works'; break; 
  case 'wri'    : $mimetype = 'application/x-mswrite'; break; 
  case 'wrl'    : $mimetype = 'x-world/x-vrml'; break; 
  case 'wrz'    : $mimetype = 'x-world/x-vrml'; break; 
  case 'xaf'    : $mimetype = 'x-world/x-vrml'; break; 
  case 'xbm'    : $mimetype = 'image/x-xbitmap'; break; 
  case 'xla'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xlc'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xlm'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xls'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xlt'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xlw'    : $mimetype = 'application/vnd.ms-excel'; break; 
  case 'xof'    : $mimetype = 'x-world/x-vrml'; break; 
  case 'xpm'    : $mimetype = 'image/x-xpixmap'; break; 
  case 'xwd'    : $mimetype = 'image/x-xwindowdump'; break; 
  case 'z'      : $mimetype = 'application/x-compress'; break; 
  case 'zip'    : $mimetype = 'application/zip'; break; 
  default       : $mimetype = 'application/octet-stream'; break; 
}  

Update:

ich habe bei einem Webradiosender eine .m3u aufgerufen, Firefox + Livehttpheaders bestätigt die vorherige Annahme:

HTTP/1.1 200 OK
Date: Tue, 26 Jun 2012 19:10:07 GMT
Server: Apache
Last-Modified: Sun, 24 Jun 2012 15:49:20 GMT
Etag: "10f4005-2e0-4c339cefbc000"
Accept-Ranges: bytes
Content-Length: 736
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: audio/x-mpegurl

26.06.2012 21:01 | geändert: 26.06.2012 21:13

1 Forenmitglied fand diesen Beitrag gut

Beitrag schreiben (als Gast)





[BBCode-Hilfe]