# CECardAd

## Overview

`CECardAd` is used to integrate ad with predefined layout.

## Interface

### `eventDelegate`

#### Declaration

```
@property (nonatomic, weak, nullable) id<CECardADEventDelegate> eventDelegate;
```

#### Discussion

Delegate which is notified by SDK when `CECardAd` triggered the ad event.

### `ad`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) Ad * ad;
```

#### Discussion

An `Ad` object containing data of the loaded ad.

### `adToken`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) NSString * adToken;
```

#### Discussion

A random identifier string generated by SDK.

### `adUIView`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) UIView * adUIView;
```

#### Discussion

The visual representation of the loaded ad. Supplied after ad is loaded.

### `coverImagePath`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) NSString * coverImagePath;
```

#### Discussion

The path to the file of cover image of the loaded ad if the loaded ad has video content.

### `aspectRatio`

#### Declaration

```
@property (nonatomic, assign, readonly) CGFloat aspectRatio;
```

#### Discussion

The aspect ratio of ad content. (Width / Height)\
**It would be** `kCEUnknownAdContentAspectRatio` **if the ad hasn't loaded.**

### `customEventExtra`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) NSDictionary * customEventExtra;
```

#### Discussion

Extra from custom event

### `- initWithVideoViewProfile`

#### Declaration

```
- (nonnull instancetype)initWithVideoViewProfile:(CEVideoViewProfile)videoViewProfile;
```

#### Parameters

| name             | description                                                                           |
| ---------------- | ------------------------------------------------------------------------------------- |
| videoViewProfile | profile for customized view. Please check CEVideoViewProfileCardMask for valid flags. |

#### Return Value

A `CECardAd` instance.

#### Discussion

init CECardAD with CEVideoViewProfile

### `- loadAdInstantWithInfo:`

#### Declaration

```objectivec
(BOOL)loadAdInstantWithInfo:(nonnull CERequestInfo *)info
                        error:(NSError **)error;
```

#### Parameters

| name  | description                                                             |
| ----- | ----------------------------------------------------------------------- |
| info  | `CERequestInfo` instance used to specify the parameters for ad request. |
| error | NSError instance used to specify the error for ad request.              |

#### Discussion

Start loading ad content process synchronously, and it will ignore the timeout in CERequestInfo.

### `- loadAdAsyncWithInfo:`

#### Declaration

```objectivec
(void)loadAdAsyncWithInfo:(nonnull CERequestInfo *)info
                reqDelegate:(id<CECardADRequestDelegate>)reqDelegate;
```

#### Parameters

| name        | description                                                             |
| ----------- | ----------------------------------------------------------------------- |
| info        | `CERequestInfo` instance used to specify the parameters for ad request. |
| reqDelegate | id<`CECardAdRequestDelegate`> instance that receive request ad event.   |

#### Discussion

Start loading ad content process asynchronously.

### `- play`

#### Declaration

```
- (void) play;
```

#### Discussion

Invoking this method marks the ad as *allowed to play*. A ad starts when it is both marked as *allowed to play* and *visible* to users.

### `- stop`

#### Declaration

```
- (void) stop;
```

#### Discussion

Invoking this method marks the ad as *not allowed to play*. A ad stops immediately when `stop` is invoked and it will never resume until `play` is invoked.

### `- mute`

#### Declaration

```
- (void) mute;
```

#### Discussion

Invoking this method turns off the volume of the ad immediately.

### `- unmute`

#### Declaration

```
- (void) unmute;
```

#### Discussion

Invoking this method turns on the volume of the ad immediately.

### `- isMute`

#### Declaration

```
- (BOOL) isMute;
```

#### Return Value

`YES` if the ad is audible; otherwise, `NO`;

### `- hasVideoContent`

#### Declaration

```
-(BOOL)hasVideoContent;
```

#### Return Value

`YES` if it is a video ad; otherwise, `NO`;

### `- getTotalFileSize`

#### Declaration

```
- (long long)getTotalFileSize;
```

#### Return Value

The total size of the creative files downloaded for this ad.
