Document top-level limitation of AdsMediaSource

Issue: #4591

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206307948
This commit is contained in:
andrewlewis 2018-07-27 06:10:51 -07:00 committed by Oliver Woodman
parent 0c0c5942ab
commit 6a2f94ec4b

View File

@ -47,7 +47,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** A {@link MediaSource} that inserts ads linearly with a provided content media source. */
/**
* A {@link MediaSource} that inserts ads linearly with a provided content media source. This source
* cannot be used as a child source in a composition. It must be the top-level source used to
* prepare the player.
*/
public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
/** Factory for creating {@link MediaSource}s to play ad media. */
@ -315,7 +319,9 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
boolean isTopLevelSource,
@Nullable TransferListener mediaTransferListener) {
super.prepareSourceInternal(player, isTopLevelSource, mediaTransferListener);
Assertions.checkArgument(isTopLevelSource);
Assertions.checkArgument(
isTopLevelSource,
"AdsMediaSource must be the top-level source used to prepare the player.");
final ComponentListener componentListener = new ComponentListener();
this.componentListener = componentListener;
prepareChildSource(DUMMY_CONTENT_MEDIA_PERIOD_ID, contentMediaSource);