简体   繁体   English

通过本地网络中的服务器的样本来流式传输音频

[英]streaming audio by samples from server in a local network

Excuse me, if my question is silly, but I'm a beginner at web-developing. 对不起,如果我的问题很愚蠢,但我是网络开发的初学者。 I am trying to write codes with php and javascript and can't find an answer or some example how to solve my problem. 我试图用PHP和JavaScript编写代码,但无法找到答案或一些例子如何解决我的问题。

The problem is to send audio samples (not a file) from server to client and to play this audio on client. 问题是将音频样本(不是文件)从服务器发送到客户端并在客户端上播放此音频。

I will be very grateful for any help. 我将非常感谢任何帮助。

There are several ways to play audio in browser: 有几种方法可以在浏览器中播放音频:

1) Most usual flash-plugin: 1)最常见的flash-plugin:

With flash you can handle raw PCM samples and play them but in that case you need at least basic knowledge of flash API's and ActionScript 3. 使用闪存,您可以处理原始PCM样本并播放它们,但在这种情况下,您至少需要有关Flash API和ActionScript 3的基本知识。

2) HTML5 Video/Audio API's (Javascript), but specifications for these are not finished yet: 2)HTML5视频/音频API(Javascript),但这些规格还没有完成:

With current API's you cannot handle PCM directly without media container. 使用当前的API,您无法在没有媒体容器的情况下直接处理PCM。 Google for containers currently supported by browsers, different browsers support different containers and different codecs. 谷歌目前支持浏览器的容器,不同的浏览器支持不同的容器和不同的编解码器。

3) Other plugins like Windows Media Player: 3)其他插件,如Windows Media Player:

Maybe you will find, plugin suitable for you but take in account, if you plan to stream your sound to large audience then you better go with popular plugin like flash. 也许你会发现,插件适合你,但考虑到,如果你打算将你的声音流式传输给大量观众,那么你最好使用像flash这样的流行插件。

Summary: 摘要:

Sending PCM samples over network is much slower then compressed audio, but as far as you are in local network this should not be a problem. 通过网络发送PCM样本比压缩音频慢得多,但就本地网络而言,这应该不是问题。

One solution is, wrap your samples on server(with PHP), you should choose media container accordingly to client side you choose. 一种解决方案是,将样本包装在服务器上(使用PHP),您应该根据您选择的客户端选择媒体容器。

Or learn little bit of flash and make flash swf that can play PCM samples. 或者学习一点闪光并制作可以播放PCM样本的flash swf。

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

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