停止旁路推流
本文介绍如何停止旁路推流以及如何停止旁路直播。
说明
只有房主可以停止旁路推流。
房主停止旁路推流时可以选择停止旁路直播,也可以通过服务端接口StopLiveRoom - 停止直播来结束。
只停止旁路推流并不会停止旁路直播,如果再次开始旁路推流,可以在推流到原有的旁路直播。
停止旁路推流API使用示例
iOS端(Objective-C):
// 停止旁路推流
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc stopBypassLiveStreaming:NO];
// 停止旁路推流并停止旁路直播
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc stopBypassLiveStreaming:YES];
// 停止旁路推流成功,需要通过实现AIRBRTCProtocol的AIRBRTCDelegate中的如下方法和事件来通知,
- (void) onAIRBRTCEvent:(AIRBRTCEvent)event info:(NSDictionary*)info{
switch (event) {
case AIRBRTCEventBypassLiveStopped:
break;
.....
}
}
// 停止旁路推流失败,需要监听AIRBRTCDelegate中的如下错误事件
- (void) onAIRBRTCErrorWithCode:(AIRBErrorCode)code message:(NSString*)msg{
switch (code) {
case AIRBRTCFailedToStopBypassLiveStreaming:
break;
.....
}
}
// 停止旁路直播成功,需要通过实现AIRBRTCProtocol的AIRBRTCDelegate中的如下方法和事件来通知,
- (void) onAIRBRTCEvent:(AIRBRTCEvent)event info:(NSDictionary*)info{
switch (event) {
case AIRBRTCEventBypassLiveDestroyed:
break;
.....
}
}
// 停止旁路直播失败,需要监听AIRBRTCDelegate中的如下错误事件
- (void) onAIRBRTCErrorWithCode:(AIRBErrorCode)code message:(NSString*)msg{
switch (code) {
case AIRBRTCFailedToDestroyBypassLive:
break;
.....
}
}
Android端(Java):
// 停止旁路推流,callback中有操作状态标识
rtcService.stopRoadPublish(Callback<Void> callback);
Windows端(c++):
// 停止旁路推流,windows端会同时停止直播
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->StopRoadPublish([](){}, [](const ::alibaba::dps::DPSError & error_msg){});