Difference between revisions of "IOS Video 4.1.0"

From AdLocus
Jump to: navigation, search
(Created page with "== 前言 == 影音版位將以曝光次數高分潤,是您提高收益的最好單元之一。 == 實作 == * @interface ViewController : UIViewController <ALVideoDelegat...")
 
Line 5: Line 5:
 
* @interface ViewController : UIViewController <ALVideoDelegate>
 
* @interface ViewController : UIViewController <ALVideoDelegate>
 
* @property (nonatomic, strong) ALVideo *video;
 
* @property (nonatomic, strong) ALVideo *video;
* - (void) videoDidReceive:(ALVideo *)request
+
* - (void) videoDidReceive:(ALVideo *)video
  
  
Line 11: Line 11:
 
在您想啟用影音版位的流程中, 加入下列程式碼
 
在您想啟用影音版位的流程中, 加入下列程式碼
 
<syntaxhighlight lang="objc">
 
<syntaxhighlight lang="objc">
     video= [[ALVideo alloc] initWithViewController:self delegate:self];
+
     self.video = [[ALVideo alloc] initWithViewController:self delegate:self];
 
     [video load];
 
     [video load];
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 14:55, 2 June 2016

前言

影音版位將以曝光次數高分潤,是您提高收益的最好單元之一。

實作

  • @interface ViewController : UIViewController <ALVideoDelegate>
  • @property (nonatomic, strong) ALVideo *video;
  • - (void) videoDidReceive:(ALVideo *)video


啟用插頁式版位

在您想啟用影音版位的流程中, 加入下列程式碼

    self.video = [[ALVideo alloc] initWithViewController:self delegate:self];
    [video load];

並透過監聽結果啟用影音插屏

- (void) videoDidReceive:(ALVideo *)video
{
    NSLog(@"Receive AdLocus Video Ad.");
    [video show];
}

若您需要監聽廣告互動結果

透過實作 ALVideoDelegate 監測廣告運行結果

  • videoDidReceive
  • videoDidEnd
- (void) videoDidReceive:(ALVideo *)video
{
    NSLog(@"Receive AdLocus Video Ad.");
    [video show];
}
 
- (void) videoDidEnd:(ALVideo *)video
{
    NSLog(@"End AdLocus Video Ad.");
}