# Multicast Support

This section covers Multicast Support in the PRESTOplay SDK for Android. In order to playback `UDP` or `RTP` content the following criteria must be fulfilled:

1. `CONFIG_IP_MULTICAST` must be enabled when compiling the AOSP/Android TV Kernel for the device in question.

2. `IPTVPlugin` must be registered during PRESTOplay SDK for Android initialization.

## Basic Integration

    PlayerSDK.register(new IPTVPlugin(false, true, IPTVPlugin.DEFAULT_RTP_QUEUE_SIZE, IPTVPlugin.DEFAULT_DISCONTINUITY_THRESHOLD));

At creation the user may specify whether the `IPTVPlugin` only plays clear content, whether data till the first Key frame can be ignored in the Multicast Data, the RTP Queue size (in number of RTP Packets) and a discontinuity threshold which is useful for error handling.

## URL Configuration

For Playback to work, one may simply pass the correct Multicast url under the SdkConsts.INTENT_URL either in the format,

    .put(SdkConsts.INTENT_URL, "udp://<a.b.c.d>:port")

for UDP or,

    .put(SdkConsts.INTENT_URL, "rtp://<a.b.c.d>:port")

for rtp in the `PlayerConfig`. The client application may also pass in an IPTV Player Configuration as part of the `SingleControllerPlaylist` configuration.

## DRM Support with IPTV (experimental)

Starting from PRESTOplay SDK for Android version 4.4.4, we support UDP/RTP with CENC Widevine encrypted `H264-AVC` and `H265-HEVC`. In order for this to work a `DrmConfiguration` must be specified along with the Player Configuration.

For this to work, the appropriate Castlabs defined signalling must be enabled in the bitstream as well as the program PMT.

## IPTV Read Timeout

In order to detect the unavailability of the IPTV stream during playback the client application may set the appropriate read timeout.

    NetworkConfiguration networkConfiguration = new NetworkConfiguration.Builder()
                                .iptvReadTimeoutMs(x)
                                .get();

The client can then listen to the `IptvAnalyticsListener#onNetworkTimeout()` callback.