Here are the examples of the java api class com.google.android.libraries.mediaframework.exoplayerextensions.Video taken from open source projects.
1. ImaPlayer#createAdPlayer()
Project: google-media-framework-android
File: ImaPlayer.java
File: ImaPlayer.java
/** * Create a {@link SimpleVideoPlayer} to play an ad and display it. */ private void createAdPlayer() { // Kill any existing ad player. destroyAdPlayer(); // Add the ad frame layout to the adDisplayContainer that contains all the content player. adPlayerContainer = new FrameLayout(activity); container.addView(adPlayerContainer); adPlayerContainer.setLayoutParams(Util.getLayoutParamsBasedOnParent(adPlayerContainer, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // Ensure tha the ad ui adDisplayContainer is the topmost view. container.removeView(adUiContainer); container.addView(adUiContainer); Video adVideo = new Video(adTagUrl.toString(), Video.VideoType.MP4); adPlayer = new SimpleVideoPlayer(activity, adPlayerContainer, adVideo, "", true, 0, fullscreenCallback); adPlayer.addPlaybackListener(adPlaybackListener); // Move the ad player's surface layer to the foreground so that it is overlaid on the content // player's surface layer (which is in the background). adPlayer.moveSurfaceToForeground(); adPlayer.play(); adPlayer.disableSeeking(); adPlayer.setSeekbarColor(Color.YELLOW); adPlayer.hideTopChrome(); adPlayer.setFullscreen(contentPlayer.isFullscreen()); // Notify the callbacks that the ad has begun playing. for (VideoAdPlayer.VideoAdPlayerCallback callback : callbacks) { callback.onPlay(); } }