Setting Mime Type for .ogv files in Rails Development Environment

后端 未结 1 1852
再見小時候
再見小時候 2021-01-01 03:15

I am playing around with HTML5 video and have the following snippet in an ERB:

相关标签:
1条回答
  • 2021-01-01 03:40

    I had the same problem, and found the solution here: http://9elements.com/io/?p=306

    I'm running rails 2.3.5, so I put the following code in config/initializers/mime_types.rb and then reset my server (I'm using WEBrick for local development)

    Rack::Mime::MIME_TYPES.merge!({
      ".ogg"     => "application/ogg",
      ".ogx"     => "application/ogg",
      ".ogv"     => "video/ogg",
      ".oga"     => "audio/ogg",
      ".mp4"     => "video/mp4",
      ".m4v"     => "video/mp4",
      ".mp3"     => "audio/mpeg",
      ".m4a"     => "audio/mpeg"
    })
    

    And now curl is showing the correct mime types for ogv files.

    0 讨论(0)
提交回复
热议问题