I am using Rails(5.2) Active Storage for saving attachments directly in S3.
After the attachment is saved in the model, the image and pdf files are previewed in the browser directly by clicking on the file url, which is the default behaviour due to active_storage.content_types_allowed_inline configuration.
I need some extra files to be previewed through browser like Audio/Video files, I have added the file content types in the configuration like below,
config.active_storage.content_types_allowed_inline += %w[audio/flac audio/x-flac audio/mpeg audio/mp3
audio/mp4 audio/ogg audio/wave audio/wav audio/x-wav audio/x-pn-wav audio/webm
video/mpeg video/mp4 video/ogg video/quicktime video/webm
video/x-msvideo video/x-flv video/h264 application/vnd.rn-realmedia application/x-shockwave-flash
video/x-ms-wmv audio/x-aiff audio/midi application/ogg audio/x-ms-wma application/vnd.ms-wpl
video/x-matroska video/dvd video/x-ms-vob]
The files like mp3, mp4 are previewing in the browser.
But files like avi, flv, h264, mkv, rm, swf, wmv, aif, midi, mpa, wma are downloading instead of previewing but I have added these file content types in the content_types_allowed_inline configuration also.
How to preview all the audio/video files in the browser? Does anybody have any idea in this?