# Playback Issue with advertisements

**URL:** <https://community.bitmovin.com/t/playback-issue-with-advertisements/2224>\
**Category:** Support\
**Created:** [August 4, 2023, 4:12pm UTC](https://community.bitmovin.com/t/playback-issue-with-advertisements/2224 "2023-08-04T16:12:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![praveen.balpande84](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@praveen.balpande84](https://community.bitmovin.com/u/praveen.balpande84)\
**Post date:** [August 4, 2023, 4:12pm UTC](https://community.bitmovin.com/t/playback-issue-with-advertisements/2224/1 "2023-08-04T16:12:29Z")

</div>

Hi,

In our iOS app playback is not working with Advertisements, we are getting onReady event, but there is black window with pre roll advertisement.

We followed the basic ad sample and implemented as per that.

Without AdvertisingConfig playback working fine.

We are creating AdConfig as below

**guard**  **let** tagUrl = URL(string: tag) **else** { **return**  **nil** }

**let** adSource = AdSource(tag: tagUrl, ofType: .ima)

**let** preRoll = AdItem(adSources: [adSource], atPosition: “pre”)

**let** adConfig = AdvertisingConfig(schedule: [preRoll])

playerConfig.advertisingConfig = adConfig

---

<div class="post-metadata">

**Author:** ![seven](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@seven](https://community.bitmovin.com/u/seven)\
**Post date:** [August 7, 2023, 2:26am UTC](https://community.bitmovin.com/t/playback-issue-with-advertisements/2224/2 "2023-08-07T02:26:40Z")

</div>

@praveen.balpande84 Thank you for your query. I tested the sample app using 1 & 2 below and Playback is OK. I suggest testing YOUR CODE with the Bitmovin Github

1 [sample ad url](https://github.com/bitmovin/bitmovin-player-ios-samples/blob/572e4dd26ad2b96f078f6a3013d760588bcb4846/BasicAds/BasicAds/ViewController.swift#L28C1-L51C1) AND  
2. sample code

```auto
        // Define needed resources
        guard let streamUrl = URL(string: "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8") else {
            return
        }
        
        // Create player configuration
        let config = PlayerConfig()

        let uiConfig = BitmovinUserInterfaceConfig()
        uiConfig.hideFirstFrame = true
        config.styleConfig.userInterfaceConfig = uiConfig

        // Create Advertising configuration
        let adSource1 = AdSource(tag: urlWithCorrelator(adTag: adTagVastSkippable), ofType: .ima)
        let adSource2 = AdSource(tag: urlWithCorrelator(adTag: adTagVast1), ofType: .ima)
        let adSource3 = AdSource(tag: urlWithCorrelator(adTag: adTagVast2), ofType: .ima)
        
        let preRoll = AdItem(adSources: [adSource1], atPosition: "pre")
        let midRoll = AdItem(adSources: [adSource2], atPosition: "20%")
        let postRoll = AdItem(adSources: [adSource3], atPosition: "post")
        
        let adConfig = AdvertisingConfig(schedule: [preRoll, midRoll, postRoll])
        config.advertisingConfig = adConfig

```

Please let us know your test result using 1 & 2 in your app.
