文档首页/ IdeaHub/ IdeaShare/ MAC SDK/ 典型场景/ 场景9: 设备推送
更新时间:2022-03-21 GMT+08:00
分享

场景9: 设备推送

描述

远端设备定时向客户端推送 投屏状态、辅流状态、会议状态、如果在会议中申请主席,还会推送主席状态

业务流程

  1. 处理投屏状态、辅流状态、会议状态、以及主席状态

示例代码

// 投屏状态推送IDEA_SHARE_APP_SERVER_STATUS、IDEA_SHARE_ERROR_ID枚举值参见接口参考   
- (void) onShareStatusChangeNotify : (IDEA_SHARE_APP_SERVER_STATUS) status : (IDEA_SHARE_ERROR_ID) reason  
{   
    NSLog(@"Delegate Status is %ld, reason is %ld", (long)status, (long)reason);  
    NSLog(@"Get Status Number is %d",status);  
    if (status == SERVER_STATUS_DISCONNECT)  
    {  
        NSLog(@"After Share status equals SERVER_STATUS_DISCONNECT ");  
        dispatch_async(dispatch_get_main_queue(), ^{  
            self.sharepolicy.isShareAudio = NO;  
            [self->mShareServiceController setPolicy:self.sharepolicy];
		}];
	} else if (status == SERVER_STATUS_STOP_SHARE) {  
    		NSLog(@"After Share status equals SERVER_STATUS_STOP_SHARE ");  
    		dispatch_async(dispatch_get_main_queue(), ^{  
        	self.stopCaptureButton.enabled = NO;  
        	self.startCaptureButton.enabled = YES;
		}];
	}
}
// 辅流和会议状态推送, 会议状态   
- (void) onDevConfStatusChangeNotify : (IDEA_SHARE_APP_CONF_STATUS) confStatus : (IDEA_SHARE_APP_AUX_STATUS) auxStatus  
{  
    NSLog(@"Delegate Conference Status is %ld, Aux Status is %ld",(long)confStatus, (long)auxStatus);  
    if (confStatus == 1) {  
        dispatch_async(dispatch_get_main_queue(), ^{  
            self.leaveConferenceButton.enabled = YES;  
//            self.finishConferenceButton.enabled = YES;  
        });  
    } else {  
        dispatch_async(dispatch_get_main_queue(), ^{  
            self.leaveConferenceButton.enabled = NO;  
            self.finishConferenceButton.enabled = NO;  
        });  
    }
}  
// 枚举值IdeaShareDefault.h中定义 
typedef NS_ENUM(NSInteger, IDEA_SHARE_APP_CONF_STATUS) {
IDEA_SHARE_CONF_IDLE = 0,  // 空闲
IDEA_SHARE_CONF_BUSY        // 忙
};  
typedef NS_ENUM(NSInteger, IDEA_SHARE_APP_AUX_STATUS) {
IDEA_SHARE_AUX_IDLE = 0,   // 空闲
IDEA_SHARE_AUX_BUSY         // 忙
};
// 设备在会议中申请主席后,设备将推送主席状态   
- (void) onRemoteServiceStatusChangedNotify : (RemoteServiceStatus *)remoteServiceStatus : (int)changeCount   
{
Switch(changeCount) {
case 1:
{  
    		NSLog(@"OnRemoteChairManStatusNotify: isChairMan = [%d]", remoteServiceStatus.isChairman);
}
}  
}

相关文档