文档

录制与回放

更新时间:

本文介绍如何对连麦中的画面声音进行录制,以及如何获取回放视频链接。

说明

  • 只有房主可以进行录制操作。

  • 录制的视频布局设置接口与设置旁路直播布局接口相同,可以在没有旁路直播的时候进行调用。

录制相关API使用示例

iOS端(Objective-C):

// 开始录制
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc startRecording:(AIRBRTCBypassLiveResolutionType)resolutionType
               onSuccess:(void(^)(void))onSuccess
                onFailure:(void(^)(NSString* error))onFailure];

// 暂停录制
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc pauseRecordingOnSuccess:(void(^)(void))onSuccess 
                        onFailure:(void(^)(NSString* error))onFailure];

// 恢复录制
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc resumeRecording:(AIRBRTCBypassLiveResolutionType)resolutionType
                onSuccess:(void(^)(void))onSuccess
                onFailure:(void(^)(NSString* error))onFailure];

// 结束录制
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc stopRecordingOnSuccess:(void(^)(void))onSuccess
                       onFailure:(void(^)(NSString* error))onFailure];

Android端(Java):

// 开始录制/恢复录制
rtcService.startRecord(Callback callback);

// 暂停录制/结束录制
rtcService.stopRecord(Callback 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->StartRecord([](){}, [](const ::alibaba::dps::DPSError & error_msg){});

// 暂停录制/结束录制 暂停录制暂不支持
rtc_plugin->StopRecord([](){}, [](const ::alibaba::dps::DPSError & error_msg){});

获取回放视频API使用示例

其中,连麦插件ID参数可以通过服务端接口获取房间详情获得,也可以通过自行存储获得。

iOS端(Objective-C):

// 获取回放视频URL
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"]
[room.rtc getRecordedVideoUrlWithConferenceID:(NSString*)conferenceID
                                    onSuccess:(void(^)(NSString* url))onSuccess
                                    onFailure:(void(^)(NSString* error))onFailure];

Android端(Java):

// 获取回放视频URL
rtcService.queryRtcDetail(conferenceId, new Callback<ConfInfoModel>() {
    @Override
    public void onSuccess(ConfInfoModel data) {
        Logger.i(TAG, "onSuccess: " + data);
        String playBackUrl = data != null ? data.playbackUrl : "";
    }

    @Override
    public void onError(String errorMsg) {
        Logger.i(TAG, "onError: " + errorMsg);
    }
});

Windows端(c++):

// 获取回放视频URL
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->GetConfDetail([](const alibaba::rtc::GetConfDetailRsp& rsp){
  std::string playback_url = rsp.conf_info_model.playback_url;
}, [](const ::alibaba::dps::DPSError & error_msg){});