Using RTMFP multicasting

The OSMF DefaultMediaFactory class automatically handles multicast content. You can provide a multicast-enabled resource to DefaultMediaFactory in two ways:

  • Use the Flash Media Server “Configurator” tool to generate a multicast-enabled F4M manifest file. In Windows, the default location for the Configurator is C:\Program Files\Adobe\Flash Media Server 4\ tools\multicast\configurator. See Using HTTP streaming for more information on F4M files.

  • Or, use the MulticastResource class to provide a multicast-ready resource for DefaultMediaFactory to handle.

When creating and identifying an RTMFP multicast, two important values are the multicast group specification and the stream name.

  • The group specification is a string identifying the peer-to-peer group to join, including its name, capabilities, restrictions, and the authorizations of this member.

  • The stream name is a string identifying the stream to join. If the supplied string does not refer to an existing application on the server, it is invalid. However, an invalid string only results in a connection not being established; no error is returned.

Note: If you use the Flash Media Server 4.0.0 Configurator to generate the F4M file, you must manually change the names of two generated values. Change the name rtmfpGroupspec to groupspec, and the name rtmfpStreamName to multicastStreamName.

The following code excerpts compare the ways to instantiate a multicast stream.

Using an F4M file:

mediaFactory = new DefaultMediaFactory(); 
mediaPlayer.media = mediaFactory.createMediaElement 
    ( 
        new URLResource("http://example.com/multicast.f4m") 
    );

Using MulticastResource with DefaultMediaFactory:

mediaFactory = new DefaultMediaFactory(); 
var resource:MulticastResource = new MulticastResource("rtmfp://server/app"); 
resource.groupspec = "AJHJKSFDS"; 
resource.streamName = "OPIOPROPIIOPOP"; 
mediaPlayer.media = mediaFactory.createMediaElement(resource);
Note: For IP multicast, OSMF does not return an error when attempting to connect to a blocked network segment.