开始旁路推流
本文介绍如何开始旁路推流,将连麦的画面声音进行旁路直播。
说明
只有房主可以开始旁路推流。
旁路推流开启后,房间中的其他人可以在不加入连麦的情况下观看旁路直播。
开始旁路推流API使用示例
iOS端(Objective-C):
// 开始旁路推流
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc startBypassLiveStreaming:(AIRBRTCBypassLiveResolutionType)resolutionType];
// 开始旁路推流成功,需要通过实现AIRBRTCProtocol的AIRBRTCDelegate中的如下方法和事件来通知,
- (void) onAIRBRTCEvent:(AIRBRTCEvent)event info:(NSDictionary*)info{
switch (event) {
case AIRBRTCEventBypassLiveStarted:
break;
.....
}
}
// 开始旁路推流失败,需要监听AIRBRTCDelegate中的如下错误事件
- (void) onAIRBRTCErrorWithCode:(AIRBErrorCode)code message:(NSString*)msg{
switch (code) {
case AIRBRTCFailedToCreateBypassLive:
break;
case AIRBRTCFailedToStartBypassLive:
break;
case AIRBRTCFailedToPublishBypassLive:
break;
case AIRBRTCFailedToPushBypassLiveStreaming:
break;
case AIRBRTCFailedToGetBypassLiveDetail:
break;
.....
}
}
Android端(Java):
// 开始旁路推流,callback中有操作状态标识
rtcService.startRoadPublish(Callback<Void> callback);
Windows端(c++):
// 开始旁路推流
auto room_ptr = alibaba::meta_space::MetaSpace::GetInstance()->GetRoomInstance(room_id);
auto rtc_plugin = std::dynamic_pointer_cast<IRtc>(room_ptr->GetPlugin(PluginRtc));
rtc_plugin->StartRoadPublish([](){}, [](const ::alibaba::dps::DPSError & error_msg){});