-jio-start-block-type-3
¶ Interstitial Ads-jio-style-title ¶ IntroductionInterstitial ads are full-screen advertisements that appear between two content pages or during natural breaks in the user's interaction with an application or website. These ads cover the entire screen, providing a highly immersive and attention-grabbing experience. |
![]() |
![]() |
Complete GETTING STARTED section and INITIALIZE SDK section before starting this section.
-jio-end-block-type-3
-jio-start-block-type-2
-jio-style-title
Cache the ad by initializing JioAdView
object, adding the ad view, and initiating the caching process with a single call to jioAdView?.cacheAd()
jioAdView = JioAdView(adSpotId: "<ADSPOT_KEY_GOES_HERE>", adType: .interstitial, delegate: self, forPresentionClass: self, publisherContainer: adContainer)
jioAdView?.cacheAd()
-jio-style-title
When adView.loadAd()
API is called, SDK will try to render the Ad inside the container shared.
extension InstreamVC : JIOAdViewProtocol {
func onAdPrepared(adView: JioAdView) {
self.showToast(message: "onAdDataPrepared")
adView.loadAd()
}
}
-jio-end-block-type-2
-jio-start-block-type-2
-jio-style-title
This section covers customizing interstitial ads. Ads can be image or video.
Below API need to be called to enable customization.
jioAdView?.setCustomView(container: customVideoLayout)
Add required elements with their tags to support individual functionality.
Below are the possible values for AdCategory.
• HTML_INTERSTITIAL
• NATIVE_INTERSTITIAL
• VIDEO_INTERSTITIAL
-jio-style-title
import Foundation
final public class CustomInterstitialNativeLayout:UIView {
@IBOutlet weak var contentView: UIView?
@IBOutlet weak var mediaView: UIView!
@IBOutlet weak var iconIMage: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var descriptionLabel:UILabel!
@IBOutlet weak var ctaBtn: UIButton!
@IBOutlet weak var closeBtn:UIButton!
@IBOutlet weak var adDurationLabel:UILabel!
@IBOutlet weak var playPauseBtn:UIButton!
@IBOutlet weak var muteUnmuteBtn: UIButton!
override init(frame:CGRect) {
super.init(frame:frame)
setUpNib()
}
required init?(coder:NSCoder) {
super.init(coder: coder)
setUpNib()
}
func setUpNib() {
let bundle = Bundle(for: type(of: self)).path(forResource: "CustomInterstitialNativeLayout", ofType: "nib")
guard bundle != nil else{
SDKLog("Bundle is nil")
return
}
Bundle(for: type(of: self)).loadNibNamed("CustomInterstitialNativeLayout", owner: self, options:nil)
guard let contentView = contentView else {
SDKLog("contentView is nil")
return
}
addSubview(contentView)
// contentView.backgroundColor = .red
contentView.frame = self.frame
mediaView.tag = NativeAdTags.mediaView.rawValue
iconIMage.tag = NativeAdTags.iconImageView.rawValue
titleLabel.tag = NativeAdTags.title.rawValue
descriptionLabel.tag = NativeAdTags.desc.rawValue
ctaBtn.tag = NativeAdTags.ctaButton.rawValue
closeBtn.tag = NativeAdTags.closeButton.rawValue
// playPauseBtn.tag = NativeAdTags.playPauseButton.rawValue
// adDurationLabel.tag =NativeAdTags.adDurationLbl.rawValue
// muteUnmuteBtn.tag = NativeAdTags.muteUnmuteButton.rawValue
}
}
-jio-style-title
class CustomNativeInterstitialVideoLayout: UIView {
@IBOutlet weak var contentView: UIView?
@IBOutlet var progressView: UIProgressView?
@IBOutlet var labelTimeIndicator: UILabel?
@IBOutlet var labelAdIndicator: UILabel?
@IBOutlet var btnPlayPause: UIButton?
@IBOutlet var btnClose: UIButton?
@IBOutlet var btnMuteUnMute: UIButton?
@IBOutlet weak var skipLabel: UILabel?
private var totalDuration: Int?
private var overlayAdspots = [String]()
override init(frame: CGRect) {
super.init(frame: frame)
setUpNib()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setUpNib()
}
func setUpNib() {
guard let _ = Bundle(for: type(of: self)).path(forResource: "JiogamesCustomNativeInterstitialVideoLayout", ofType: "nib") else {
SDKLog("Bundle is nil")
return
}
Bundle(for: type(of: self)).loadNibNamed("JiogamesCustomNativeInterstitialVideoLayout", owner: self, options: nil)
guard let contentView = contentView else {
SDKLog("contentView is nil")
return
}
addSubview(contentView)
contentView.frame = self.frame
contentView.tag = VideoAdControlTags.mediaView.rawValue
progressView?.tag = VideoAdControlTags.progressBar.rawValue
progressView?.tintColor = .systemOrange
labelTimeIndicator?.tag = VideoAdControlTags.adcounterLbl.rawValue
labelTimeIndicator?.textColor = .white
btnPlayPause?.tag = VideoAdControlTags.playPauseButton.rawValue
btnPlayPause?.setImage(UIImage(named: "Pause", in: Bundle(for: type(of: self)), compatibleWith: nil), for: .normal)
btnPlayPause?.setImage(UIImage(named: "play", in: Bundle(for: type(of: self)), compatibleWith: nil), for: .selected)
btnMuteUnMute?.tag = VideoAdControlTags.muteUnmuteButton.rawValue
btnMuteUnMute?.setImage(UIImage(named: "UnMute", in: Bundle(for: type(of: self)), compatibleWith: nil), for: .normal)
btnMuteUnMute?.setImage(UIImage(named: "Mute", in: Bundle(for: type(of: self)), compatibleWith: nil), for: .selected)
btnClose?.tag = VideoAdControlTags.closeButton.rawValue
labelAdIndicator?.tag = VideoAdControlTags.adBadge.rawValue
labelAdIndicator?.textColor = .white
skipLabel?.tag = VideoAdControlTags.skipLabel.rawValue
}
}
-jio-end-block-type-2