使用 C# 存储和访问 mp3 文件

发布于 2024-12-26 23:17:43 字数 261 浏览 1 评论 0原文

我正在开发一个网络应用程序,人们可以在其中传输各种声音。

我的目标是提供大量声音,我的问题是:存储 MP3 进行流式传输的最佳、最有效的方法是什么?

现在,我将它们全部存储在一个文件夹中,并以 Id 作为文件名。然后,我在数据库中有一个相应的行,用于存储所有声音数据,例如类别;声音类型之类的东西。因此,当有人想要流式传输文件时,我的应用程序会向数据库询问 Id,然后返回流的 URL。

这可以以更有效的方式完成吗?如果是这样,怎么办?

此致。

I'm doing a web application where people will be able to stream sounds of all sorts.

I'm aiming for a lot of sounds, and my question is this: what is the best, most efficient way of storing the MP3s for streaming?

Right now, I have them all stored in one folder with an Id as file name. I then have a corresponding row in the database that stores all the sound data, like category; type of sound and stuff like that. So when someone wants to stream a file, my application asks the database for the Id and then returns a URL for the stream.

Can this be done in a more efficient way? If so, how?

Best regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏雨凉 2025-01-02 23:17:43

看起来你走的路是正确的。很多事情取决于您的客户端是什么(即浏览器或 WinForm)。

一些建议:

  1. 您可以使用 Web 服务从数据库检索数据。如果您想将 UI 与数据库分离,这将有所帮助。
  2. 如果文件数量很大,您可以将所有文件保存在不同的服务器上;并将它们的绝对 URL 存储在数据库中。
  3. 上面提到的方法还可以帮助您在不同的服务器上托管媒体文件和服务/数据库。

如果您有任何具体问题,将更容易回答。无论如何希望这对你有帮助。

Looks like you are going the right way. Lots of thing depends upon what your client is (i.e. browser or WinForm).

Some suggestions:

  1. You can use web services to retrieve data from database. This will help if you want to decouple UI from database.
  2. You can keep all your files on different servers, if the number of them is huge; and store their absolute URLs in a database.
  3. Approach mentioned above will also help you in hosting media files and services/database on a different server.

If you have any specific questions, it will be easier to answer. Anyways hope this helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文