您在這裡

Streaming with JMF

19 一月, 2016 - 14:46

JMF supports streaming media over the RTP and RTSP protocols. To get a more concrete idea of how streaming is supported, get the following files:

VideoTransmit is an application that serves as an RTP video server. After compilation, it should be executed as:

java VideoTransmit vfw://0 192.168.0.10 1234

which states that it will capture from the capture device vfw://0, which represents the camera, and will send the RTP stream to 192.168.0.10 using port 1234.

Figure 1.6 Result of starting the VideoTransmit server
 

The client should be executed as:

java VideoReceive 192.168.0.10 1234

which states the source of the RTP stream and port number (I am using only one computer).

Figure 1.7 Detecting an RTP stream by VideoReceive
 

If an RTP stream is detected by the client, a window will be opened with the necessary controls and visual components needed to view the video.

Figure 1.8 JMF client receiving video stream
 

I do not intend to go into the details of VideoTransmit.java and VideoReceive.java because this is not a programming course. Feel free, however, to take a look at the source code to appreciate how a minimal RTP server and client can be constructed with JMF.

To sum up, JMF is an attempt by Sun to embrace the media streaming market using the Java technology. It was designed to be compatible with standard protocols such as RTP. Both Java and RTP streaming are intimately related to the Internet, and appeared to be a perfect match. Yet JMF didn't see tremendous success. JMF's major problem is that it is complicated. Even an experienced Java programmer would have a hard time learning all the JMF classes in VideoTransmit.java and VideoReceive.java. A second deadly blow to JMF is the requirement that it be installed separately on client machines. When compared with other media players such as Windows Media Player and Flash Player, installing JMF is too much of a nuisance. JMF is therefore more suitable for building in-house solutions and for use in situations in which compatibility with standard protocols is essential.