如何以编程方式访问 IPTV 服务器?

发布于 2024-07-24 13:19:16 字数 474 浏览 5 评论 0原文

我的大学目前正在进行 IPTV 试验。 要访问该服务,您需要安装 VLC 媒体播放器,并通过它运行从大学内部网下载的文件,每个文件代表一个频道。

这些文件的格式为:

#EXTM3U
#EXTINF:0,ITV2
udp://@238.255.0.6:2001

我将其识别为 M3U 播放列表文件。 幸运的是,该文件指定了托管该服务的服务器的 IP 地址、访问该服务的端口以及协议(在本例中为 UDP)。

我的问题是,如何以编程方式访问该服务? 客户端与服务器之间是否有特定的握手? 既然可以通过 VLC 媒体播放器如此简单地访问它,那么访问数据肯定会很简单,因为没有使用专有协议?

我不太了解以编程方式访问互联网; 我知道在Java中可以构建一个Port来模拟UDP。 我很感激 Java 中的答案,但任何类似的语言都绰绰有余。

谢谢!

My University is currently running an IPTV trial. To access the service, you are asked to install VLC Media Player, and run the files, downloaded from the University's intranet, each representing a channel, through it.

The files are of the format:

#EXTM3U
#EXTINF:0,ITV2
udp://@238.255.0.6:2001

Which I recognise as an M3U playlist file. Fortunately, the file species the IP address of the server hosting the service, the port to access it through, and the protocol, in this case the UDP.

My question is, how could I get access to the service programatically? Is there a specific handshake a client does with the server? Seeing as it's accessible so simply via VLC Media Player, surely accessing the data will be trivial as there is no proprietary protocol used?

I'm not too clued up on accessing the Internet programatically; I know in Java a Port can be constructed which models the UDP. I would appreciate the answers in Java, but any similar language is more than enough.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幸福%小乖 2024-07-31 13:19:16

这是交换机级别的特殊握手,它告诉交换机您是多播组的一部分,以便您也将收到数据包。

下面是在 java 中在 UDP 套接字上注册和接收的示例:

 // join a Multicast group and send the group salutations

 InetAddress group = InetAddress.getByName("228.5.6.7");
 MulticastSocket s = new MulticastSocket(6789);
 s.joinGroup(group);
 // get their responses!
 byte[] buf = new byte[1000];
 DatagramPacket recv = new DatagramPacket(buf, buf.length);
 s.receive(recv);
 ...
 // OK, I'm done talking - leave the group...
 s.leaveGroup(group);

来自 j2ee 指南

您需要做的是加入多播组,然后接收数据包并将它们写入文件,然后我假设 MPEG2、MPEG4 或发送的流将是您计算机上的一个文件,应该可以通过另一个计算机播放程序。

Their is a special handshake at the switch level, its telling the switch you are part of the multicast group so that you will also receive the packets.

Bellow is an example of registering and receiving on a UDP socket in java:

 // join a Multicast group and send the group salutations

 InetAddress group = InetAddress.getByName("228.5.6.7");
 MulticastSocket s = new MulticastSocket(6789);
 s.joinGroup(group);
 // get their responses!
 byte[] buf = new byte[1000];
 DatagramPacket recv = new DatagramPacket(buf, buf.length);
 s.receive(recv);
 ...
 // OK, I'm done talking - leave the group...
 s.leaveGroup(group);

Example from j2ee guide.

What you need to do is join the multicast group, then just receive the packets and write them to a file, then I would assume the MPEG2, MPEG4 or however the stream is sent will be a file on your machine that should be playable through another program.

冷弦 2024-07-31 13:19:16

您可能需要查看 VLC 的 Java 绑定。 这将使您能够通过 Java 编程接口控制 VLC。 您可以从 Java 获得 VLC 的所有优点! 此外,还有一些其他 API 绑定接口,您可以使用它来使用 VLC。

You may want to look into VLC's Java bindings. This will give you control of VLC through a Java programming interface. You get all the greatness of VLC from Java! Also, there are several other API bindings and interfaces you can use to play with VLC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文