云课堂场景 互动
Updated: 2023-04-17 15:27:57
1 Feature Overview
The interactive features include announcements, check-ins, lucky draws, answer sheets, and surveys. These features are implemented in PLVLCCloudClassViewControllerr and are realized by integrating PLVInteractView from 7_6-Core Common-Interaction.
2 Implementation Introduction
To implement interactive features in the cloud classroom scenario, simply add PLVInteractView to the page and call its initialization method to complete the integration.
When the host initiates features such as lucky draws, the interactive application interface will automatically appear.
The example code is as follows:
/// PLVLCCloudClassViewControllerr.m
@property (nonatomic, strong) PLVInteractView *interactView; // 互动
- (void)setupModule{
PLVRoomData *roomData = [PLVRoomDataManager sharedManager].roomData;
if (roomData.videoType == PLVChannelVideoType_Live) {
/// 直播
/// 注册互动通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationForOpenBulletin:) name:PLVLEChatroomOpenBulletinNotification object:nil];
} else if (roomData.videoType == PLVChannelVideoType_Playback){
/// 回放
}
}
- (void)setupUI{
if (roomData.videoType == PLVChannelVideoType_Live) {
/// 直播
/// 互动
[self.view addSubview:self.interactView];
/// 互动配置
self.interactView.frame = self.view.bounds;
self.interactView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.interactView loadOnlineInteract];
} else if (roomData.videoType == PLVChannelVideoType_Playback){
/// 回放
}
}
- (PLVInteractView *)interactView{
PLVChannelVideoType videoType = [PLVRoomDataManager sharedManager].roomData.videoType;
if (!_interactView && videoType == PLVChannelVideoType_Live) {
_interactView = [[PLVInteractView alloc] init];
_interactView.frame = self.view.bounds;
_interactView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[_interactView loadOnlineInteract];
}
return _interactView;
}
- (void)notificationForOpenBulletin:(NSNotification *)notif {
[self.interactView openLastBulletin];
}
