简体   繁体   English

来自实时源的HTML5音频流

[英]HTML5 Audio Streaming from Live Source

I am looking into implementing live audio streaming from a vxWorks system into an HTML5 audio player. 我正在研究实现从vxWorks系统到HTML5音频播放器的实时音频流。 I have been researching for a while but am stuck on one key step. 我已经研究了一段时间,但停留在一个关键步骤上。

Work Flow: 工作流程:

  1. A host has a mic and speaks into the mic 主持人拥有麦克风并向麦克风讲话
  2. Audio is received into the vxWorks OS. 音频被接收到vxWorks OS中。 Here it can be encoded, packaged - anything is possible here 在这里可以对其进行编码,打包-在这里一切皆有可能
  3. ???? ????
  4. User opens web page to listen to the live audio in an HTML5 player. 用户打开网页以在HTML5播放器中收听实时音频。

I don't know what goes in step 3. Suppose I have now encoded the audio into Mp3. 我不知道步骤3的内容。假设我现在已将音频编码为Mp3。 What technologies do I need to send this to the browser? 我需要什么技术将其发送到浏览器? I believe I can send this through HTTP procotol, but I am not understanding how that is packaged. 我相信我可以通过HTTP procotol发送此消息,但是我不知道该如何打包。 Ie, how is audio packaged into an HTTP protocol. 即,如何将音频打包到HTTP协议中。 And what does the HTML5 player want as a source for this data. HTML5播放器想要什么作为此数据的来源。 A URL? 网址? Or websocket data? 还是websocket数据?

Thanks. 谢谢。

The solution for #3 depends on whether you need a low-latency live audio stream at the HTML5 player, or latency can be 10-30 seconds. #3的解决方案取决于您是否需要HTML5播放器上的低延迟实时音频流,或者延迟可能是10到30秒。

1. Latency can be high 1.延迟可能会很高

You need a streaming server / HLS packager that will stream via HLS, and a webpage that hosts Flowplayer or JWPlayer which will play that HLS stream using HTML5 video tag. 您需要一个将通过HLS进行流传输的流服务器/ HLS打包程序,以及一个托管Flowplayer或JWPlayer的网页,该网页将使用HTML5视频标签播放该HLS流。 AAC-encoded (not mp3!) audio stream needs to be pushed (RTMP publishing is a most popular method) to that streaming server / HLS packager. 需要将AAC编码(不是mp3!)音频流推送到该流服务器/ HLS打包程序(RTMP发布是最流行的方法)。

You could go with free nginx; 您可以使用免费的nginx。 it is portable to vxWorks and can stream out via HLS. 它可以移植到vxWorks,并且可以通过HLS进行流式传输。 You could also try free VLC or ffmpeg for the same. 您也可以尝试免费使用VLC或ffmpeg。

If you make it work, the stream will be playable on any browser on any device - iOS, Android, Windows OS etc... 如果您可以正常播放,则该流将可以在任何设备(iOS,Android,Windows OS等)上的任何浏览器上播放。

2. You need low latency 2.您需要低延迟

This is much harder. 这要困难得多。 You would need another machine running Linux or Windows OS. 您将需要另一台运行Linux或Windows OS的计算机。 On that machine install Unreal Media Server or Evostream server - these servers stream to HTML5 players via Websocket protocol using ISO BMFF packaging. 在该机器上安装Unreal Media Server或Evostream服务器-这些服务器使用ISO BMFF封装通过Websocket协议将数据流传输到HTML5播放器。 Same as before, AAC-encoded (not mp3!) audio stream needs to be pushed (RTMP publishing is a most popular method) to that streaming server. 与以前一样,需要将AAC编码(不是mp3!)音频流推送到该流服务器(RTMP发布是最流行的方法)。

These streams will play on any browser / any OS EXCEPT iOS! 这些流可以在除iOS之外的任何浏览器/任何操作系统上播放!

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

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