public class POBVastPlayerUtil
extends java.lang.Object
| Constructor and Description |
|---|
POBVastPlayerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static POBMediaFile |
filterMediaFiles(java.util.List<POBMediaFile> mediaFileList,
POBVideoPlayerView.SupportedMediaType[] supportedMediaType,
int bitRate,
int width,
int height)
Filters and returns the POBMediaFile for matching inputs.
|
static int |
getBitRate(boolean isResolutionLow,
boolean isWifi)
Returns the bitrate for device screen scale/resolution and network.
|
static int |
getScaleFactor(android.content.Context context)
The scale factor of the display
|
static double |
getSkipOffset(double respSkipOffset,
POBVastPlayerConfig vastConfig,
long mediaDuration)
To get best possible skip offset duration for vast player to show skip on it.
|
static POBCompanion |
getSuitableEndCardCompanion(java.util.List<POBCompanion> companions,
int playerWidthInPx,
int playerHeightInPx,
float aspectRatioDeviationFactor,
float playerWidthDeviationFactor)
To find out best matching companion from list of companion using below steps
Step 1: Select companion ads which have renderingMode="end-card"
Step 2: if there is not companion with renderingMode="end-card" then consider existing companion list
Step 3: Calculate aspect ratio for size of each companion with current vast player size
(in case of video interstitial it will screen size)
Step 4: Pick companion having percent value nearest to 1 or with having correction not
more than +/- 0.3 factor
if any companion with above criteria is present in the provided list then return that companion
else return null
|
@Nullable public static POBCompanion getSuitableEndCardCompanion(@NonNull java.util.List<POBCompanion> companions, int playerWidthInPx, int playerHeightInPx, float aspectRatioDeviationFactor, float playerWidthDeviationFactor)
companions - list of companion on which best matching algorithm is going to performplayerWidthInPx - Pixel width of the playerplayerHeightInPx - Pixel height of the playeraspectRatioDeviationFactor - Deviation factor for aspect ratio for companion ad w.r.t. playerplayerWidthDeviationFactor - Deviation factor for companion width w.r.t. player width@Nullable public static POBMediaFile filterMediaFiles(@Nullable java.util.List<POBMediaFile> mediaFileList, @NonNull POBVideoPlayerView.SupportedMediaType[] supportedMediaType, int bitRate, int width, int height)
mediaFileList - list of POBMediaFile objectssupportedMediaType - Support mime typebitRate - expected bit rate valuewidth - width of media fileheight - height of media filepublic static int getScaleFactor(android.content.Context context)
context - application contextpublic static int getBitRate(boolean isResolutionLow,
boolean isWifi)
isResolutionLow - true for low resolution devices else falseisWifi - flag which indicates whether nework type is wifi or notpublic static double getSkipOffset(double respSkipOffset,
@NonNull
POBVastPlayerConfig vastConfig,
long mediaDuration)
respSkipOffset - skip offset in the vast responsevastConfig - the vast configuration generated from vast responsemediaDuration - the media duration in seconds