如何以编程方式访问 IPTV 服务器?
我的大学目前正在进行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是交换机级别的特殊握手,它告诉交换机您是多播组的一部分,以便您也将收到数据包。
下面是在 java 中在 UDP 套接字上注册和接收的示例:
来自 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:
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.
您可能需要查看 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.