CNVideoModel.m
3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// 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