繁体   English   中英

在Brightcove iOS SDK中做广告

[英]Advertising in the Brightcove iOS SDK

有谁知道如何在新的Brightcove iOS SDK中的BCPlayerView / BCVideo / BCPlayerItem中实现广告调用。 在哪里可以指定广告服务器? 这需要在Brightcove Studio中完成吗?

3.0 Brightcove iOS播放器目前没有内置广告集成。 通过Brightcove配置的广告策略仅在今天基于网络的播放器上可用,因此您必须自己做一些工作才能将该广告配置集成到iOS应用中。

为此,您需要从广告合作伙伴处获取iOS库,并从Studio中获取广告配置。 然后,您可以在希望显示广告的位置设置提示点:

// create a "before" cue point to play a pre-roll advertisement
BCCuePoint *cuePoint = [BCCuePoint 
                        cuePointWithPosition:@"before" 
                        type:@"ad"
                        properties:@{ @"adId": @"some-ad-configuration" }];
[emitter emit:BCEventSetCuePoint withDetails:@{ @"cuePoint": cuePoint }];

在显示广告之前,您需要先听提示点:

// Listen for a cue point to trigger an ad
[player.playbackEmitter on:BCEventCuePoint callBlock:^(BCEvent *event) {
    // Grab the cue point from the event
    BCCuePoint *cuePoint = [event.details objectForKey:@"cuePoint"];
    if ([cuePoint.type isEqualToString:@"ad"]) {
        [player pause];
        // Here's where you would call your native ad library to play an ad
        // This code will vary a lot depending on what ad library you're using
        [adLibrary playAd:cuePoint.properties[@"adId"]];
    }
}];

预构建的IMA和FreeWheel插件正在开发中,因此值得一问的是您是否正在使用这些提供者之一。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM