多個初始PlacementInformations

TVSDK可設定多個初始PlacementInformations。

ArrayList<PlacementInformation> placementInformations = new ArrayList<PlacementInformation>();
CustomRangeHelper customRangeHelper = new CustomRangeHelper(mediaPlayerItem.getResource().getMetadata());

if (customRangeHelper.hasRanges() == null) {
    if (adSignalingMode == AdSignalingMode.SERVER_MAP) {
        placementInformations.add(new PlacementInformation(Type.SERVER_MAP, PlacementInformation.UNKNOWN_DURATION, 0));
    } else if (adSignalingMode == AdSignalingMode.MANIFEST_CUES) {
        placementInformations.add(new PlacementInformation(Type.PRE_ROLL, timeMapping.getTime(), PlacementInformation.UNKNOWN_DURATION));
    }
}
else if (customRangeHelper.hasRanges() == CustomRangeHelper.MARK_RANGE) {
    placementInformations.add(new PlacementInformation(Type.CUSTOM_TIME_RANGES,
      PlacementInformation.Mode.MARK, PlacementInformation.UNKNOWN_DURATION, 0));
}
else if (customRangeHelper.hasRanges() == CustomRangeHelper.DELETE_RANGE) {
    placementInformations.add(new PlacementInformation(Type.CUSTOM_TIME_RANGES,
      PlacementInformation.Mode.DELETE, PlacementInformation.UNKNOWN_DURATION, 0));
    if (adSignalingMode == AdSignalingMode.SERVER_MAP) {
        placementInformations.add(new PlacementInformation(Type.SERVER_MAP,
          PlacementInformation.UNKNOWN_DURATION, 0));
    } else if (adSignalingMode == AdSignalingMode.MANIFEST_CUES) {
        placementInformations.add(new PlacementInformation(Type.PRE_ROLL,
          timeMapping.getTime(), PlacementInformation.UNKNOWN_DURATION));
    }
}
else if (customRangeHelper.hasRanges() == CustomRangeHelper.REPLACE_RANGE) {
    placementInformations.add(new PlacementInformation(Type.CUSTOM_TIME_RANGES,
      PlacementInformation.Mode.DELETE, PlacementInformation.UNKNOWN_DURATION, 0));
    placementInformations.add(new PlacementInformation(Type.CUSTOM_TIME_RANGES,
      PlacementInformation.Mode.REPLACE, PlacementInformation.UNKNOWN_DURATION, 0));
}
return  placementInformations;

本頁內容