IMA SDK with default native player (VideoView) for list/series of videos.

131 views
Skip to first unread message

Test Fusioni

unread,
Apr 26, 2016, 7:26:47 AM4/26/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com
I want to play a list of videos in series, one by one. And after a certain number of video played an ads video should be play and then videos and ad and videos ad so on... 
example

ad_interval = 2
(AD, VOD, VOD, AD, VOD, VOD, AD, VOD, VOD, AD...........so on...)

ad_interval = 3
(AD, VOD, VOD, VOD, AD, VOD, VOD, VOD, AD, VOD, VOD, VOD, AD...........so on...)

ad_interval = 4
(AD, VOD, VOD, VOD, VOD, AD, VOD, VOD, VOD, VOD, AD, VOD, VOD, VOD, VOD, AD...........so on...)

I have tried sample example code which is given at https://developers.google.com/interactive-media-ads/docs/sdks/android/quickstart#prerequisites
After implementing this concept in onCompleted method, I have tried to identify video type but sometime it is right but not always so my logic got fails.

To identify video,I am using 
public boolean mIsAdDisplayed; variable from class VideoPlayerWithAdPlayback 


For more details please reffer this link . https://developers.google.com/interactive-media-ads/docs/sdks/android/quickstart 

below is code of onCompleted method..

 sampleVideoPlayer.addPlayerCallback(new PlayerCallback() {
@Override
public void onCompleted() {
Log.i("TAG", mVideoPlayerWithAdPlayback.getIsAdDisplayed()+"onCompleted=============>"+mVideoPlayerController.getClass());
if (!mVideoPlayerWithAdPlayback.getIsAdDisplayed())
{
progressBarBeforePlay.setVisibility(View.VISIBLE);
new LoadingTaskData().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});

Vu Chau (IMA SDK Team)

unread,
Apr 26, 2016, 1:02:06 PM4/26/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com
Hi there,

You can use VMAP and ad rules to more reliably accomplish this use case.  Specifically, you will defining the playback intervals server-side (e.g. make two ads follow the content video).  You will then get an ad tag that will contain the cue points.  Simply feed the SDK this tag, and once the time comes, it will fire an ad request and plays the ad for you at that specific point.  Once the ad is over, the content will kick in, so on and so forth.

Another way where you can manually control when to play your ad is via the Manual Ad Break Playback.  When the ad break is ready, you will be notified via the AD_BREAK_READY event.  Simply let the SDK know whether or not to play the ad (AdsManager.start()) at that time.

Let us know if you have additional questions,

Vu Chau
IMA SDK Team

Test Fusioni

unread,
May 2, 2016, 6:28:53 AM5/2/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com


Hi,

Actually, I need to fetch video url from server for each mediaID in the list, so, I have to display a loading icon while fetching data url from server.
As i have explained above,
When user pressed Watch All button then first ad will play (if exist) then main video play and so on ....
But before start play video first  I have to fetch video url from server for the current mediaID in the list. So I have to wait for few moment after completion of video, to fetch next video url from server. This process continue until last video in the list will play.
Please suggest if any Solution.

And it is not possible to make this thing on server side because this feed also uses by some other apps in different platforms .

The rule which you explain is not working properly as per my requirement. 

Vu Chau (IMA SDK Team)

unread,
May 2, 2016, 12:57:07 PM5/2/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com
Hello again,

I'm still not sure if I understood your use case.  Since ad rules isn't flexible for your circumstance, then you can simply use single tags, and request them manually.  

For example, when you are ready to request the next ad, simply call .contentComplete() on your AdsLoader and destroy the AdsManager [FAQ].  Send out the ad request, at which point you will get a fresh AdsManager, and repeat the process for subsequent ads.  This is equivalent to using ad rules and server-side defined cue points.

While the SDK is requesting an ad (that is, the time between the last COMPLETED event and the next LOADED event [API]), you can display your loading indicator.  

Vu Chau
IMA SDK Team

Test Fusioni

unread,
May 4, 2016, 7:26:40 AM5/4/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com
Hi,

This is not a playlist series of videos. All items are independent from each other. I am first fetching video url from server then start to play, and when it completed fetch next video url and play and so on....

I am trying to explain you that, All item are from different sources. I have manually created a arraylist of all item's Ids (By using this Id, i have to make another request to server for video URL) and trying to play it one by one.

And as per ad_interval value, i want to play ad in the middle of this sequential play.

I apologize for my English.


Thanks
Mahesh.

Vu Chau (IMA SDK Team)

unread,
May 4, 2016, 10:41:50 AM5/4/16
to Interactive Media Ads SDK, mah...@fusionitechnologies.com
Hi Mahesh,

It shouldn't matter which format your video playback is - sequential or not.  

When you use IMA, you are essentially using two video players: one for your ad, and one for your content.  They are two independent players (i.e. two div's), and only interact at the point when the ad stops and the content begins, and vice versa.  At this point, you will be using the AdsLoader to request your ad, and play it with the AdsManager.  So, you would be calling the respective logic to pause the content player right here.

Vu Chau
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages