Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
改成这样的目的是让processAsset拥有并维护自己的reader。
尝试过让原来cancelReading调用位置不动,后来发现有特定操作导致小视频拉出屏幕后还残留线程没退出。没有仔细查是什么原因,但我猜是快速划过屏幕(进出屏幕时间间隔很短)的时候processAsset中[self createAssetReader]还没执行完然后就去cancelReading,导致cancel不掉。最终改成现在这样。
简单测试过快速拖动时不会产生线程退不出来的情况,把所有小视频的view拉出可见区域后没有残留播放小视频的线程。
[PKVideoDecoder endProcessing]这个方法应该放哪里我没看太懂,可能因为代码改变需要调一下触发的位置。