Hey IMA Team,
I have an existing solution which leverages another
video player which isn't based off of Google's MediaPlayer interface
(lets call it XPlayer).
We want to keep using XPlayer for playing content because we have a
tried and true tested solution. We want to move the IMA SDK to deliver
ads. We will be using whatever video player Google uses to play ads. This is leading us to implement a dual player solution.
I was hoping to create a player
exactly like the sample since it is using DFP ad rules and fires events
when to pause and play the content. My approach was to setup the
DemoPlayer (from your sample) to return the proper progress when the content is playing,
and the proper progress when an ad is playing. I call play on the
XPlayer when I get the right event and pause on the XPlayer when I get
the proper event.
I have run into an issue however, if Google's MediaPlayer isn't playing
content then the getProgress() method is never called on the DemoPlayer
(from your sample) and the ad events are never fired after the preroll.
This means I don't get the IMA SDK triggering midrolls and the endroll.
It seems like the IMA SDK automagically knows if the VideoView's
MediaPlayer is playing content. It only polls the DemoPlayer's
getProgress function IF content is playing through the MediaPlayer in
the VideoView.
If I debug I see that the getProgress method is called from a handler so
there is no way to easily figure out where that call is coming from. If
I play dummy content on Google's video player then, since I am
returning the correct time from the XPlayer in getProgress (and because the IMA SDK
just seems to know when content is playing and then starts polling the
DemoPlayer for time), everything just works.
TLDR; Is there a way I can explicitly tell the IMA SDK that content is
playing so it polls the DemoPlayer instead of having it automagically
figure this out from the VideoView's MediaPlayer. Is there another way to implement a dual player solution?
Some code:
DemoPlayer.java
public void resumeContent() {
contentPlaying = true;
video.setMediaController(mediaController);
//video.setVideoPath(CONTENT_URL); REMOVED because I use my own video player
xPlayer.play();
play();
}
public void play() {
video.start();
}
public void pauseContent() {
xPlayer.pause();
video.stopPlayback();
video.setMediaController(null);
}
public void playContent(String contentUrl) {
contentPlaying = true;
xPlayer.play();
//video.setVideoPath(CONTENT_URL); REMOVED since I want my own content to play
video.setMediaController(mediaController);
play();
}
1) Which SDK are you using? (Flash, HTML5, iOS, Android)
- Android, Beta v8
2) What ad tag are you using in your request?
- The ones from the sample application
3)
Are you able to reproduce this in the downloadable sample app or the ?
If not, please include a link to a test page or app so we can see the
issue.
- N/A
4) What steps must we take to reproduce your issue?
- Put a timer or something that updates the getProgress() method that
simulates content playing from outside the IMA SDK. Comment out the
video.setVideoPath() lines to make sure the default video player isn't
playing any content...