I ran into the same issue with my application that plays audio using AVAudioPlayer . This application displays the current audio information in MPNowPlayingInfoCenter during playback. My requirement was to show html5 video ads (with sound) inside webview on top of my player.
At first I used only UIWebView , because I needed to support iOS7, but I met a lot of problems, one of them was MPNowPlayingInfoCenter , which displays the URL of the advertising video instead of the current native audio playback. I tried several solutions like swizzling method on UIWebView without any success.
I found only one solution that works for me: use the default WKWebView instead of the UIWebView web container. HTML5 video playback will no longer interact with MPNowPlayingInfoCenter , I also had to support iOS7, so I created a wrapper class to switch between UIWebView (still a problem) on iOS7 and WKWebView with iOS8 or more.
Hope this helps.
source share