「InStream iOS Developer Guide」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
imported>Wikiuser
imported>Wikiuser
 
行 30: 行 30:
     [self.adsLoader requestAdsWithRequest:request];
     [self.adsLoader requestAdsWithRequest:request];
== 注意事項 ==
== 注意事項 ==
:IMA iOS SDK限制行動網路最高使用300kbit/s若是要改變bitrate可在IMAAdsRenderingSettings物件設定 (參考:https://developers.google.com/interactive-media-ads/docs/sdks/ios/bitrates-formats)
:1.IMA iOS SDK限制行動網路最高使用300kbit/s若是要改變bitrate可在IMAAdsRenderingSettings物件設定 (參考:https://developers.google.com/interactive-media-ads/docs/sdks/ios/bitrates-formats)
     IMAAdsRenderingSettings *settings = [[IMAAdsRenderingSettings alloc] init];
     IMAAdsRenderingSettings *settings = [[IMAAdsRenderingSettings alloc] init];
     settings.bitrate = 1024;  // kbits
     settings.bitrate = 1024;  // kbits
     settings.mimeTypes = @[ @"video/mp4", @"application/x-mpegURL"];
     settings.mimeTypes = @[ @"video/mp4", @"application/x-mpegURL"];
     [self.adsManager initializeWithContentPlayhead:nil adsRenderingSettings:settings];
     [self.adsManager initializeWithContentPlayhead:nil adsRenderingSettings:settings];
<br>
:2.IMA iOS SDK提供兩種方式開啟廣告:in-app browser或外開safari,可在IMAAdsRenderingSettings物件設定(若是使用in-app browser需在plist內增加NSAppTransportSecurity設定,將NSAllowsArbitraryLoads設為YES)
:IMA iOS SDK提供兩種方式開啟廣告:in-app browser或外開safari,可在IMAAdsRenderingSettings物件設定(若是使用in-app browser需在plist內增加NSAppTransportSecurity設定,將NSAllowsArbitraryLoads設為YES)
     IMAAdsRenderingSettings *settings  = [[IMAAdsRenderingSettings alloc] init];
     IMAAdsRenderingSettings *settings  = [[IMAAdsRenderingSettings alloc] init];
     settings.webOpenerPresentingController = self;
     settings.webOpenerPresentingController = self; //增加此設定後廣告將使用in-app browser開啟


== 下載 ==
== 下載 ==

於 2018年10月31日 (三) 08:44 的最新修訂

功能說明

InStream套件是提供回傳VAST格式(Digital Video Ad Serving Template)URL的套件。可配合Google IMA SDK或其他支援VAST格式的Library展示InStream Video廣告。

系統需求

  • iOS 8.0或以上的版本
  • Xcode 7或以上的版本

整合至應用程式

  1. TADVastAdUtil.framework加入iOS Project中
  2. 確認TADVastAdUtil.framework有成功加入
    Vast1.png

開始使用

以Google IMA SDK為例 (IMA sample download link:https://developers.google.com/interactive-media-ads/docs/sdks/ios/download)
加入@import TADVastAdUtil;
在IMA SDK請求廣告的地方加入以下代碼,將TADVastURLCreator產生出來的URL帶入Google request AdTagUrl內
   /******* TAMedia Begin 只產生VAST URL 其餘是由IMA完成 *******/
   NSString *vastUrl = [TADVastURLCreator createTADVastURLWithOriginalUrl:<TAMedia提供的原始URL> testMode:<是否使用測試廣告>];
   NSLog(@"Vast URL:%@",vastUrl);
   /******* TAMedia End *******/
   /******* 以下為Google IMA *******/    
   // Create an ad display container for ad rendering.
   IMAAdDisplayContainer *adDisplayContainer =
   [[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView companionSlots:nil];
   // Create an ad request with our ad tag, display container, and optional user context.
   IMAAdsRequest *request = [[IMAAdsRequest alloc] initWithAdTagUrl:vastUrl
                                                 adDisplayContainer:adDisplayContainer
                                                    contentPlayhead:self.contentPlayhead
                                                        userContext:nil];
   [self.adsLoader requestAdsWithRequest:request];

注意事項

1.IMA iOS SDK限制行動網路最高使用300kbit/s若是要改變bitrate可在IMAAdsRenderingSettings物件設定 (參考:https://developers.google.com/interactive-media-ads/docs/sdks/ios/bitrates-formats)
   IMAAdsRenderingSettings *settings = [[IMAAdsRenderingSettings alloc] init];
   settings.bitrate = 1024;  // kbits
   settings.mimeTypes = @[ @"video/mp4", @"application/x-mpegURL"];
   [self.adsManager initializeWithContentPlayhead:nil adsRenderingSettings:settings];
2.IMA iOS SDK提供兩種方式開啟廣告:in-app browser或外開safari,可在IMAAdsRenderingSettings物件設定(若是使用in-app browser需在plist內增加NSAppTransportSecurity設定,將NSAllowsArbitraryLoads設為YES)
   IMAAdsRenderingSettings *settings  = [[IMAAdsRenderingSettings alloc] init];
   settings.webOpenerPresentingController = self; //增加此設定後廣告將使用in-app browser開啟

下載

Version Package Size Notes
1.0.0 TADVastAdUtil.framework.zip 121 KB 1.0.0
Demo VastAdDemo.zip 3.79 MB 1.0.0版本Demo

回InStream首頁