FBAudienceNetwork : FBMediaView freeze ui when displaying video

不羁的心 提交于 2020-01-23 13:15:09

问题


When I do this code, the FbMediaView is like loading the ads video on the main thread but it's not freezing when displaying an image. I don't understand why ?

let nativeAd = self.adsManager.nextNativeAd()
    let cell : AdHomeCell? = self.collectionView!.dequeueReusableCellWithReuseIdentifier("AdHomeCell", forIndexPath: indexPath) as? AdHomeCell
    cell?.createForAd(nativeAd)
    nativeAd?.registerViewForInteraction(cell!, withViewController: self)
    return cell

I have the latest Facebook SDK (4.8.0)


回答1:


The Audience Network iOS SDK uses AVFoundation internally to play video ads. Initializing an AVAsset does a lot of work on the main thread. The main thread handles all UI updates on iOS, so this results in visible pausing, particularly when loading multiple video ads. There is no way to offload that work to a different thread without using private API.

We're aware of the performance impact. We're deploying some short term marginal improvements in v4.9, and we're working on a long term fix. Right now, it is not recommended to use video ads in certain apps that need high levels of scrolling performance.

(I'm a software engineer on Audience Network, and develop the iOS SDK.)



来源:https://stackoverflow.com/questions/34677164/fbaudiencenetwork-fbmediaview-freeze-ui-when-displaying-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!