如何在Linux上播放安全的HLS流?

时间:2016-05-22 22:10:49

标签: linux streaming gstreamer http-live-streaming hls

我有一个与音频服务器(如Pandora / Spotify)对话的Web服务,以获取特定歌曲的HLS轨道URL。要获取该URL,我需要在调用REST API时提供身份验证标头。我将该URL发送到我的覆盆子pi。

如何在raspberry pi上播放此HLS流,因为我认为它需要身份验证才能访问?我查看了gstreamer,livestream.io等,在尝试检索和播放实时流时,我没有看到任何自定义身份验证选项。这是如何工作的?

1 个答案:

答案 0 :(得分:1)

也许使用souphttpsrc元素的extra-headers .. 到目前为止你有什么管道?

我会做这样的事情:

gst-launch-1.0 souphttpsrc extra-headers=... ! decodebin name=d ! audio/x-raw ! autoaudiosink d. ! video/x-raw ! autovideosink

但是我不知道如何使用gst-launch中的额外标题..也许你必须用C代码(来自here):

GstStructure* extraHeaders = gst_structure_new("extra-headers", "Referer", G_TYPE_STRING, "some-uri, NULL);
g_object_set(element, "extra-headers", extraHeaders, NULL);