302 redirect optimization minimizes the number of 302 redirect responses, which allows your application to load balance more effectively.
If a main manifest request is redirected, and 302 optimization is enabled in your player, subsequent requests made for assets from that manifest will use the final domain location, which avoids additional 302 responses.
This feature is disabled by default, and you can change this setting.
If you enable this feature, it works correctly only if all of the following conditions are true; otherwise, no redirect optimization occurs, and 302 responses continue to occur:
-swf-version
21 or higher.To ensure that cookies are passed with ad requests, disable 302 redirect. When 302 redirect is enabled, the ad request might be redirected to a domain that is different from the domain from which the cookie originated.
Use the useRedirectedUrl
property to turn 302 redirect on (true) or off (false).
For example:
// Set useRedirectedUrl property to true
var networkConfiguration = new NetworkConfiguration();
networkConfiguration.useRedirectedUrl = true;
//Set NetworkConfiguration as Metadata:
var result:Metadata = new Metadata();
result.setMetadata(DefaultMetadataKeys.NETWORK_CONFIGURATION_KEY,
networkConfiguration);
var mediaResource = new MediaResource( url, MediaResourceType.HLS, result);
// load the resource
mediaPlayer.replaceCurrentResource( mediaResource, mediaPlayerItemConfig );