<img src="https://img.shields.io/badge/%20-ENTERPRISE-B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/iOS-V4-009727?logo=apple" style="float:left"/><br />
You can listen for ad events by assigning a delegate to the JWP `
adDelegate` property. These events are surfaced using the following method.
player` is the instance of `
JWPlayer` which has emitted the event. The event is an instance of `
JWAdEvent` which supplies the following information:
Client: This is the ad client being used to present the ad. This is represented as a `
JWAdClient` enumeration value.
Type: This is the type of event. This is represented as a `
JWAdEventType` enumeration value.
The <a href="https://docs.jwplayer.com/players/docs/ios-event-properties-reference#jwaddelegate" target="_blank">properties</a> for the ad event can be queried using a subscript operator. The key for the subscript is a `
JWEventKey` enumeration type. The subscript returns an optional type `
Any?` that must be typecast into a type when retrieved.
If a property is not available, `
nil` is returned.
For a list of types returned for each property, refer to the header documentation for `
JWAdEventKey` or the [Event Properties Reference](🔗).
<br /> <hr />
<br /> <hr />
## Listen for ad events
When listening for ad events, you can use the `
JWPlayerViewController` or `
When using the `
JWPlayerViewController`, use the following steps to listen for ad events within your content:
Create a subclass of `
Override the ad event method to listen for and handle ad events from the SDK.
<br /> <br />
When using `
JWPlayerView` and creating your own interface, use the following steps to listen for ad events within your content:
Instantiate an instance of `
Assign a delegate object, which conforms to `
Listen for ad events in your ad delegate.