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,
POBVideoPlayer.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 java.lang.String |
getCustomProductPageClickUrl(POBVastAd vastAd,
java.lang.String bidBundleId)
Method to get custom product page url
i) Check if click through url valid play store url
ii) if not check if bid.bundle is present create url using bundle id
|
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,
float playerWidthInPx,
float playerHeightInPx)
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, float playerWidthInPx, float playerHeightInPx)
companions - list of companion on which best matching algorithm is going to performplayerWidthInPx - Pixel width of the playerplayerHeightInPx - Pixel height of the player@Nullable public static POBMediaFile filterMediaFiles(@Nullable java.util.List<POBMediaFile> mediaFileList, @NonNull POBVideoPlayer.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(@NonNull
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)
Assuming mediaDuration = 30sec & x, y > 0
Possible Cases -> expected values
#non-skippable ads (skip = 0) respSkip = x, maxDuration = y -> Min(x,30) respSkip = 0, maxDuration = y -> Min(y,30)
#skippable ads (skip = 1) skipAfter = 0, skipMin = 0 -> mediaDuration i.e. 30 skipAfter = 0, skipMin = 10 -> mediaDuration i.e. 30 skipAfter = x, skipMin = 0 -> Min(x,30) skipAfter = x, skipMin = 10 -> Min(x,30) skipAfter = x, skipMin = 35 -> mediaDuration i.e. 30
respSkipOffset - skip offset in the vast responsevastConfig - the vast configuration generated from vast responsemediaDuration - the media duration in seconds@Nullable
public static java.lang.String getCustomProductPageClickUrl(@Nullable
POBVastAd vastAd,
@Nullable
java.lang.String bidBundleId)
vastAd - instance of vastAdbidBundleId - bid bundle id received from response