Playing video causes audio session interruption later...

I am having a really strange problem with iOS 11.3 beta 2. I am playing a video using AV Player by adding a layer to a view controller. The test device is an iPhone X. When I run the same code, on an iPhone 6s with IOS 11.2.5, the problem does not happen. The app is combinaiton of Swift & Objective-C.

If I remove the video playback, the problem does not occur on the iPhone X.


When the app advances to the main scene, audio stops working after playing for about a second. The app is playing back audio using the Superpowered SDK. An audio seesion interuption events is happening.


        let path = Bundle.main.path(forResource: "intro", ofType: "mp4")
        let url  = NSURL.fileURL(withPath: path!)
        introPlayer = AVPlayer(url: url)
        if let introPlayer = introPlayer {
            introPlayer.allowsExternalPlayback = false
            let introPlayerLayer = AVPlayerLayer(player: introPlayer)
            introPlayerLayer.videoGravity = .resizeAspectFill
            self.view.layer.addSublayer(introPlayerLayer)
     
            introPlayerLayer.frame = self.view.bounds
            /
            NotificationCenter.default.addObserver(self, selector: #selector(didFinishPlaying(notification:)), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: introPlayer.currentItem)
        }


Here is the code to advance to the app's home scene:


    func done() {
        let playerLayer = AVPlayerLayer(player: introPlayer)
        playerLayer.removeFromSuperlayer()
        self.performSegue(withIdentifier: "homeScene",  sender: self)
    }


Here is the code from the Superpwoered SDK that is getting the audio session interupt event:


- (void)onAudioSessionInterrupted:(NSNotification *)notification {
    NSNumber *interruption = [notification.userInfo objectForKey:AVAudioSessionInterruptionTypeKey];
    if (interruption) {
        switch ([interruption intValue]) {
        case AVAudioSessionInterruptionTypeBegan:
            if (audioUnitRunning) [self performSelectorOnMainThread:@selector(startDelegateInterrupt) withObject:nil waitUntilDone:NO];
            [self beginInterruption];
            break;
         
        case AVAudioSessionInterruptionTypeEnded:
            [self endInterruption];
            break;
        }
    }
}


And some odd debug is being emitted - it may not be relevant.

18-02-11 13:19:12.122683-0800 CURATE[6408:2826695] [] /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMedia/EmbeddedCoreMedia-2275.38.1/Prototypes/VisualContexts/FigVideoContainerLayer.m -[FigVideoContainerLayer init]: Fallback image for App Switcher has not been added to the layer tree!

2018-02-11 13:19:12.157025-0800 CURATE[6408:2826787] [] <<<< Async >>>> playerasync_runAsynchronousCommandOnQueue: Command 3 returned -12784; this async error will be discarded