CNVideoModel.m 3.92 KB
//
//  CNVideoModel.m
//  BBASMDemo_Example
//
//  Created by CNLive on 2021/10/30.
//  Copyright © 2021 杨苓玉. All rights reserved.
//

#import "CNVideoModel.h"
#import <BBAMNP/BBAMNP.h>

@implementation CNVideoModel
- (CNVideoModel *)initWithDictionary:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        [self loadWithDictionary:dic];
    }
    return self;
}

- (void)updateWithDictionary:(NSDictionary *)dic {
    [self loadWithDictionary:dic];
}

- (void)loadWithDictionary:(NSDictionary *)dic {
    if (CHECK_DICTIONARY_VALID(dic)) {
        if ([dic bdp_safeStringValueForKey:@"appId"]) {
            _appId =[dic bdp_safeStringValueForKey:@"appId"];
        }
        if ([dic bdp_safeStringValueForKey:@"vid"]) {
            _vid = [dic bdp_safeStringValueForKey:@"vid"];
        }
        if ([[dic bdp_safeNumberValueForKey:@"videoGravity"] integerValue]) {
            _videoGravity = [[dic bdp_safeNumberValueForKey:@"videoGravity"] integerValue];
        }
        if ([dic bdp_safeStringValueForKey:@"videoUrl"]) {
            _videoUrl = [dic bdp_safeStringValueForKey:@"videoUrl"];
        }
        if ([[dic bdp_safeNumberValueForKey:@"duration"] integerValue]) {
            _duration = [[dic bdp_safeNumberValueForKey:@"duration"] integerValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"muted"]) {
            _muted = [[dic bdp_safeNumberValueForKey:@"muted"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showControls"]) {
            _showControls = [[dic bdp_safeNumberValueForKey:@"showControls"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"brightnessVolumeGestureEnabled"]) {
            _brightnessVolumeGestureEnabled = [[dic bdp_safeNumberValueForKey:@"brightnessVolumeGestureEnabled"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showFullscreenBtn"]) {
            _showFullscreenBtn = [[dic bdp_safeNumberValueForKey:@"showFullscreenBtn"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showRateBtn"]) {
            _showRateBtn = [[dic bdp_safeNumberValueForKey:@"showRateBtn"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"loop"]) {
            _loop = [[dic bdp_safeNumberValueForKey:@"loop"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showProgress"]) {
            _showProgress = [[dic bdp_safeNumberValueForKey:@"showProgress"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showCenterPlayBtn"]) {
            _showCenterPlayBtn = [[dic bdp_safeNumberValueForKey:@"showCenterPlayBtn"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showPlayBtn"]) {
            _showPlayBtn = [[dic bdp_safeNumberValueForKey:@"showPlayBtn"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showMuteBtn"]) {
            _showMuteBtn = [[dic bdp_safeNumberValueForKey:@"showMuteBtn"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"enableProgressGesture"]) {
            _enableProgressGesture = [[dic bdp_safeNumberValueForKey:@"enableProgressGesture"] boolValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"enablePlayGesture"]) {
            _enablePlayGesture = [[dic bdp_safeNumberValueForKey:@"enablePlayGesture"] boolValue];
        }
        if ([[dic bdp_safeNumberValueForKey:@"seekSeconds"] integerValue]) {
            _initialTime = [[dic bdp_safeNumberValueForKey:@"seekSeconds"] integerValue];
        }
        if ([[dic bdp_safeNumberValueForKey:@"videoGravity"] integerValue]) {
            _videoGravity = [[dic bdp_safeNumberValueForKey:@"videoGravity"] integerValue];
        }
        if ([dic bdp_safeObjectForStringKey:@"showMoreMenuBtn"]) {
            _showVslideBtnInFullscreen = [[dic bdp_safeNumberValueForKey:@"showMoreMenuBtn"] boolValue];
        }
        if ([dic bdp_safeStringValueForKey:@"title"]) {
            _title = [dic bdp_safeStringValueForKey:@"title"];
        }
    }
}
@end