Changing playerItem of AVPlayer in UITableView

前端 未结 3 1858
我寻月下人不归
我寻月下人不归 2020-12-23 19:47

I have a UITableView containing a number of videos to play when scrolling. As the cells in the tableView are being re-used, I only instantiate one AVPlaye

3条回答
  •  生来不讨喜
    2020-12-23 20:49

    You should profile your app using the time profiler to see where the lagging is actually occurring.

    The documentation for replaceCurrentItemWithPlayerItem: clearly states that it executes asynchronously, so it shouldn't be the source of your main queue jumpiness.

    The item replacement occurs asynchronously; observe the currentItem property to find out when the replacement will/did occur.

    Documentation here

    If you still can't figure it out, post more code, and in particular at least your cellForRowAtIndexPath method.

    UPDATE

    As per @joey's comment below, the previous content of this answer is no longer valid. The documentation no longer states that the method is asynchronous, so it may not be.

提交回复
热议问题