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

弹幕暂停出问题+卡顿(急) #70

Open
13167281921 opened this issue Aug 20, 2017 · 3 comments
Open

弹幕暂停出问题+卡顿(急) #70

13167281921 opened this issue Aug 20, 2017 · 3 comments

Comments

@13167281921
Copy link

1.视频连续切换码流后,弹幕非常卡(视频播放正常)
2.弹幕在暂停的时候,暂停了5分钟,就丢失了5分钟弹幕,5分钟后弹幕又出现,而且时间跟播放时间可以对应的上,具体如下:
首先,获取后台给到的弹幕数据barrageArray,这是一个数组形式给到我们客户端,for循环里面用receive方法把弹幕一个一个加进去;但是,当暂停播放同时暂停弹幕,然后继续播放的时候,我们暂停时间的弹幕全部丢失。
[barrages enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {

            [self.barrageModel setValuesForKeysWithDictionary:obj];//字典转化为barrage对象
            if (CMTimeGetSeconds(self.videoPlayer.currentTime) < [self.barrageModel.time integerValue]) {
                SendBarrageType location = [self.barrageModel.location integerValue] ;// 接收到的弹幕位置
                NSInteger delay = [self.barrageModel.time integerValue] - CMTimeGetSeconds(self.videoPlayer.currentTime);//delay时间
                if (location == SendBarrageTypeDefault) {
                    [self.barrageRenderer receive: [self walkTextSpriteDescriptorWithDelay:delay barrageModelBool:YES]];//加载滚动弹幕
                }else{
                    BarrageFloatDirection direction = location == SendBarrageTypeTop ? BarrageFloatDirectionT2B : BarrageFloatDirectionB2T;
                    [self.barrageRenderer receive: [self FloatBarrage:direction delay:delay barrageModelBool:YES]];//加载浮动弹幕
 }
                    
            }
            
        }];
@unash
Copy link
Owner

unash commented Aug 20, 2017

  1. 感觉是CPU占用过高所致,看看cpu、gpu的数据
  2. 所需要的效果,是在视频暂停的时候,也需要播放弹幕?

@13167281921
Copy link
Author

1.cpu占用22-30%左右。
2.问题已经解决,是我乱调用您- (NSTimeInterval)timeForBarrageRenderer:(BarrageRenderer *)renderer方法引起的。

@13167281921
Copy link
Author

卡顿的仍然在,不过问题2弹幕在暂停的时候的问题已解决。

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