forked from AgoraIO/API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoView.m
More file actions
108 lines (83 loc) · 2.28 KB
/
VideoView.m
File metadata and controls
108 lines (83 loc) · 2.28 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// VideoView.m
// APIExample
//
// Created by zhaoyongqiang on 2023/7/11.
//
#import "VideoView.h"
@implementation NSBundle (LoadView)
+ (UIView *)loadViewFormNib: (NSString *)name {
UIView *view = [[NSBundle mainBundle] loadNibNamed:name owner:nil options:nil].firstObject;
return view;
}
+ (UIView *)loadVideoViewFormType: (StreamType)type audioOnly: (BOOL)audioOnly {
VideoView *view = (VideoView *)[NSBundle loadViewFormNib:@"VideoView"];
view.audioOnly = audioOnly;
view.type = type;
return view;
}
@end
@interface VideoView ()
@property (weak, nonatomic) IBOutlet UILabel *placeholderLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@property (weak, nonatomic) IBOutlet UILabel *statsLabel;
@end
@implementation VideoView
-(void)setPlaceholder: (NSString *)text {
self.placeholderLabel.text = text;
}
- (void)setUid:(NSUInteger)uid {
_uid = uid;
if (uid <= 0) {
self.infoLabel.text = @"";
return;
}
self.infoLabel.text = [NSString stringWithFormat: @"uid: %lu",uid];
}
- (void)setInfo: (NSString *)text {
self.infoLabel.text = text;
}
- (void)setStats:(NSString *)stats {
self.statsLabel.text = stats;
}
@end
@interface SampleBufferDisplayView ()
@property (weak, nonatomic) IBOutlet UILabel *placeholderLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@end
@implementation SampleBufferDisplayView
-(void)setPlaceholder: (NSString *)text {
self.placeholderLabel.text = text;
}
- (void)setUid:(NSUInteger)uid {
_uid = uid;
if (uid <= 0) {
self.infoLabel.text = @"";
return;
}
self.infoLabel.text = [NSString stringWithFormat: @"uid: %lu",uid];
}
- (void)setInfo: (NSString *)text {
self.infoLabel.text = text;
}
@end
@interface MetalVideoView ()
@property (weak, nonatomic) IBOutlet UILabel *placeholderLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@end
@implementation MetalVideoView
-(void)setPlaceholder: (NSString *)text {
self.placeholderLabel.text = text;
}
- (void)setUid:(NSUInteger)uid {
_uid = uid;
if (uid <= 0) {
self.infoLabel.text = @"";
return;
}
self.infoLabel.text = [NSString stringWithFormat: @"uid: %lu",uid];
}
- (void)setInfo: (NSString *)text {
self.infoLabel.text = text;
}
@end