About opportunity detectors and content resolvers

The PSDK provides default opportunity detectors and content resolvers that place ads into the timeline based on nonstandard tags within the manifest. Your application might need to alter the timeline based on opportunities to do so that are identified within the manifest, such as indicators for a blackout period.

An opportunity represents a point of interest on the timeline and usually indicates an ad placement opportunity but an opportunity can also indicate a custom operation that might affect the timeline (such as a blackout period). An opportunity detector is responsible for identifying specific opportunities (tags) in the timeline and notifying the PSDK that it has done so. Opportunities are identified in a timeline within PTTimedMetadata by the inclusion of a nonstandard (non-HLS) tag.

When your application is notified of such an opportunity (tag), it could alter the timeline in any manner, such as by inserting a series of ads, by switching to an alternate stream (blackouts), or by otherwise editing the timeline content. By default, the PSDK calls the appropriate content resolver to implement any timeline changes or actions required. Your application can use the default PSDK advertisement content resolver or register its own content resolver for different purposes.

The PSDK comes with a default content resolver that is responsible for resolving the default advertisement markers—#EXT-X-CUE, #EXT-X-AD, EXT-X-CUE-OUT, and EXT-X-CUEPOINT—inside the PSDK. Whenever one of these tags is encountered, control is transferred to the default ad resolver, which resolves advertisements for the PSDK to insert into the timeline.

You can also use PTSDKConfig.setAdTags. to add more ad marker tags/cues for the PSDK to recognize and use PTSDKConfig.setSubscribedTags to have the PSDK notify your application about additional tags, which might carry information needed for the advertising workflow.

One possible use of a custom resolver is for blackout periods. To handle blackouts, your application could implement and register a blackout opportunity detector that is responsible for handling blackout tags. Whenever the PSDK encounters this specific tag, it polls all the registered content resolvers to find the first one that handles the specified tag. In this case, it would be the blackout content resolver, which could, for example, replace the current item with alternate content on the player for the duration specified by the tag.