Help Center/Details/

Full screen video

Introduction

Full-screen video ads. The effect of this ad is to play full-screen videos. The video can be skipped after a certain period of time without having to watch the whole process.
Supported ad sizes: Full screen horizontal screen (aspect ratio 16:9), full screen vertical screen (aspect ratio 9:16). Android does not currently support gravity rotation权限
Template rendering full-screen video ads:Provided by default
SDK renders full-screen video ads: Reclaimed,No longer offer to create

Request method

Note: There is no difference between the template rendering full-screen and SDK rendering full-screen ad request methods, only the difference in request parameters.
The setExpressViewAcceptedSize parameter needs to be set in the full-screen video request method of template rendering. The value set is greater than 0.

Create TTAdNative object

//创建TTAdNative对象,createAdNative(Context context) context需要传入Activity对象
TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(this);

Template rendering request AdSlot

AdSlot adSlot = new AdSlot.Builder()
        .setCodeId(codeId)
        //模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可
        且仅是模板渲染的代码位ID使用,非模板渲染代码位切勿使用
        .setExpressViewAcceptedSize(500,500)
        .setSupportDeepLink(true)
        .setOrientation(orientation)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
        .build();

SDK rendering request AdSlot

TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(this);
SDK渲染请求AdSlot
AdSlot adSlot = new AdSlot.Builder()
        .setCodeId(codeId)
        .setSupportDeepLink(true)
        .setOrientation(orientation)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
        .build();
Parameter description
Method Description
setCodeId() The code ID created by the platform starts with 9 and 9 digits
setExpressViewAcceptedSize() Set the size of the requested template creative. Unit: dp Set the value greater than 0 (required for template ads).Only the template needs to be set to render full-screen video.
setOrientation()

Note: The template rendering code bit setExpressViewAcceptedSize is required, and the SDK template rendering code bit ID should not be passed.

Request ad

The access party can call loadFullScreenVideoAd(AdSlot adSlot, @NonNull FullScreenVideoAdListener listener) to asynchronously load the full-screen video ad

mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() {
        //请求广告失败
    @Override
    public void onError(int code, String message) {
       
    }
        //广告物料加载完成的回调
    @Override
    public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ad)   {
       
    } 
   //广告视频本地加载完成的回调,接入方可以在这个回调后直接播放本地视频
    @Override
    public void onFullScreenVideoCached() {
           
   }
);

TTFullScreenVideoAd

Method Parameter Description
Void setFullScreenVideoAdInteractionListener(TTFullScreenVideoAd.FullScreenVideoAdInteractionListener var1) TTFullScreenVideoAd.FullScreenVideoAdInteractionListener var1 Method description: Register interactive callback for interstitial ads
Parameter description: listener interactive listener
void setDownloadListener(TTAppDownloadListener var1) TTAppDownloadListener var1 Method description: download callback of registered advertisement
Parameter description: listener download status callback
int getInteractionType() No Method description: get the interactive type of the ad
Parameter description
2: Open in the browser (normal type)
3: Landing page (common type)
4: Application download
5: Make a call
-1: Unknown type
@MainThread void showFullScreenVideoAd(Activity var1) Activity var1 Method description: display full screen video interface
Parameter description: Activity: host activity
void showFullScreenVideoAd(Activity var1, RitScenes var2, String var3) Activity var1, RitScenes var2, String var3 Method description: display full screen video interface
Parameter description:
Activity: host activity
RitScenes: The scene where the ad is displayed
String: When the advertisement display scene is CUSTOMIZE_SCENES, the customized scene information
void setShowDownLoadBar(boolean var1) boolean var1 Method description: set display download bar
Parameter description: boolean type
True
false
Map<String, Object> getMediaExtraInfo() No Method description: return additional information about the ad
Parameter description: none
int getFullVideoAdType() No Method description: return the true type of the ad
Parameter description
TTAdConstant.AD_TYPE_UNKNOWN = -1;//Unknown type
TTAdConstant.AD_TYPE_COMMON_VIDEO //Ordinary video type
TTAdConstant.AD_TYPE_PLAYABLE_VIDEO //video + playable type
TTAdConstant.AD_TYPE_PLAYABLE //playable type
long getExpirationTimestamp() No Method description: Return the expiration time of the validity period. After this point in time, the advertisement is considered expired. Developers can use this interface to determine the current advertisement and when it expires
Parameter description: none
public interface FullScreenVideoAdInteractionListener No See FullScreenVideoAdInteractionListener description

FullScreenVideoAdInteractionListener

Method Description
onAdShow() Ad display callback
onAdVideoBarClick() Advertisement download bar click callback
onAdClose() Ad close callback
onVideoComplete() Video playback complete callback
onSkippedVideo() Skip video playback callback

FullScreenVideoAdListener

Method Description
onError() Advertisement request failed callback The returned error code (code) indicates the reason why the advertisement request failed. For details, please see https://www.pangle.cn/support/doc/5de4cc6d78c8690012a90aa5?from=ad.oceanengine.com&id=5de4cc6d78c8690012a90aa5
onFullScreenVideoAdLoad() Callback when ad loading is complete
onFullScreenVideoCached() Callback for the completion of the local loading of the advertising video, the access party can directly play the local video after this callback
onFullScreenVideoCached(TTFullScreenVideoAd ad) The callback for the completion of the local loading of the ad video, the local video can be played directly after the callback, and the parameter object can be used to play directly

Note: For the smoothness of the advertising video material, it is recommended to call the showFullScreenVideoAd method in the main thread to display the advertisement after the onFullScreenVideoCached method is loaded. Set the advertising object to null in time after displaying the advertisement

if (mttFullVideoAd != null&&mIsLoaded) {
    //展示广告,并传入广告展示的场景
    mttFullVideoAd.showFullScreenVideoAd(FullScreenVideoActivity.this, TTAdConstant.RitScenes.GAME_GIFT_BONUS, null);
    mttFullVideoAd = null;
} else {
    TToast.show(FullScreenVideoActivity.this, "请先加载广告");
}

Advertising interaction listener

mttFullVideoAd.setFullScreenVideoAdInteractionListener(new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() {
        //广告的展示回调
    @Override
    public void onAdShow() {
       
    }
        //广告的下载bar点击回调
    @Override
    public void onAdVideoBarClick() {

   }
        //广告关闭的回调
    @Override
    public void onAdClose() {
       
    }
        //视频播放完毕的回调
    @Override
    public void onVideoComplete() {
       
    }
        //跳过视频播放
    @Override
    public void onSkippedVideo() {

    }
});

Destroy the ad object

//在Activity的onDestroy方法中清空广告对象
 @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mttFullVideoAd != null) {
           mttFullVideoAd = null;
       }
    }

Reference Demo
For full-screen video ads, please refer to the FullScreenVideoActivity example in the demo

Did the content solve your problem?
Contact us