//
//  ERTCVideoLoadingView.m
//  ERTCDemo
//
//  Created by wangjinlong23 on 2022/5/21.
//

#import "ERTCVideoLoadingView.h"

@interface ERTCVideoLoadingView ()
@property (nonatomic, strong) UIActivityIndicatorView *activityView;
@end

@implementation ERTCVideoLoadingView

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor blackColor];
        [self addSubview:self.activityView];
        [self.activityView ysmas_makeConstraints:^(YSMASConstraintMaker *make) {
            make.center.equalTo(self);
        }];
        [self beaginLoading];
    }
        return self;
}

- (void)beaginLoading {
    [self.activityView startAnimating];
}

- (void)stopLoading {
    [self.activityView stopAnimating];
}

#pragma mark - getter
-(UIActivityIndicatorView *)activityView
{
    if (!_activityView) {
            _activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyleWhiteLarge)];
    }
    
    return _activityView;
}

@end
