private InstreamAd ad;
private void initAd()
{
// Enable debug mode
// InstreamAd.setDebugMode(true);
// Instantiate InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
}
private InstreamAd ad;
private void initAd()
{
// Instantiate InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
// Install the player
ad.setPlayer(YOUR_PLAYER);
}
float getAdVideoDuration();
float getAdVideoPosition();
void setAdPlayerListener(AdPlayerListener listener);
View getView();
void setVolume(float volume);
void playAdVideo(Uri uri, int width, int height);
void pauseAdVideo();
void resumeAdVideo();
void stopAdVideo();
void onAdVideoStarted();
void onAdVideoPaused();
void onAdVideoResumed();
void onAdVideoStopped();
void onAdVideoError(String message);
void onAdVideoCompleted();
void onVolumeChanged(float volume);
private InstreamAd ad;
private void initAd()
{
// Create an instance of InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
// Install the player SDK
ad.useDefaultPlayer();
// Add player to the screen
layout.addView(ad.getPlayer().getView());
}
private InstreamAd ad;
private void initAd()
{
// Create an instance of InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
// Set the event listener
ad.setListener(new InstreamAd.InstreamAdListener()
{
@Override
public void onLoad(InstreamAd instreamAd)
{
// The data was successfully loaded
}
@Override
public void onNoAd(String reason, InstreamAd instreamAd)
{
// No data received
}
@Override
public void onError(String reason, InstreamAd ad)
{
// An error occurred while playing the promotional video
}
@Override
public void onBannerStart(InstreamAd ad, InstreamAd.InstreamAdBanner instreamAdBanner)
{
// Began playing the promotional video
}
@Override
public void onBannerPause(InstreamAd ad, InstreamAd.InstreamAdBanner instreamAdBanner)
{
// Ad video playback paused
}
@Override
public void onBannerResume(InstreamAd ad, InstreamAd.InstreamAdBanner instreamAdBanner)
{
// Ad video playback resumed
}
@Override
public void onBannerComplete(InstreamAd ad, InstreamAd.InstreamAdBanner instreamAdBanner)
{
// Ad video playback completed
}
@Override
public void onBannerTimeLeftChange(float timeLeft, float duration, InstreamAd ad)
{
// Is called multiple times during playback of the promotional video is used to update the timer before the end of the show promotional video
}
@Override
public void onComplete(String section, InstreamAd ad)
{
// Playback of all promotional videos in the advertising section is completed
}
});
// Start loading data
ad.load();
}
// Before starting the main video
ad.startPreroll();
// After showing the main video
ad.startPostroll();
private InstreamAd ad;
private void initAd()
{
// Create an instance of InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
// Set positions on the first and fifth seconds of the video
ad.configureMidpoints(videoDuration, new float[]{1f,5f});
// or percentage, 10% and 50% video
// ad.configureMidpointsPercents(videoDuration, new float[]{10f,50f});
// Set the event listener
ad.setListener(new InstreamAd.InstreamAdListener()
{
@Override
public void onLoad(InstreamAd instreamAd)
{
// The data was successfully loaded
// Array of positions (in seconds) available to display the midroll section
adPositions = ad.getMidPoints();
}
...
});
// Start loading data
ad.load();
}
// The video was played to the 5th second and it has a position in the array adPositions
ad.startMidroll(adPositions[1]);
public final float duration;
public final boolean allowClose;
public final float allowCloseDelay;
public final int videoWidth;
public final int videoHeight;
public String ctaText;
private void onAdClick()
{
ad.handleClick();
}
public void pause()
public void resume()
public void stop()
public void skip()
public void skipBanner()
public void setVolume(float volume)
public void setLoadingTimeout(int loadingTimeout)
private InstreamAd ad;
private void initAd()
{
// Create an instance of InstreamAd
ad = new InstreamAd(YOUR_SLOT_ID, this);
// We receive an instance of additional parameters CustomParams
CustomParams customParams = ad.getCustomParams();
// Set age
customParams.setAge(25);
// Set gender
customParams.setGender(CustomParams.Gender.MALE);
}