从流我家的电脑音频文件到我的网站 [英] Stream audio files from my home computer to my website

查看:118
本文介绍了从流我家的电脑音频文件到我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我有一个关于一个网站,我一直在建设需要的音频文件进行呼应上使用PHP引用我的SQL数据库后,我的HTML中的几个问题。

Hello! I have a couple of questions regarding a website I have been building that requires audio files to be echoed onto my HTML using PHP after referencing my SQL database.

要开始,我的网页具有包含PHP的echo它里面,像这样的音频控制标签:

To begin, my page has an audio control tag that has a php echo inside of it, like so:

<audio controls>
    <source src="audio/<?php echo $file; ?>" type="audio/mp3">
</audio controls>

变量$文件等于用户希望他们填写一个不同的页面,这是从我的数据库中抽取一个选择表单之后要播放的音频文件:

the variable $file is equal to the audio file the user wants to play after they fill out a select form on a different page, which is pulled from my database:

INSERT INTO table
    VALUES
    (NULL, "track01.mp3");
    (NULL, "track02.mp3");
    (NULL, "track03.mp3");
    (NULL, "track04.mp3");

因此​​,因此,如果用户挑选从选择表格的第一个轨道,HTML是这样的:

so therefore, if the user picks the first track from the select form, the HTML looks like this:

<audio controls>
    <source src="audio/track01.mp3" type="audio/mp3">
</audio controls>

一切正常,到了这一点

我的声音加载完美的罚款和PHP / MySQL的code是伟大的工作; ,我遇到的问题是,我将在我的数据库超过500千兆字节的音频,我不能把我上的Web服务器,由于磁盘空间限制。所以我想,我怎样才能让我的音频流到我的网站,所以我没有让我的网站上5 GB的?

My audio is loading perfectly fine and the php/mysql code is working great; the problem that I am having is that I am going to have over 5 gigabytes of audio in my database, which I cannot put onto my web server due to disk space limits. So I thought, "how can I get my audio to stream to my website, so I don't have to have 5 gigabytes on my website?"

于是我开始研究利用Apache服务器(因为我已经使用WAMP来测试我的网站了),并试图让该服务器链接到我的网站。

So I began to research utilizing an Apache server (since I was already using WAMP to test my site out) and try to get that server to link to my website.

我的第一个测试是把所有我的音乐到我的本地主机,然后,我改变了code在我住的网站调用的文件是这样的:

My first test was placing all of my music onto my localhost and then I changed the code on my live website to call the files like this:

<audio controls>
    <source src="http://localhost/audio/<?php echo $file; ?>" type="audio/mp3">
</audio controls>

这也是工作完全正常,但很明显,因为他们没有获得我的本地自己的电脑上,这将不会为别人工作。

This also works perfectly fine, but obviously this will not work for anyone else since they do not have access to my localhost on their own computer.

所以我最大的问题是,我怎么可以设置我的网站了,所以我的PHP将回声出从我家电脑上的本地主机的文件,也不允许任何人谁的意见我的网站能够看到没有错误的音频标签?我认为这将有一些具有大家访问做我的IP地址,但一切到目前为止,我已经尝试已经失败。有没有我的问题的解决方案?我是不是采取错误的做法呢?有什么我应该指定?

So my big question is, how can I set my website up so my php will echo out a file from the localhost on my home computer, but also allow anyone who views my site to be able to see the audio tag with no errors? I assume this would have something to do with everyone having access to my IP address but everything I have tried so far has failed. Is there a solution to my problem? Am I taking the wrong approach to this? Is there anything I should specify?

任何答案将是极大的AP preciated。谢谢!

Any answer would be greatly appreciated. Thank you!

推荐答案

我想看看云存储 - 有许多引擎产生非常好的价格/一些免费的。例如Amazon S3的,箱,投放箱等我有超过50GB的免费存储空间的时刻,许多供应商提供的HTTP访问共享目录 - 只要你不违反任何版权法等

I would look to cloud storage - there are many engines that give very good prices / some free. For example Amazon S3, Box, DropBox etc. I have over 50Gb free storage at the moment and many of these providers offer http access to shared directories - as long as you are not breaking any copyright laws etc.

这篇关于从流我家的电脑音频文件到我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