What is the content_type for WebVtt?
Asked Answered
J

1

7

I'd like to allow my application to permit .vtt files on upload. Right now it was only accepting .txt files, but I'd like to add .vtt capability for captions.

I've tried this *with no luck:

validates_attachment_content_type :caption, 
  :content_type => ['application/txt', 'text/plain', 'WEBVTT', 'application/vtt', 'vtt']

What is the proper format in this case?

Juta answered 18/1, 2016 at 19:36 Comment(3)
The MIME type for WebVTT is text/vtt: w3c.github.io/webvtt/#webvtt-fileArduous
didn't work. any ideas?Juta
WebVTT is a very new standard, and so a very new MIME type. Rails might not know about it yet. You may have to just check the extension or come up with your own validation by checking the actual data against the spec.Arduous
S
12

The MIME type for WebVTT caption files is text/vtt as specified in https://w3c.github.io/webvtt/#iana-text-vtt

Spanishamerican answered 24/1, 2016 at 21:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.