作者MiaShopgirl ( )
看板MacDev
标题[问题] 有影片的 UIWebView 放?进 Contro Center
时间Wed Jul 8 17:32:57 2015
敝人不才,刚接触 iOS 几个月,
The Big Nerd Ranch Guide 的书还没啃完,遇上一个超没头绪的难题
斗胆向各位先进请教
当播过放在
UIWebView 里面的影片後,
Control Center 会自动地
有这部影片的资讯,以及拨放控制
想多了解这个奇幻功能的成因,进而关掉它!!XD
主要是因为 app 本身除了放
UIWebView 之外,还提供音乐播放的功能
然後现在只要播过影片(有些网页只有 load, 还没播)
Contrl Center 就GG(失去控制)了...T_T
目前踹到用
AVPlayerItemBecameCurrentNotification 去注册 Notification
取得更换曲目的
AVPlayerItem
[[
NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(avPlayerItemBecameCurrent:)
name:@"AVPlayerItemBecameCurrentNotification"
object:nil];
可以转成
AVPlayerItem, 从
AVURLAsset 里面的
URL 分辨敌我後
再把
playerItemTrack.enabled 设成
NO
但这只适用在播过的影片,想请教各位大大能否提供线索,揪竟
UIWebView 怎麽放?, 放了什麽宝贝在
Control Center 里面呢..?
[update]
目前学到 method swizzling 用来过滤
MPRemoteCommand addTargetWithHandler:
MPMoviePlayerController setNowPlayingInfo:
暂时解掉这问题罗!!!
感谢版友 Daidouji 的热心协助,小小专案放在下方,
若有其他解希望不吝指教喔 <(_ _)>
https://github.com/MiaShopgal/HelloJukebox
https://github.com/DaidoujiChen/HelloJukeBox/tree/hotfix/fix_webview_issue
※ 编辑: MiaShopgirl (114.32.163.6), 07/20/2015 10:04:06