Substituindo MPNowPlayingInfoCenter ao usar o WKWebView
Estou tentando criar um reprodutor de música de várias fontes com faixas do YouTube e do Soundcloud e gostaria de substituir o conteúdo do MPNowPlayingInfoCenter para fornecer informações sobre os artistas / lançamentos em vez do nome do vídeo do YouTube.
Tudo funcionou bem quando usei o UIWebview, mas por motivos de desempenho, tive que mudar para o novo WKWebview e agora o método que usei antes para definir o nowPlayingInfos não tem efeito
Existe uma maneira de desativar o mapeamento automático do<audio>
e<video>
tags dentro do HTML e / ou substituir as informações fornecidas com minhas informações?
Aqui está o código que eu uso, que funciona no iOS 7 e funcionou no iOS 8 quando usei o UIWebview:
let newInfos = [
MPMediaItemPropertyTitle: (currentPlaylist[currentPlaylistIndex] as! Track).trackName,
MPMediaItemPropertyArtist: (currentPlaylist[currentPlaylistIndex] as! Track).trackArtist,
MPMediaItemPropertyPlaybackDuration: NSNumber(integer: self.getDuration()),
MPNowPlayingInfoPropertyElapsedPlaybackTime: NSNumber(integer: self.getCurrentTime()),
MPNowPlayingInfoPropertyPlaybackRate: NSNumber(double: self.playing ? 1.0 : 0.0),
MPMediaItemPropertyArtwork: MPMediaItemArtwork(image: image)
]
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = newInfos
Verifiquei se nenhuma das variáveis que utilizo é nula e ativei minha AudioSession no AppDelegate
var audioSession = AVAudioSession.sharedInstance()
var error : NSError?
audioSession.setCategory(AVAudioSessionCategoryPlayback, error: &error)
audioSession.setActive(true, error: &error)
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
Alguma ideia?