简体   繁体   English

Ruby on Rails 前端的音频文件

[英]Audio files on front-end in Ruby on Rails

this is a best practices/performance question with regard to audio files in Ruby on Rails.这是关于 Ruby on Rails 中音频文件的最佳实践/性能问题。 I am creating a Ruby on Rails application and I'd like to give users and easy way to click on certain strings of text in my application and hear an audio playback of that string (I am aware that there are other solutions to this like text-to-speech browser plugins, but I'd like to explore this option first).我正在创建一个 Ruby on Rails 应用程序,我想为用户提供一种简单的方法来单击我的应用程序中的某些文本字符串并听到该字符串的音频播放(我知道还有其他解决方案,如文本-to-speech 浏览器插件,但我想先探索这个选项)。 I am familiar with the paperclip gem, I use it extensively in my application, and it has an easy to use interface for uploading the file with form helpers, storing it's url simply into a database column for a particular object, and ultimately referring back to the image url with an easy view helper.我熟悉回形针 gem,我在我的应用程序中广泛使用它,它有一个易于使用的界面,用于上传带有表单助手的文件,将它的 url 简单地存储到特定对象的数据库列中,并最终参考带有简单视图助手的图像 url。

Is there a gem similar to this for audio file uploading that anyone knows of?是否有类似的宝石用于上传任何人都知道的音频文件?

And how hurtful towards the performance of my application would it be to add a few database columns which refers to the location of an audio file, to a few of my models?向我的一些模型添加一些引用音频文件位置的数据库列会对我的应用程序的性能造成多大伤害?

How hurtful towards the performance of my app would it be to load somewhere between 3-10 short audio files (maybe 10 seconds long each), on each of my pages?在我的每个页面上加载 3 到 10 个短音频文件(每个可能长 10 秒)对我的应用程序的性能有多大伤害? I can store the audio files with AWS.我可以使用 AWS 存储音频文件。

Thanks in advance for ANY help!!!在此先感谢您的任何帮助!!!

So you're just creating a link to an audio file?所以你只是创建一个音频文件的链接? You possibly need some js audio player library to do playback so it doesn't actually try to make you download the file.您可能需要一些 js 音频播放器库来进行播放,因此它实际上不会尝试让您下载文件。 There's probably zero load for your server since everything is done on the browser side.您的服务器的负载可能为零,因为一切都在浏览器端完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM