日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

RTC 相關 API

本文主要介紹了 Android SDK 中 RTC 相關的 API。

創建房間

 public void createRoom(Context context, 
                        final final IdrsSdk.SdkInitCallBack sdkInitCallBack)

請求參數

參數

類型

說明

是否必須

context

Context

上下文

sdkInitCallBack

SdkInitCallBack

創建的房間的回調接口

返回值

代碼示例

  IdrsSdk.getInstance().createRoom(this, new IdrsSdk.SdkInitCallBack() {
            @Override
            public void success() {
                //成功
                
            }

            @Override
            public void fail(String message) {
                //失敗

            }
        });

加入房間

public void joinRoom(Context context, String roomId, String token, 
                     final IdrsSdk.SdkInitCallBack sdkInitCallBack)

請求參數

參數

類型

說明

是否必須

context

Context

上下文

roomId

String

房間號

token

String

房間密碼

sdkInitCallBack

SdkInitCallBack

創建的房間的回調接口

返回值

代碼示例

IdrsSdk.getInstance().joinRoom(this, roomId, roomToken, sdkInitCallBack);

獲取房間信息

public RoomInfo getRoomInfo()

請求參數

返回值

類型

說明

RoomInfo

返回房間的實體類

代碼示例

IdrsSdk.getInstance().getRoomInfo();

設置房間信息

public void setRoomInfo(RoomInfo roomInfo)

請求參數

參數

類型

說明

是否必須

roomInfo

RoomInfo

房間實體類

返回值

代碼示例

IdrsSdk.getInstance().setRoomInfo(roomInfo);

獲取ARTVC實例

public AlipayRtcEngine getRtcEngineInstance()

請求參數

返回值

類型

說明

AlipayRtcEngine

ARTVC 實例

代碼示例

  mRtcEngine = IdrsSdk.getInstance().getRtcEngineInstance();

設置 RTC 監聽和處理

public void setRtcListenerAndHandler(AlipayRtcEngineEventListener listener,
                                     Handler handler)

請求參數

參數

類型

說明

是否必須

listener

AlipayRtcEngineEventListener

RTC 引擎事件監聽器

handler

Handler

處理消息

返回值

代碼示例

  mRtcEngine.setRtcListenerAndHandler(alipayRtcEngineEventListener, eventHandler);
    private final AlipayRtcEngineEventListener alipayRtcEngineEventListener = new AlipayRtcEngineEventListener() {
        @Override
        public void onError(int i, String s, Bundle bundle) {
            Log.d(TAG, "onError() called with: i = [" + i + "], s = [" + s + "], bundle = [" + bundle + "]");
        }

        @Override
        public void onCommonEvent(int i, String s, Bundle bundle) {
            Log.d(TAG, "onCommonEvent() called with: i = [" + i + "], s = [" + s + "], bundle = [" + bundle + "]");
        }

        @Override
        public void onRoomInfo(final RoomInfo roomInfo) {
          
        }

        @Override
        public void onEnterRoom(int i) {
            Log.d(TAG, "onEnterRoom() called with: i = [" + i + "]");
        }

        @Override
        public void onLeaveRoom(int i) {
            Log.d(TAG, "onLeaveRoom() called with: i = [" + i + "]");
        }

        @Override
        public void onInviteReply(ReplyOfInviteInfo replyOfInviteInfo) {
            Log.d(TAG, "onInviteReply() called with: replyOfInviteInfo = [" + replyOfInviteInfo + "]");
        }

        @Override
        public void onRecordInfo(String s) {
            Log.d(TAG, "onRecordInfo() called with: s = [" + s + "]");
        }

        @Override
        public void onCameraPreviewInfo(final ARTVCView artvcView) {
          
        }

        @Override
        public void onCameraPreviewFirstFrame() {
            Log.d(TAG, "onCameraPreviewFirstFrame() called");
        }

        @Override
        public void onCameraPreviewStop() {
            Log.d(TAG, "onCameraPreviewStop() called");
        }

        @Override
        public void onPublishEvent(PublishConfig publishConfig, PublishEventCode publishEventCode, String s, FeedInfo feedInfo) {
            Log.d(TAG, "onPublishEvent() called with: publishConfig = [" + publishConfig + "], publishEventCode = [" + publishEventCode + "], s = [" + s + "], feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onUnpublishEvent(UnpublishConfig unpublishConfig, PublishEventCode publishEventCode, String s) {
            Log.d(TAG, "onUnpublishEvent() called with: unpublishConfig = [" + unpublishConfig + "], publishEventCode = [" + publishEventCode + "], s = [" + s + "]");
        }

        @Override
        public void onSubscribeEvent(FeedInfo feedInfo, SubscribeEventCode subscribeEventCode, String s, ARTVCView artvcView) {
            Log.d(TAG, "onSubscribeEvent() called with: feedInfo = [" + feedInfo + "], subscribeEventCode = [" + subscribeEventCode + "], s = [" + s + "], artvcView = [" + artvcView + "]");
        }

        @Override
        public void onUnsubscribeEvent(FeedInfo feedInfo, SubscribeEventCode subscribeEventCode, String s) {
            Log.d(TAG, "onUnsubscribeEvent() called with: feedInfo = [" + feedInfo + "], subscribeEventCode = [" + subscribeEventCode + "], s = [" + s + "]");
        }

        @Override
        public void onParticipantsEnter(final List<ParticipantInfo> infos) {
          
        }

        @Override
        public void onParticipantsLeave(List<ParticipantLeaveInfo> list) {
            Log.d(TAG, "onParticipantsLeave() called with: list = [" + list + "]");
        }

        @Override
        public void onPublishNotify(FeedInfo feedInfo) {
            Log.d(TAG, "onPublishNotify() called with: feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onUnpublishNotify(FeedInfo feedInfo) {
            Log.d(TAG, "onUnpublishNotify() called with: feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onSubscribeNotify(FeedInfo feedInfo, String s) {
            Log.d(TAG, "onSubscribeNotify() called with: feedInfo = [" + feedInfo + "], s = [" + s + "]");
        }

        @Override
        public void onUnsubscribeNotify(FeedInfo feedInfo, String s) {
            Log.d(TAG, "onUnsubscribeNotify() called with: feedInfo = [" + feedInfo + "], s = [" + s + "]");
        }

        @Override
        public void onRemoteViewFirstFrame(final FeedInfo feedInfo, final ARTVCView artvcView) {
           
        }

        @Override
        public void onRemoteViewStop(FeedInfo feedInfo, ARTVCView artvcView) {
            Log.d(TAG, "onRemoteViewStop() called with: feedInfo = [" + feedInfo + "], artvcView = [" + artvcView + "]");
        }

        @Override
        public void onCurrentNetworkType(int i) {
            Log.d(TAG, "onCurrentNetworkType() called with: i = [" + i + "]");
        }

        @Override
        public void onCurrentAudioPlayoutMode(int i) {
            Log.d(TAG, "onCurrentAudioPlayoutMode() called with: i = [" + i + "]");
        }

        @Override
        public void onBandwidthImportanceChangeNotify(boolean b, double v, FeedInfo feedInfo) {
            Log.d(TAG, "onBandwidthImportanceChangeNotify() called with: b = [" + b + "], v = [" + v + "], feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onSnapShotComplete(Bitmap bitmap, FeedInfo feedInfo) {
            Log.d(TAG, "onSnapShotComplete() called with: bitmap = [" + bitmap + "], feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onStatisticDebugInfo(StatisticInfoForDebug statisticInfoForDebug, FeedInfo feedInfo) {
            Log.d(TAG, "onStatisticDebugInfo() called with: statisticInfoForDebug = [" + statisticInfoForDebug + "], feedInfo = [" + feedInfo + "]");
        }

        @Override
        public void onRealTimeStatisticInfo(RealTimeStatisticReport realTimeStatisticReport, FeedInfo feedInfo) {
            Log.d(TAG, "onRealTimeStatisticInfo() called with: realTimeStatisticReport = [" + realTimeStatisticReport + "], feedInfo = [" + feedInfo + "]");
        }
    };

設置 RTC 音頻監聽器

public void setAlipayRtcEngineAudioListener(
    AlipayRtcEngineAudioListener rtcEngineAudioListener, 
    @Nullable Handler handler)

請求參數

參數

類型

說明

是否必須

rtcEngineAudioListener

AlipayRtcEngineAudioListener

RTC 音頻監聽器

handler

Handler

處理消息

返回值

代碼示例

   AlipayRtcEngineAudioListener audioListener = new AlipayRtcEngineAudioListener() {
                    @Override
                    public void onWebRtcAudioCapturered(AlipayRtcAudioInfo alipayRtcAudioInfo) {
                        super.onWebRtcAudioCapturered(alipayRtcAudioInfo);
                        if (alipayRtcAudioInfo != null) {
                            ByteArrayInputStream fis = new ByteArrayInputStream(alipayRtcAudioInfo.data);
                            ByteArrayOutputStream fos = new ByteArrayOutputStream(alipayRtcAudioInfo.data.length);
                            try {
                                new SSRC(fis, fos, 48000, 16000, 2, 2, 1, Integer.MAX_VALUE, 0, 0,
                                    true);
                                mAudioSpliter.splitAudioData(fos.toByteArray());
                            } catch (Throwable t) {
                                t.printStackTrace();
                            }
                        }
                    }
                };
                audioListener.setEnableAudioCaptured(true);
                mRtcEngine.setAlipayRtcEngineAudioListener(audioListener, new Handler());

設置 RTC 事件監聽器

public void setRtcEventExtendListener(AlipayRtcEngineEventExtendListener listener)

請求參數

參數

類型

說明

是否必須

listener

AlipayRtcEngineEventExtendListener

RTC 事件監聽器

返回值

代碼示例

                mRtcEngine.setRtcEventExtendListener(new AlipayRtcEngineEventExtendListener() {
                    @Override
                    public void onVideoSizeChangedTo(int height, int width, ARTVCView view, FeedInfo feedInfo) {
                        super.onVideoSizeChangedTo(height, width, view, feedInfo);
                    }

                    @Override
                    public void onCustomRawResp(long requestId, int oldOpcmd, JSONObject jsonObject) {
                        super.onCustomRawResp(requestId, oldOpcmd, jsonObject);
                        if (jsonObject == null) {
                            return;
                        }

                        Log.i("CallActCustom", "cmd result: " + jsonObject.toJSONString());
                        int opcmdInner = jsonObject.getIntValue("opcmd");
                        String recordId = jsonObject.getString("recordId");
                        mRecordId = jsonObject.getString("recordId");
                        if (opcmdInner == 1032) {

                            recordIdList.add(mRecordId);
                            mSessionId = jsonObject.getString("sessionId");
                            recordAtLong = System.currentTimeMillis();
                            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
                            recordAt = df.format(recordAtLong);
                            Log.d(TAG, "recordAt: " + recordAt);
                        } else if (opcmdInner == 1034) {
                            long recordDuration = System.currentTimeMillis() - recordAtLong;
                            UploadReportRequest reportRequest = new UploadReportRequest();
                            reportRequest.setAppId(appId);
                            reportRequest.setRoomId(mRoomInfo.roomId);
                            reportRequest.setType("REMOTE");
                            reportRequest.setRecordAt(recordAt);
                            reportRequest.setDuration(recordDuration);
                            String metaFileName = "remotemeta";
                            GetAppBean.DataBean data = IdrsSdk.getInstance().getAppData();
                            String metaFilePath = ConfigurationFile.getInstance().createMetaFilePath(CreateRoomActivity.this, metaFileName);
                            VideoConfigurator.getInstance().saveToFile(metaFilePath);
                            String resultFilename = "remoteresult";
                            String resultFilePaht = ConfigurationFile.getInstance().createMetaFilePath(CreateRoomActivity.this, resultFilename);
                            VideoConfigurator.getInstance().saveResultToFile(resultFilePaht);

                            IdrsProcessResultBean idrsResultBean = new IdrsProcessResultBean();
                            idrsResultBean.setAk(AK);
                            idrsResultBean.setSk(SK);
                            idrsResultBean.setAppId(appId);
                            idrsResultBean.setFeeId(data == null ? "" : data.getFeeId());
                            idrsResultBean.setType(IdrsSdk.TYPE_REMOTE);
                            idrsResultBean.setRoomId(mRoomInfo.roomId);
                            idrsResultBean.setDuration(recordDuration);
                            idrsResultBean.setRecordAt(recordAtLong);
                            idrsResultBean.setRecordId(recordId);
                            List<FileBean> fileBeanList = new ArrayList<>();
                            idrsResultBean.setFiles(fileBeanList);
                            FileBean metaBean = new FileBean();
                            metaBean.setFileName(metaFileName);
                            metaBean.setUrlType(IdrsProcessResultBean.FILE_TYPE_META);
                            metaBean.setFilePath(metaFilePath);
                            fileBeanList.add(metaBean);

                            FileBean resultBean = new FileBean();
                            resultBean.setFileName(resultFilename);
                            resultBean.setUrlType(IdrsProcessResultBean.FILE_TYPE_RESULT);
                            resultBean.setFilePath(resultFilePaht);
                            fileBeanList.add(resultBean);

                            IdrsSdk.uploadFiles(idrsResultBean, new UploadCallback() {

                                @Override
                                public void success(String json) {
                                    runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            Toast.makeText(CreateRoomActivity.this, "上報成功", Toast.LENGTH_LONG).show();
                                        }
                                    });
                                }

                                @Override
                                public void fail(String msg) {
                                    runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            Toast.makeText(CreateRoomActivity.this, "上報失敗", Toast.LENGTH_LONG).show();
                                        }
                                    });
                                }
                            });
                            Log.i("CallActCustom", "stop record result: " + jsonObject.toJSONString());
                        }
                    }
                });

