FBAudienceNetwork : FBMediaView freeze ui when displaying video
Asked Answered
S

1

2

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)

Salicaceous answered 8/1, 2016 at 12:28 Comment(0)
A
8

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.)

Authoritative answered 8/1, 2016 at 21:37 Comment(3)
@MattRestivo I'm planning to push out the multithreaded AVFoundation replacement in the next update, version 4.12. This update will completely eliminate visible stuttering or pausing when playing videos in FBMediaView. More details to come!Authoritative
4.12 is out today as of today. This issue should be totally fixed in this version.Authoritative
This is a long shot but i'm experiencing the exact same issue on v 5.5.0Invulnerable

© 2022 - 2024 — McMap. All rights reserved.