简体   繁体   English

使用Azure Media Services实时流式传输单个/静态音频文件

[英]Live stream a single / static audio file using Azure Media Services

I'm struggling trying to figure out how to implement live streaming of an audio file through Azure Media Services. 我正在努力弄清楚如何通过Azure媒体服务实现音频文件的实时流传输。 What I'm trying to do is have a single/static audio file that live streams and repeats when it reaches the end of the file. 我想做的是有一个单一/静态音频文件,该文件实时流传输并在到达文件末尾时重复播放。

The thought is to have a radio station type experience that when the user starts listening to the audio it begins playing at where the file is currently at in the live stream. 想法是要具有广播电台类型的体验,即当用户开始收听音频时,它将在实时流中当前文件所在的位置开始播放。

I have very limited knowledge with codecs, streaming types, and encoding. 我对编解码器,流类型和编码的了解非常有限。 That said, I was able to upload my mp3 file to Azure Media Services, encode it using "AAC Good Quality Audio" and am able to play the audio clip. 就是说,我能够将mp3文件上传到Azure媒体服务,使用“ AAC高质量音频”对其进行编码,并且能够播放音频剪辑。 However, I want to enable streaming to ensure the experience I described above. 但是,我想启用流传输以确保我上面描述的体验。

The last piece of this will be enabled through a responsive website so I would like to enable the stream using HTML 5 so it's playable on all devices that support it (desktop, mobile, tablet, etc). 最后一部分将通过响应式网站启用,因此我想使用HTML 5启用流,以便在支持它的所有设备(台式机,移动设备,平板电脑等)上均可播放。 Is there a HTML5/JavaScript player that is able to do this? 是否有HTML5 / JavaScript播放器可以做到这一点? Flash/Silverlight is not an option since this won't render on mobile nor tablets. 不能选择Flash / Silverlight,因为它不会在手机或平板电脑上呈现。

If I can provide any further information please let me know. 如果我可以提供更多信息,请告诉我。 Most/all of the articles I see about live streaming is about video and I'm struggling to find how to do this with audio. 我看到的有关实时流媒体的大多数/所有文章都是关于视频的,我正在努力寻找如何使用音频实现此目的。 Any help would be greatly appreciated. 任何帮助将不胜感激。

Thanks! 谢谢!

There is no such thing as Live Streaming a single audio file . 没有诸如Live Streaming a single audio file类的东西。 Live streaming as such imposes a live event. 这样的实时流式传输会带来实时事件。 Something that is happening and while happening is streaming. 正在发生和正在发生的事情正在流式传输。 And it doesn't matter if it is Audio or Audio + Video or only Video. 而且它是音频还是音频+视频还是仅视频都没有关系。

Using only Azure Media Services you cannot achieve this goal. 使用Azure媒体服务无法实现此目标。 You need a process that plays in repeative mode the media and streams it to a live streaming channel of Azure Media Services. 你需要一个过程playsrepeative模式的媒体,它流于Azure的媒体服务的流媒体直播频道。

But it would be a rather expensive exercise! 但这将是一个相当昂贵的练习! For your need, a more cost effective way would be use some linux streaming server on a Linux VM, like http://icecast.org/ 为了您的需要,一种更具成本效益的方法是在Linux VM上使用某些linux流服务器,例如http://icecast.org/。

You can also send one file, and Azure can transcode it to various formats for you. 您还可以发送一个文件,Azure可以为您将其转码为各种格式。 I have a full list of tutorials I wrote on Azure Media Services: 我有我在Azure媒体服务上编写的教程的完整列表:

In terms of the encoding, Azure can do that for you. 在编码方面,Azure可以为您做到这一点。 Give it one file type, and it can create multiple copies of various formats for you. 给它一个文件类型,它可以为您创建各种格式的多个副本。 I have a short post and a 10 minute video on how to do that. 我有一个简短的帖子和一个10分钟的视频,介绍如何执行此操作。

There is also an Azure Media Player, and the selling point behind this is that it adapts the video stream based on the device it detects the player is running on, which is nice for pairing with the format changes listed above. 还有一个Azure Media Player,其背后的卖点是,它会根据检测到播放器运行的设备来调整视频流,这很适合与上面列出的格式更改配对。 So it saves you the trouble of having to write the fallback conditions yourself. 因此,它免除了您必须自己编写回退条件的麻烦。 (Ex: Running on an iOS device, so use HLS). (例如:在iOS设备上运行,因此请使用HLS)。

You can use any of this for audio, as well. 您也可以将其中任何一个用于音频。 Your best bet is to set set Looping = true on the video player, as both the HTML5 audio and video player has this attribute. 最好的选择是在视频播放器上设置set Looping = true因为HTML5音频和视频播放器都具有此属性。

Let me know if you need more info. 让我知道您是否需要更多信息。

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

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