開啟錄制

public void startRTCRecord(String waterMarkId)

請求參數

參數

類型

說明

是否必須

waterMarkId

String

水印 ID

返回值

代碼示例

IdrsSdk.getInstance().startRTCRecord(waterMarkId);

開啟錄制擴展

public Long startRTCRecord(String waterMarkId, String tagFilter, 
                           Map<String, String> config, String userTag,
                           IdrsSdk.RecordType recordType, RecordParam recordParamObj)

請求參數

參數

類型

說明

是否必須

waterMarkId

String

水印 ID,沒有時傳 null

tagFilter

String

混流傳 null,單流傳 tag

config

Map<String, String>

自定義配置,可傳 null

userTag

String

用戶類型

recordType

IdrsSdk.RecordType

錄制類型,可傳 null

recordParamObj

RecordParam

自定義水印實體列

返回值

類型

說明

Long

返回的成功碼

代碼示例

    RecordParam recordParam = new RecordParam();
                    recordParam.setHeight(720);
                    recordParam.setWidth(1280);
                    JSONArray overlaps = new JSONArray();
                    JSONObject overlap_1 = new JSONObject();
                    overlap_1.put("enable", true);
                    overlap_1.put("fontSize", 60);
                    overlap_1.put("id", 777);
                    overlap_1.put("tag", videoTag);
                    overlap_1.put("text", customWatermark);
                    overlap_1.put("type", 2);
                    overlap_1.put("xPosition", 30);
                    overlap_1.put("yPosition", 30);
                    JSONObject overlap_2 = new JSONObject();
                    overlap_2.put("enable", true);
                    overlap_2.put("fontSize", 60);
                    overlap_2.put("id", 888);
                    overlap_2.put("tag", videoTag);
                    overlap_2.put("text", customWatermark);
                    overlap_2.put("type", 2);
                    overlap_2.put("xPosition", 30);
                    overlap_2.put("yPosition", 30);
                    overlaps.add(overlap_1);
                    overlaps.add(overlap_2);
                    recordParam.setOverlaps(overlaps, null);

                    if(rtc_single){//單流
                        IdrsSdk.getInstance().startRTCRecord(null, tagFilter, null, "idrs_test", IdrsSdk.RecordType.RECORD_SINGLE, recordParam);
                    }
                    if (rtc_hybrid){//混流
                        IdrsSdk.getInstance().startRTCRecord(null, null, null, "idrs_test", IdrsSdk.RecordType.RECORD_MIX, recordParam);
                    }

變更錄制配置

public Long modifyRTCRecordConfig(String recordId, 
                                  TagPositions tagPositions, Overlaps overlaps)

請求參數

參數

類型

說明

是否必須

recordId

String

錄制 ID

tagPositions

TagPositions

布局配置

overlaps

Overlaps

水印配置

返回值

類型

說明

Long

返回的成功碼

代碼示例

IdrsSdk.getInstance().modifyRTCRecordConfig(recordId,tagPositions,overlaps);

結束錄制

 public void stopRTCRecord(String recordId)

請求參數

參數

類型

說明

是否必須

recordId

String

錄制 ID,在開啟 RTC 事件回調接口中返回

返回值

代碼示例

IdrsSdk.getInstance().stopRTCRecord(recordId);

退出房間

public void release()

請求參數

返回值

代碼示例

IdrsSdk.getInstance().release()