Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCSProxyTask 如何强制取消 #44

Open
ko1o opened this issue May 3, 2022 · 2 comments
Open

MCSProxyTask 如何强制取消 #44

ko1o opened this issue May 3, 2022 · 2 comments

Comments

@ko1o
Copy link

ko1o commented May 3, 2022

哈喽,大佬,咨询下 如果是快速滑动切换短视频(类似视频号)这种场景,如果取消掉快速滑动过程中的task,我这边测试发现任务堆积导致快速滑动后停止,视频播放会等待较久才可以播放(大于5秒)

@changsanjiang
Copy link
Owner

你看看播放器是否释放掉了, 正常来说不需要手动取消, 当 AVPlayer 被释放掉后, 相应的请求任务也就自动就取消了;

@ko1o
Copy link
Author

ko1o commented May 4, 2022

这里player 不会被释放会被 pause 或 stop 这时候 我会通过调用如下代码清理请求任务 但发现task并没有取消

    [avplayer pause];
    [avplayer.currentItem cancelPendingSeeks];
    [avplayer.currentItem.asset cancelLoading];
    avplayer.currentItem.preferredForwardBufferDuration = 0.01;
    [avplayer replaceCurrentItemWithPlayerItem:nil];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants