Gray play icon when using google ima in Android WebView

653 views
Skip to first unread message

Franklin Waller

unread,
Apr 7, 2016, 8:33:56 AM4/7/16
to Interactive Media Ads SDK
When using the Google IMA library in a Android WebView we see a gray play button for a few seconds and then the advertisement. 
It looks like a poster is set on the video element. But the "poster" doesn't come from any resources it looks like it comes from Android itself.

Is there a way to fix this? I'm using the HTC One M8 and Android 6.0. I'm using the regular WebView from android.
The gray play icon looks like this:


Vu Chau (IMA SDK Team)

unread,
Apr 7, 2016, 4:56:40 PM4/7/16
to Interactive Media Ads SDK
Hi Franklin,

The poster is indeed the default one that the ChromeClient uses when you are not specifying a custom one.  To "hide" that poster or to use your own, you'd need to override getDefaultVideoPoster() as follows:

Get your WebView object:

WebView mWebView = (WebView) findViewById(R.id.web_view);
mWebView.setWebChromeClient(new WebChromeClientCustomPoster());

Override getDefaultVideoPoster():

private class WebChromeClientCustomPoster extends WebChromeClient {

@Override

public Bitmap getDefaultVideoPoster() {

return Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);

}

}


Vu Chau
IMA sdk Team

Franklin Waller

unread,
Apr 8, 2016, 3:41:02 AM4/8/16
to Interactive Media Ads SDK
Hi Vu Chau,

This seems to do the trick.

Thanks alot!
Reply all
Reply to author
Forward
0 new messages