智慧保安互联网APP
shuishen
2021-08-03 24f17cb2b4db33b79bbd69b5342cf7dc7c2cdd35
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhba_app
4 files modified
50 files added
21074 ■■■■■ changed files
components/uni-popup-dialog/uni-popup-dialog.vue 243 ●●●●● patch | view | raw | blame | history
components/uni-popup-message/uni-popup-message.vue 116 ●●●●● patch | view | raw | blame | history
components/uni-popup/message.js 22 ●●●●● patch | view | raw | blame | history
components/uni-popup/popup.js 25 ●●●●● patch | view | raw | blame | history
components/uni-popup/share.js 16 ●●●●● patch | view | raw | blame | history
components/uni-popup/uni-popup.vue 297 ●●●●● patch | view | raw | blame | history
components/uni-transition/uni-transition.vue 279 ●●●●● patch | view | raw | blame | history
js_sdk/wa-permission/permission.js 272 ●●●●● patch | view | raw | blame | history
manifest.json 21 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/android/arsdk-release.aar patch | view | raw | blame | history
nativePlugins/AR-RtcModule/android/rtc-release.aar patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/ARtcKit patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/AREnumerates.h 1817 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARMediaIO.h 224 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARMediaPlayerKit.h 413 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARObjects.h 1095 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARStreamingKit.h 64 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcChannel.h 256 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcChannelDelegate.h 216 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcEngineDelegate.h 915 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcEngineKit.h 2143 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcKit.h 29 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ArBase.h 826 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ArMediaBase.h 400 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArMediaEngine.h 770 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArMediaPlayer.h 378 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArRtcEngine.h 8998 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArService.h 76 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Info.plist patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Modules/module.modulemap 6 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/ArRtcUniPlugin patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/ARtcKit patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/Info.plist patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/_CodeSignature/CodeResources 101 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Info.plist patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeDirectory patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeRequirements patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeRequirements-1 patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeResources 147 ●●●●● patch | view | raw | blame | history
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeSignature patch | view | raw | blame | history
nativePlugins/AR-RtcModule/package.json 81 ●●●●● patch | view | raw | blame | history
pages.json 36 ●●●● patch | view | raw | blame | history
pages/home/home.vue 7 ●●●●● patch | view | raw | blame | history
pages/securityStaff/information.vue 4 ●●● patch | view | raw | blame | history
pages/videoCall/videoCall.vue 781 ●●●●● patch | view | raw | blame | history
static/BG.png patch | view | raw | blame | history
static/au_in.png patch | view | raw | blame | history
static/au_on.png patch | view | raw | blame | history
static/camera.png patch | view | raw | blame | history
static/logo.png patch | view | raw | blame | history
static/over.png patch | view | raw | blame | history
static/phone.png patch | view | raw | blame | history
static/vi_in.png patch | view | raw | blame | history
static/vi_on.png patch | view | raw | blame | history
components/uni-popup-dialog/uni-popup-dialog.vue
New file
@@ -0,0 +1,243 @@
<template>
    <view class="uni-popup-dialog">
        <view class="uni-dialog-title">
            <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{title}}</text>
        </view>
        <view class="uni-dialog-content">
            <text class="uni-dialog-content-text" v-if="mode === 'base'">{{content}}</text>
            <input v-else class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholder" :focus="focus" >
        </view>
        <view class="uni-dialog-button-group">
            <view class="uni-dialog-button" @click="close">
                <text class="uni-dialog-button-text">取消</text>
            </view>
            <view class="uni-dialog-button uni-border-left" @click="onOk">
                <text class="uni-dialog-button-text uni-button-color">确定</text>
            </view>
        </view>
    </view>
</template>
<script>
    /**
     * PopUp 弹出层-对话框样式
     * @description 弹出层-对话框样式
     * @tutorial https://ext.dcloud.net.cn/plugin?id=329
     * @property {String} value input 模式下的默认值
     * @property {String} placeholder input 模式下输入提示
     * @property {String} type = [success|warning|info|error] 主题样式
     *  @value success 成功
     *     @value warning 提示
     *     @value info 消息
     *     @value error 错误
     * @property {String} mode = [base|input] 模式、
     *     @value base 基础对话框
     *     @value input 可输入对话框
     * @property {String} content 对话框内容
     * @property {Boolean} beforeClose 是否拦截取消事件
     * @event {Function} confirm 点击确认按钮触发
     * @event {Function} close 点击取消按钮触发
     */
    export default {
        name: "uniPopupDialog",
        props: {
            value: {
                type: [String, Number],
                default: ''
            },
            placeholder: {
                type: [String, Number],
                default: '请输入内容'
            },
            /**
             * 对话框主题 success/warning/info/error      默认 success
             */
            type: {
                type: String,
                default: 'error'
            },
            /**
             * 对话框模式 base/input
             */
            mode: {
                type: String,
                default: 'base'
            },
            /**
             * 对话框标题
             */
            title: {
                type: String,
                default: '提示'
            },
            /**
             * 对话框内容
             */
            content: {
                type: String,
                default: ''
            },
            /**
             * 拦截取消事件 ,如果拦截取消事件,必须监听close事件,执行 done()
             */
            beforeClose: {
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                dialogType: 'error',
                focus: false,
                val: ""
            }
        },
        inject: ['popup'],
        watch: {
            type(val) {
                this.dialogType = val
            },
            mode(val) {
                if (val === 'input') {
                    this.dialogType = 'info'
                }
            },
            value(val) {
                this.val = val
            }
        },
        created() {
            // 对话框遮罩不可点击
            this.popup.mkclick = false
            if (this.mode === 'input') {
                this.dialogType = 'info'
                this.val = this.value
            } else {
                this.dialogType = this.type
            }
        },
        mounted() {
            this.focus = true
        },
        methods: {
            /**
             * 点击确认按钮
             */
            onOk() {
                this.$emit('confirm', () => {
                    this.popup.close()
                    if (this.mode === 'input') this.val = this.value
                }, this.mode === 'input' ? this.val : '')
            },
            /**
             * 点击取消按钮
             */
            close() {
                if (this.beforeClose) {
                    this.$emit('close', () => {
                        this.popup.close()
                    })
                    return
                }
                this.popup.close()
            }
        }
    }
</script>
<style lang="scss" scoped>
    .uni-popup-dialog {
        width: 300px;
        border-radius: 15px;
        background-color: #fff;
    }
    .uni-dialog-title {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        justify-content: center;
        padding-top: 15px;
        padding-bottom: 5px;
    }
    .uni-dialog-title-text {
        font-size: 16px;
        font-weight: 500;
    }
    .uni-dialog-content {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 5px 15px 15px 15px;
    }
    .uni-dialog-content-text {
        font-size: 14px;
        color: #6e6e6e;
    }
    .uni-dialog-button-group {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        border-top-color: #f5f5f5;
        border-top-style: solid;
        border-top-width: 1px;
    }
    .uni-dialog-button {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex: 1;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        height: 45px;
    }
    .uni-border-left {
        border-left-color: #f0f0f0;
        border-left-style: solid;
        border-left-width: 1px;
    }
    .uni-dialog-button-text {
        font-size: 14px;
    }
    .uni-button-color {
        color: $uni-color-primary;
    }
    .uni-dialog-input {
        flex: 1;
        font-size: 14px;
    }
    .uni-popup__success {
        color: $uni-color-success;
    }
    .uni-popup__warn {
        color: $uni-color-warning;
    }
    .uni-popup__error {
        color: $uni-color-error;
    }
    .uni-popup__info {
        color: #909399;
    }
</style>
components/uni-popup-message/uni-popup-message.vue
New file
@@ -0,0 +1,116 @@
<template>
    <view class="uni-popup-message" :class="'uni-popup__'+[type]">
        <text class="uni-popup-message-text" :class="'uni-popup__'+[type]+'-text'">{{message}}</text>
    </view>
</template>
<script>
    /**
     * PopUp 弹出层-消息提示
     * @description 弹出层-消息提示
     * @tutorial https://ext.dcloud.net.cn/plugin?id=329
     * @property {String} type = [success|warning|info|error] 主题样式
     *  @value success 成功
     *     @value warning 提示
     *     @value info 消息
     *     @value error 错误
     * @property {String} message 消息提示文字
     * @property {String} duration 显示时间,设置为 0 则不会自动关闭
     */
    export default {
        name: 'UniPopupMessage',
        props: {
            /**
             * 主题 success/warning/info/error      默认 success
             */
            type: {
                type: String,
                default: 'success'
            },
            /**
             * 消息文字
             */
            message: {
                type: String,
                default: ''
            },
            /**
             * 显示时间,设置为 0 则不会自动关闭
             */
            duration: {
                type: Number,
                default: 3000
            }
        },
        inject: ['popup'],
        data() {
            return {}
        },
        created() {
            this.popup.childrenMsg = this
        },
        methods: {
            open() {
                if (this.duration === 0) return
                clearTimeout(this.popuptimer)
                this.popuptimer = setTimeout(() => {
                    this.popup.close()
                }, this.duration)
            },
            close() {
                clearTimeout(this.popuptimer)
            }
        }
    }
</script>
<style lang="scss" scoped>
    .uni-popup-message {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        background-color: #e1f3d8;
        padding: 10px 15px;
        border-color: #eee;
        border-style: solid;
        border-width: 1px;
    }
    .uni-popup-message-text {
        font-size: 14px;
        padding: 0;
    }
    .uni-popup__success {
        background-color: #e1f3d8;
    }
    .uni-popup__success-text {
        color: #67C23A;
    }
    .uni-popup__warn {
        background-color: #faecd8;
    }
    .uni-popup__warn-text {
        color: #E6A23C;
    }
    .uni-popup__error {
        background-color: #fde2e2;
    }
    .uni-popup__error-text {
        color: #F56C6C;
    }
    .uni-popup__info {
        background-color: #F2F6FC;
    }
    .uni-popup__info-text {
        color: #909399;
    }
</style>
components/uni-popup/message.js
New file
@@ -0,0 +1,22 @@
export default {
    created() {
        if (this.type === 'message') {
            // 不显示遮罩
            this.maskShow = false
            // 获取子组件对象
            this.childrenMsg = null
        }
    },
    methods: {
        customOpen() {
            if (this.childrenMsg) {
                this.childrenMsg.open()
            }
        },
        customClose() {
            if (this.childrenMsg) {
                this.childrenMsg.close()
            }
        }
    }
}
components/uni-popup/popup.js
New file
@@ -0,0 +1,25 @@
import message from './message.js';
// 定义 type 类型:弹出类型:top/bottom/center
const config = {
    // 顶部弹出
    top:'top',
    // 底部弹出
    bottom:'bottom',
    // 居中弹出
    center:'center',
    // 消息提示
    message:'top',
    // 对话框
    dialog:'center',
    // 分享
    share:'bottom',
}
export default {
    data(){
        return {
            config:config
        }
    },
    mixins: [message]
}
components/uni-popup/share.js
New file
@@ -0,0 +1,16 @@
export default {
    created() {
        if (this.type === 'share') {
            // 关闭点击
            this.mkclick = false
        }
    },
    methods: {
        customOpen() {
            console.log('share 打开了');
        },
        customClose() {
            console.log('share 关闭了');
        }
    }
}
components/uni-popup/uni-popup.vue
New file
@@ -0,0 +1,297 @@
<template>
    <view v-if="showPopup" class="uni-popup" :class="[popupstyle]" @touchmove.stop.prevent="clear">
        <uni-transition v-if="maskShow" class="uni-mask--hook" :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans"
         @click="onTap" />
        <uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
            <view class="uni-popup__wrapper-box" @click.stop="clear">
                <slot />
            </view>
        </uni-transition>
    </view>
</template>
<script>
    import uniTransition from '../uni-transition/uni-transition.vue'
    import popup from './popup.js'
    /**
     * PopUp 弹出层
     * @description 弹出层组件,为了解决遮罩弹层的问题
     * @tutorial https://ext.dcloud.net.cn/plugin?id=329
     * @property {String} type = [top|center|bottom] 弹出方式
     *     @value top 顶部弹出
     *     @value center 中间弹出
     *     @value bottom 底部弹出
     *     @value message 消息提示
     *     @value dialog 对话框
     *     @value share 底部分享示例
     * @property {Boolean} animation = [ture|false] 是否开启动画
     * @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
     * @event {Function} change 打开关闭弹窗触发,e={show: false}
     */
    export default {
        name: 'UniPopup',
        components: {
            uniTransition
        },
        props: {
            // 开启动画
            animation: {
                type: Boolean,
                default: true
            },
            // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
            // message: 消息提示 ; dialog : 对话框
            type: {
                type: String,
                default: 'center'
            },
            // maskClick
            maskClick: {
                type: Boolean,
                default: true
            }
        },
        provide() {
            return {
                popup: this
            }
        },
        mixins: [popup],
        watch: {
            /**
             * 监听type类型
             */
            type: {
                handler: function(newVal) {
                    this[this.config[newVal]]()
                },
                immediate: true
            },
            /**
             * 监听遮罩是否可点击
             * @param {Object} val
             */
            maskClick: {
                handler: function(val) {
                    this.mkclick = val
                },
                immediate: true
            }
        },
        data() {
            return {
                duration: 300,
                ani: [],
                showPopup: false,
                showTrans: false,
                maskClass: {
                    'position': 'fixed',
                    'bottom': 0,
                    'top': 0,
                    'left': 0,
                    'right': 0,
                    'backgroundColor': 'rgba(0, 0, 0, 0.4)'
                },
                transClass: {
                    'position': 'fixed',
                    'left': 0,
                    'right': 0,
                },
                maskShow: true,
                mkclick: true,
                popupstyle: 'top'
            }
        },
        created() {
            this.mkclick = this.maskClick
            if (this.animation) {
                this.duration = 300
            } else {
                this.duration = 0
            }
        },
        methods: {
            clear(e) {
                // TODO nvue 取消冒泡
                e.stopPropagation()
            },
            open() {
                this.showPopup = true
                this.$nextTick(() => {
                    new Promise(resolve => {
                        clearTimeout(this.timer)
                        this.timer = setTimeout(() => {
                            this.showTrans = true
                            // fixed by mehaotian 兼容 app 端
                            this.$nextTick(() => {
                                resolve();
                            })
                        }, 50);
                    }).then(res => {
                        // 自定义打开事件
                        clearTimeout(this.msgtimer)
                        this.msgtimer = setTimeout(() => {
                            this.customOpen && this.customOpen()
                        }, 100)
                        this.$emit('change', {
                            show: true,
                            type: this.type
                        })
                    })
                })
            },
            close(type) {
                this.showTrans = false
                this.$nextTick(() => {
                    this.$emit('change', {
                        show: false,
                        type: this.type
                    })
                    clearTimeout(this.timer)
                    // 自定义关闭事件
                    this.customOpen && this.customClose()
                    this.timer = setTimeout(() => {
                        this.showPopup = false
                    }, 300)
                })
            },
            onTap() {
                if (!this.mkclick) return
                this.close()
            },
            /**
             * 顶部弹出样式处理
             */
            top() {
                this.popupstyle = 'top'
                this.ani = ['slide-top']
                this.transClass = {
                    'position': 'fixed',
                    'left': 0,
                    'right': 0,
                }
            },
            /**
             * 底部弹出样式处理
             */
            bottom() {
                this.popupstyle = 'bottom'
                this.ani = ['slide-bottom']
                this.transClass = {
                    'position': 'fixed',
                    'left': 0,
                    'right': 0,
                    'bottom': 0
                }
            },
            /**
             * 中间弹出样式处理
             */
            center() {
                this.popupstyle = 'center'
                this.ani = ['zoom-out', 'fade']
                this.transClass = {
                    'position': 'fixed',
                    /* #ifndef APP-NVUE */
                    'display': 'flex',
                    'flexDirection': 'column',
                    /* #endif */
                    'bottom': 0,
                    'left': 0,
                    'right': 0,
                    'top': 0,
                    'justifyContent': 'center',
                    'alignItems': 'center'
                }
            }
        }
    }
</script>
<style lang="scss" scoped>
    .uni-popup {
        position: fixed;
        /* #ifndef APP-NVUE */
        z-index: 99;
        /* #endif */
    }
    .uni-popup__mask {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: $uni-bg-color-mask;
        opacity: 0;
    }
    .mask-ani {
        transition-property: opacity;
        transition-duration: 0.2s;
    }
    .uni-top-mask {
        opacity: 1;
    }
    .uni-bottom-mask {
        opacity: 1;
    }
    .uni-center-mask {
        opacity: 1;
    }
    .uni-popup__wrapper {
        /* #ifndef APP-NVUE */
        display: block;
        /* #endif */
        position: absolute;
    }
    .top {
        /* #ifdef H5 */
        top: var(--window-top);
        /* #endif */
        /* #ifndef H5 */
        top: 0;
        /* #endif */
    }
    .bottom {
        bottom: 0;
    }
    .uni-popup__wrapper-box {
        /* #ifndef APP-NVUE */
        display: block;
        /* #endif */
        position: relative;
        /* iphonex 等安全区设置,底部安全区适配 */
        /* #ifndef APP-NVUE */
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
        /* #endif */
    }
    .content-ani {
        // transition: transform 0.3s;
        transition-property: transform, opacity;
        transition-duration: 0.2s;
    }
    .uni-top-content {
        transform: translateY(0);
    }
    .uni-bottom-content {
        transform: translateY(0);
    }
    .uni-center-content {
        transform: scale(1);
        opacity: 1;
    }
</style>
components/uni-transition/uni-transition.vue
New file
@@ -0,0 +1,279 @@
<template>
    <view v-if="isShow" ref="ani" class="uni-transition" :class="[ani.in]" :style="'transform:' +transform+';'+stylesObject"
     @click="change">
         <slot></slot>
    </view>
</template>
<script>
    // #ifdef APP-NVUE
    const animation = uni.requireNativePlugin('animation');
    // #endif
    /**
     * Transition 过渡动画
     * @description 简单过渡动画组件
     * @tutorial https://ext.dcloud.net.cn/plugin?id=985
     * @property {Boolean} show = [false|true] 控制组件显示或隐藏
     * @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
     *  @value fade 渐隐渐出过渡
     *  @value slide-top 由上至下过渡
     *  @value slide-right 由右至左过渡
     *  @value slide-bottom 由下至上过渡
     *  @value slide-left 由左至右过渡
     *  @value zoom-in 由小到大过渡
     *  @value zoom-out 由大到小过渡
     * @property {Number} duration 过渡动画持续时间
     * @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
     */
    export default {
        name: 'uniTransition',
        props: {
            show: {
                type: Boolean,
                default: false
            },
            modeClass: {
                type: Array,
                default () {
                    return []
                }
            },
            duration: {
                type: Number,
                default: 300
            },
            styles: {
                type: Object,
                default () {
                    return {}
                }
            }
        },
        data() {
            return {
                isShow: false,
                transform: '',
                ani: { in: '',
                    active: ''
                }
            };
        },
        watch: {
            show: {
                handler(newVal) {
                    if (newVal) {
                        this.open()
                    } else {
                        this.close()
                    }
                },
                immediate: true
            }
        },
        computed: {
            stylesObject() {
                let styles = {
                    ...this.styles,
                    'transition-duration': this.duration / 1000 + 's'
                }
                let transfrom = ''
                for (let i in styles) {
                    let line = this.toLine(i)
                    transfrom += line + ':' + styles[i] + ';'
                }
                return transfrom
            }
        },
        created() {
            // this.timer = null
            // this.nextTick = (time = 50) => new Promise(resolve => {
            //     clearTimeout(this.timer)
            //     this.timer = setTimeout(resolve, time)
            //     return this.timer
            // });
        },
        methods: {
            change() {
                this.$emit('click', {
                    detail: this.isShow
                })
            },
            open() {
                clearTimeout(this.timer)
                this.isShow = true
                this.transform = ''
                this.ani.in = ''
                for (let i in this.getTranfrom(false)) {
                    if (i === 'opacity') {
                        this.ani.in = 'fade-in'
                    } else {
                        this.transform += `${this.getTranfrom(false)[i]} `
                    }
                }
                this.$nextTick(() => {
                    setTimeout(() => {
                        this._animation(true)
                    }, 50)
                })
            },
            close(type) {
                clearTimeout(this.timer)
                this._animation(false)
            },
            _animation(type) {
                let styles = this.getTranfrom(type)
                // #ifdef APP-NVUE
                if(!this.$refs['ani']) return
                animation.transition(this.$refs['ani'].ref, {
                    styles,
                    duration: this.duration, //ms
                    timingFunction: 'ease',
                    needLayout: false,
                    delay: 0 //ms
                }, () => {
                    if (!type) {
                        this.isShow = false
                    }
                    this.$emit('change', {
                        detail: this.isShow
                    })
                })
                // #endif
                // #ifndef APP-NVUE
                this.transform = ''
                for (let i in styles) {
                    if (i === 'opacity') {
                        this.ani.in = `fade-${type?'out':'in'}`
                    } else {
                        this.transform += `${styles[i]} `
                    }
                }
                this.timer = setTimeout(() => {
                    if (!type) {
                        this.isShow = false
                    }
                    this.$emit('change', {
                        detail: this.isShow
                    })
                }, this.duration)
                // #endif
            },
            getTranfrom(type) {
                let styles = {
                    transform: ''
                }
                this.modeClass.forEach((mode) => {
                    switch (mode) {
                        case 'fade':
                            styles.opacity = type ? 1 : 0
                            break;
                        case 'slide-top':
                            styles.transform += `translateY(${type?'0':'-100%'}) `
                            break;
                        case 'slide-right':
                            styles.transform += `translateX(${type?'0':'100%'}) `
                            break;
                        case 'slide-bottom':
                            styles.transform += `translateY(${type?'0':'100%'}) `
                            break;
                        case 'slide-left':
                            styles.transform += `translateX(${type?'0':'-100%'}) `
                            break;
                        case 'zoom-in':
                            styles.transform += `scale(${type?1:0.8}) `
                            break;
                        case 'zoom-out':
                            styles.transform += `scale(${type?1:1.2}) `
                            break;
                    }
                })
                return styles
            },
            _modeClassArr(type) {
                let mode = this.modeClass
                if (typeof(mode) !== "string") {
                    let modestr = ''
                    mode.forEach((item) => {
                        modestr += (item + '-' + type + ',')
                    })
                    return modestr.substr(0, modestr.length - 1)
                } else {
                    return mode + '-' + type
                }
            },
            // getEl(el) {
            //     console.log(el || el.ref || null);
            //     return el || el.ref || null
            // },
            toLine(name) {
                return name.replace(/([A-Z])/g, "-$1").toLowerCase();
            }
        }
    }
</script>
<style>
    .uni-transition {
        transition-timing-function: ease;
        transition-duration: 0.3s;
        transition-property: transform, opacity;
    }
    .fade-in {
        opacity: 0;
    }
    .fade-active {
        opacity: 1;
    }
    .slide-top-in {
        /* transition-property: transform, opacity; */
        transform: translateY(-100%);
    }
    .slide-top-active {
        transform: translateY(0);
        /* opacity: 1; */
    }
    .slide-right-in {
        transform: translateX(100%);
    }
    .slide-right-active {
        transform: translateX(0);
    }
    .slide-bottom-in {
        transform: translateY(100%);
    }
    .slide-bottom-active {
        transform: translateY(0);
    }
    .slide-left-in {
        transform: translateX(-100%);
    }
    .slide-left-active {
        transform: translateX(0);
        opacity: 1;
    }
    .zoom-in-in {
        transform: scale(0.8);
    }
    .zoom-out-active {
        transform: scale(1);
    }
    .zoom-out-in {
        transform: scale(1.2);
    }
</style>
js_sdk/wa-permission/permission.js
New file
@@ -0,0 +1,272 @@
/**
 * 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
 */
var isIos
// #ifdef APP-PLUS
isIos = (plus.os.name == "iOS")
// #endif
// 判断推送权限是否开启
function judgeIosPermissionPush() {
    var result = false;
    var UIApplication = plus.ios.import("UIApplication");
    var app = UIApplication.sharedApplication();
    var enabledTypes = 0;
    if (app.currentUserNotificationSettings) {
        var settings = app.currentUserNotificationSettings();
        enabledTypes = settings.plusGetAttribute("types");
        console.log("enabledTypes1:" + enabledTypes);
        if (enabledTypes == 0) {
            console.log("推送权限没有开启");
        } else {
            result = true;
            console.log("已经开启推送功能!")
        }
        plus.ios.deleteObject(settings);
    } else {
        enabledTypes = app.enabledRemoteNotificationTypes();
        if (enabledTypes == 0) {
            console.log("推送权限没有开启!");
        } else {
            result = true;
            console.log("已经开启推送功能!")
        }
        console.log("enabledTypes2:" + enabledTypes);
    }
    plus.ios.deleteObject(app);
    plus.ios.deleteObject(UIApplication);
    return result;
}
// 判断定位权限是否开启
function judgeIosPermissionLocation() {
    var result = false;
    var cllocationManger = plus.ios.import("CLLocationManager");
    var status = cllocationManger.authorizationStatus();
    result = (status != 2)
    console.log("定位权限开启:" + result);
    // 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
    /* var enable = cllocationManger.locationServicesEnabled();
    var status = cllocationManger.authorizationStatus();
    console.log("enable:" + enable);
    console.log("status:" + status);
    if (enable && status != 2) {
        result = true;
        console.log("手机定位服务已开启且已授予定位权限");
    } else {
        console.log("手机系统的定位没有打开或未给予定位权限");
    } */
    plus.ios.deleteObject(cllocationManger);
    return result;
}
// 判断麦克风权限是否开启
function judgeIosPermissionRecord() {
    var result = false;
    var avaudiosession = plus.ios.import("AVAudioSession");
    var avaudio = avaudiosession.sharedInstance();
    var permissionStatus = avaudio.recordPermission();
    console.log("permissionStatus:" + permissionStatus);
    if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
        console.log("麦克风权限没有开启");
    } else {
        result = true;
        console.log("麦克风权限已经开启");
    }
    plus.ios.deleteObject(avaudiosession);
    return result;
}
// 判断相机权限是否开启
function judgeIosPermissionCamera() {
    var result = false;
    var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
    var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
    console.log("authStatus:" + authStatus);
    if (authStatus == 3) {
        result = true;
        console.log("相机权限已经开启");
    } else {
        console.log("相机权限没有开启");
    }
    plus.ios.deleteObject(AVCaptureDevice);
    return result;
}
// 判断相册权限是否开启
function judgeIosPermissionPhotoLibrary() {
    var result = false;
    var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
    var authStatus = PHPhotoLibrary.authorizationStatus();
    console.log("authStatus:" + authStatus);
    if (authStatus == 3) {
        result = true;
        console.log("相册权限已经开启");
    } else {
        console.log("相册权限没有开启");
    }
    plus.ios.deleteObject(PHPhotoLibrary);
    return result;
}
// 判断通讯录权限是否开启
function judgeIosPermissionContact() {
    var result = false;
    var CNContactStore = plus.ios.import("CNContactStore");
    var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
    if (cnAuthStatus == 3) {
        result = true;
        console.log("通讯录权限已经开启");
    } else {
        console.log("通讯录权限没有开启");
    }
    plus.ios.deleteObject(CNContactStore);
    return result;
}
// 判断日历权限是否开启
function judgeIosPermissionCalendar() {
    var result = false;
    var EKEventStore = plus.ios.import("EKEventStore");
    var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
    if (ekAuthStatus == 3) {
        result = true;
        console.log("日历权限已经开启");
    } else {
        console.log("日历权限没有开启");
    }
    plus.ios.deleteObject(EKEventStore);
    return result;
}
// 判断备忘录权限是否开启
function judgeIosPermissionMemo() {
    var result = false;
    var EKEventStore = plus.ios.import("EKEventStore");
    var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
    if (ekAuthStatus == 3) {
        result = true;
        console.log("备忘录权限已经开启");
    } else {
        console.log("备忘录权限没有开启");
    }
    plus.ios.deleteObject(EKEventStore);
    return result;
}
// Android权限查询
function requestAndroidPermission(permissionID) {
    return new Promise((resolve, reject) => {
        plus.android.requestPermissions(
            [permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
            function(resultObj) {
                var result = 0;
                for (var i = 0; i < resultObj.granted.length; i++) {
                    var grantedPermission = resultObj.granted[i];
                    console.log('已获取的权限:' + grantedPermission);
                    result = 1
                }
                for (var i = 0; i < resultObj.deniedPresent.length; i++) {
                    var deniedPresentPermission = resultObj.deniedPresent[i];
                    console.log('拒绝本次申请的权限:' + deniedPresentPermission);
                    result = 0
                }
                for (var i = 0; i < resultObj.deniedAlways.length; i++) {
                    var deniedAlwaysPermission = resultObj.deniedAlways[i];
                    console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
                    result = -1
                }
                resolve(result);
                // 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
                // if (result != 1) {
                // gotoAppPermissionSetting()
                // }
            },
            function(error) {
                console.log('申请权限错误:' + error.code + " = " + error.message);
                resolve({
                    code: error.code,
                    message: error.message
                });
            }
        );
    });
}
// 使用一个方法,根据参数判断权限
function judgeIosPermission(permissionID) {
    if (permissionID == "location") {
        return judgeIosPermissionLocation()
    } else if (permissionID == "camera") {
        return judgeIosPermissionCamera()
    } else if (permissionID == "photoLibrary") {
        return judgeIosPermissionPhotoLibrary()
    } else if (permissionID == "record") {
        return judgeIosPermissionRecord()
    } else if (permissionID == "push") {
        return judgeIosPermissionPush()
    } else if (permissionID == "contact") {
        return judgeIosPermissionContact()
    } else if (permissionID == "calendar") {
        return judgeIosPermissionCalendar()
    } else if (permissionID == "memo") {
        return judgeIosPermissionMemo()
    }
    return false;
}
// 跳转到**应用**的权限页面
function gotoAppPermissionSetting() {
    if (isIos) {
        var UIApplication = plus.ios.import("UIApplication");
        var application2 = UIApplication.sharedApplication();
        var NSURL2 = plus.ios.import("NSURL");
        // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
        var setting2 = NSURL2.URLWithString("app-settings:");
        application2.openURL(setting2);
        plus.ios.deleteObject(setting2);
        plus.ios.deleteObject(NSURL2);
        plus.ios.deleteObject(application2);
    } else {
        // console.log(plus.device.vendor);
        var Intent = plus.android.importClass("android.content.Intent");
        var Settings = plus.android.importClass("android.provider.Settings");
        var Uri = plus.android.importClass("android.net.Uri");
        var mainActivity = plus.android.runtimeMainActivity();
        var intent = new Intent();
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
        intent.setData(uri);
        mainActivity.startActivity(intent);
    }
}
// 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () {
function checkSystemEnableLocation() {
    if (isIos) {
        var result = false;
        var cllocationManger = plus.ios.import("CLLocationManager");
        var result = cllocationManger.locationServicesEnabled();
        console.log("系统定位开启:" + result);
        plus.ios.deleteObject(cllocationManger);
        return result;
    } else {
        var context = plus.android.importClass("android.content.Context");
        var locationManager = plus.android.importClass("android.location.LocationManager");
        var main = plus.android.runtimeMainActivity();
        var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
        var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
        console.log("系统定位开启:" + result);
        return result
    }
}
module.exports = {
    judgeIosPermission: judgeIosPermission,
    requestAndroidPermission: requestAndroidPermission,
    checkSystemEnableLocation: checkSystemEnableLocation,
    gotoAppPermissionSetting: gotoAppPermissionSetting
}
manifest.json
@@ -1,6 +1,6 @@
{
    "name" : "智慧保安",
    "appid" : "__UNI__0F00D11",
    "appid" : "__UNI__6B9ED90",
    "description" : "",
    "versionName" : "1.0.0",
    "versionCode" : "100",
@@ -49,7 +49,8 @@
                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
                    "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
                ]
                ],
                "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
            },
            /* ios打包配置 */
            "ios" : {},
@@ -89,6 +90,22 @@
                    }
                }
            }
        },
        "nativePlugins" : {
            "AR-RtcModule" : {
                "__plugin_info__" : {
                    "name" : "AR-RtcModule",
                    "description" : "anyRTC音视频插件提供音视频功能,支持Android、iOS。",
                    "platforms" : "Android,iOS",
                    "url" : "",
                    "android_package_name" : "",
                    "ios_bundle_id" : "",
                    "isCloud" : false,
                    "bought" : -1,
                    "pid" : "",
                    "parameters" : {}
                }
            }
        }
    },
    /* 快应用特有相关 */
nativePlugins/AR-RtcModule/android/arsdk-release.aar
Binary files differ
nativePlugins/AR-RtcModule/android/rtc-release.aar
Binary files differ
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/ARtcKit
Binary files differ
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/AREnumerates.h
New file
@@ -0,0 +1,1817 @@
//
//  AREnumerates.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/3/20.
//  Copyright © 2020 zjq. All rights reserved.
//
#ifndef AREnumerates_h
#define AREnumerates_h
/** Warning code.
警告代码表示 SDK 运行时出现了(网络或媒体相关的)警告。通常情况下,SDK 上报的警告信息 App 可以忽略,SDK 会自动恢复。比如和服务器失去连接时,SDK 可能会上报 ARWarningCodeOpenChannelTimeout(106) 警告,同时自动尝试重连。
*/
typedef NS_ENUM(NSInteger, ARWarningCode) {
    /**
     8: 指定的 view 无效,使用视频功能时需要指定 view,如果 view 尚未指定,则返回该警告。
     */
    ARWarningCodeInvalidView = 8,
    /**
     16: 初始化视频功能失败。有可能是因视频资源被占用导致的。用户无法看到视频画面,但不影响语音通信。
     */
    ARWarningCodeInitVideo = 16,
     /**
      20: 请求处于待定状态。一般是由于某个模块还没准备好,请求被延迟处理。
      */
    ARWarningCodePending = 20,
    /**
     103: 没有可用的频道资源。可能是因为服务端没法分配频道资源。
     */
    ARWarningCodeNoAvailableChannel = 103,
    /**
     104: 查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器。
     */
    ARWarningCodeLookupChannelTimeout = 104,
    /**
     105: 查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的。
     */
    ARWarningCodeLookupChannelRejected = 105,
    /**
     106: 打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器。
     */
    ARWarningCodeOpenChannelTimeout = 106,
    /**
     107: 打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的。
     */
    ARWarningCodeOpenChannelRejected = 107,
    /**
     111: 切换直播视频超时。
     */
    ARWarningCodeSwitchLiveVideoTimeout = 111,
    /**
     118: 直播场景下设置用户角色超时。
     */
    ARWarningCodeSetClientRoleTimeout = 118,
    /**
     119: 直播场景下用户角色未授权。
     */
    ARWarningCodeSetClientRoleNotAuthorized = 119,
    /**
     121: TICKET 非法,打开频道失败。
     */
    ARWarningCodeOpenChannelInvalidTicket = 121,
    /**
     122: 尝试打开另一个服务器。
     */
    ARWarningCodeOpenChannelTryNextVos = 122,
    /**
     701: 打开伴奏出错。
     */
    ARWarningCodeAudioMixingOpenError = 701,
    /**
     1014: 音频设备模块:运行时播放设备出现警告。
     */
    ARWarningCodeAdmRuntimePlayoutWarning = 1014,
    /**
     1016: 音频设备模块:运行时录音设备出现警告。
     */
    ARWarningCodeAdmRuntimeRecordingWarning = 1016,
    /**
     1019: 音频设备模块:没有采集到有效的声音数据。该警告不影响正常通话。
     */
    ARWarningCodeAdmRecordAudioSilence = 1019,
    /**
     1020: 音频设备模块:播放设备故障。
     */
    ARWarningCodeAdmPlaybackMalfunction = 1020,
    /**
     1021: 音频设备模块:录音设备故障。
     */
    ARWarningCodeAdmRecordMalfunction = 1021,
    /**
     1025: 通话或直播被系统声音打断,比如电话、闹钟等。
     */
    ARWarningCodeAdmInterruption = 1025,
    /**
     1031: 音频设备模块:录到的声音太低。
     */
    ARWarningCodeAdmRecordAudioLowlevel = 1031,
    /**
     1032: 音频设备模块:播放的声音太低。
     */
    ARWarningCodeAdmPlayoutAudioLowlevel = 1032,
    /**
     1051: 音频设备模块:录音声音监测到啸叫。
     */
    ARWarningCodeApmHowling = 1051,
    /**
     1052: 音频设备模块:音频播放会卡顿。
     */
    ARWarningCodeAdmGlitchState = 1052,
    /**
     1053: 音频设备模块:音频底层设置被修改。
     */
    ARWarningCodeAdmImproperSettings = 1053,
};
/** 错误代码
错误代码表示 SDK 运行时出现了(网络或媒体相关的)错误。通常情况下,SDK 上报的错误意味着 SDK 无法自动恢复,需要 App 干预或提示用户。 比如启动通话失败时,SDK 会上报 ARErrorCodeStartCall = 1002 错误。App可以提示用户启动通话失败,并调用 leaveChannel 退出频道。
*/
typedef NS_ENUM(NSInteger, ARErrorCode) {
    /**
     0: 没有错误。
     */
    ARErrorCodeNoError = 0,
    /**
     1: 一般性的错误(没有明确归类的错误原因)。
     */
    ARErrorCodeFailed = 1,
    /**
     2: API 调用了无效的参数。例如指定的频道名含有非法字符。
     */
    ARErrorCodeInvalidArgument = 2,
    /**
     3: SDK 未准备好。
     处理方法:
     * 检查音频设备状态
     * 检查程序集完整性
     * 尝试重新初始化 SDK
    */
    ARErrorCodeNotReady = 3,
    /**
     4: SDK 当前状态不支持此操作,因此不能进行此操作。
     */
    ARErrorCodeNotSupported = 4,
    /**
     5: 调用被拒绝。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeRefused = 5,
    /**
     6: 传入的缓冲区大小不足以存放返回的数据。
     */
    ARErrorCodeBufferTooSmall = 6,
    /**
     7: SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 ARtcEngineKit 对象并完成初始化。
     */
    ARErrorCodeNotInitialized = 7,
    /**
     9: 没有操作权限,请检查用户是否授予 app 音视频设备使用权限。
     */
    ARErrorCodeNoPermission = 9,
    /**
     10: API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误。
     */
    ARErrorCodeTimedOut = 10,
    /**
     11: 请求被取消。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeCanceled = 11,
    /**
     12: 调用频率太高。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeTooOften = 12,
    /**
     13: SDK 内部绑定到网络 Socket 失败。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeBindSocket = 13,
    /**
     14: 网络不可用。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeNetDown = 14,
    /**
     15: 没有网络缓冲区可用。仅供 SDK 内部使用,不通过 API 或者回调事件返回给 App。
     */
    ARErrorCodeNoBufs = 15,
    /**
     17: 加入频道被拒绝。
     一般有以下原因:
     * 用户已进入频道,再次调用加入频道的 API,例如 joinChannelByToken,会返回此错误。停止调用该 API 即可。
     * 用户在做 Echo 测试时尝试加入频道。等待 Echo test 结束后再加入频道即可。
    */
    ARErrorCodeJoinChannelRejected = 17,
    /**
     18: 离开频道失败。
     一般有以下原因:
     * 用户已离开频道,再次调用退出频道的 API,例如 leaveChannel,会返回此错误。停止调用该 API 即可。
     * 用户尚未加入频道,就调用退出频道的 API。这种情况下无需额外操作。
    */
    ARErrorCodeLeaveChannelRejected = 18,
    /**
     19: 资源已被占用,不能重复使用。
     */
    ARErrorCodeAlreadyInUse = 19,
    /**
     20: SDK 放弃请求,可能由于请求次数太多。
     */
    ARErrorCodeAbort = 20,
    /**
     21: Windows 下特定的防火墙设置导致 SDK 初始化失败然后崩溃。
     */
    ARErrorCodeInitNetEngine = 21,
    /**
     22: 当用户 App 占用资源过多,或系统资源耗尽时,SDK 分配资源失败会返回该错误。
     */
    ARErrorCodeResourceLimited = 22,
    /**
     101: 不是有效的 App ID。请更换有效的 App ID 重新加入频道。
     */
    ARErrorCodeInvalidAppId = 101,
    /**
     102: 不是有效的频道名。请更换有效的频道名重新加入频道。
     */
    ARErrorCodeInvalidChannelId = 102,
    /**
     109: 当前使用的 Token 过期,不再有效。
     connectionChangedToState 回调中 reason 参数的 ARConnectionChangedTokenExpired(9)。
     一般有以下原因:
     * Token 授权时间戳无效:Token 授权时间戳为 Token 生成时的时间戳,自 1970 年 1 月 1 日开始到当前时间的描述。授权该 Token 在生成后的 24 小时内可以访问 anyRTC 服务。如果 24 小时内没有访问,则该 Token 无法再使用。需要重新在服务端申请生成 Token。
     * Token 服务到期时间戳已过期:用户设置的服务到期时间戳小于当前时间戳,无法继续使用 anyRTC 服务(比如正在进行的通话会被强制终止);设置服务到期时间并不意味着 Token 失效,而仅仅用于限制用户使用当前服务的时间。需要重新在服务端申请生成 Token。
     */
    ARErrorCodeTokenExpired = 109,
    /**
     110: 生成的 Token 无效。
     connectionChangedToState 回调中 reason 参数的 ARConnectionChangedInvalidToken(8)。
     一般有以下原因:
     * 用户在控制台上启用了 App Certificate,但仍旧在代码里仅使用了 App ID。当启用了 App Certificate,必须使用 Token。
     * 字段 uid 为生成 Token 的必须字段,用户在调用 joinChannelByToken 加入频道时必须设置相同的 uid。
     */
    ARErrorCodeInvalidToken = 110,
    /**
     111: 网络连接中断。仅适用于 anyRTC Web SDK。
     */
    ARErrorCodeConnectionInterrupted = 111,
    /**
     112: 网络连接丢失。仅适用于 anyRTC Web SDK。
     */
    ARErrorCodeConnectionLost = 112,
    /**
     113: 在调用 sendStreamMessage 时,如果用户不在频道内,会发生该错误。
     */
    ARErrorCodeNotInChannel = 113,
    /**
     114: 在调用 sendStreamMessage 时,当发送的数据长度大于 1024 个字节时,会发生该错误。
     */
    ARErrorCodeSizeTooLarge = 114,
    /**
     115: 在调用 sendStreamMessage 时,当发送的数据码率超过限制时 (6 Kbps),会发生该错误。
     */
    ARErrorCodeBitrateLimit = 115,
    /**
     116: 在调用 createDataStream 时,如果创建的数据通道过多(超过 5 个通道),会发生该错误。
     */
    ARErrorCodeTooManyDataStreams = 116,
    /**
     120: 解密失败,可能是用户加入频道用了不同的密码。请检查加入频道时的设置,或尝试重新加入频道。
     */
    ARErrorCodeDecryptionFailed = 120,
    /**
     124: 水印文件参数错误。
     */
    ARErrorCodeWatermarkParam = 124,
    /**
     125: 水印文件路径错误。
     */
    ARErrorCodeWatermarkPath = 125,
    /**
     126: 水印文件格式错误。
     */
    ARErrorCodeWatermarkPng = 126,
    /**
     127: 水印文件信息错误。
     */
    ARErrorCodeWatermarkInfo = 127,
    /**
     128: 水印文件数据格式错误。
     */
    ARErrorCodeWatermarkAGRB = 128,
    /**
     129: 水印文件读取错误。
     */
    ARErrorCodeWatermarkRead = 129,
    /**
     130: 推流已加密不能推流。
     */
    ARErrorCodeEncryptedStreamNotAllowedPublish = 130,
    /**
     134: 无效的 User Account。
     */
    ARErrorCodeInvalidUserAccount = 134,
    /**
     151: CDN 相关错误。请调用 removePublishStreamUrl 方法删除原来的推流地址,然后调用 addPublishStreamUrl 方法重新推流到新地址。
     */
    ARErrorCodePublishStreamCDNError = 151,
    /**
     152: 单个主播的推流地址数目达到上限 10。请删掉一些不用的推流地址再增加推流地址。
     */
    ARErrorCodePublishStreamNumReachLimit = 152,
    /**
     153: 操作不属于主播自己的流,例如更新其他主播的流参数、停止其他主播的流。请检查 App 逻辑。
     */
    ARErrorCodePublishStreamNotAuthorized = 153,
    /**
     154: 推流服务器出现错误。请调用 addPublishStreamUrl 重新推流。
     */
    ARErrorCodePublishStreamInternalServerError = 154,
    /**
     155: 服务器未找到这个流。
     */
    ARErrorCodePublishStreamNotFound = 155,
    /**
     156: 推流地址格式有错误。请检查推流地址格式是否正确。
     */
    ARErrorCodePublishStreamFormatNotSuppported = 156,
    /**
     1001: 加载媒体引擎失败。
     */
    ARErrorCodeLoadMediaEngine = 1001,
    /**
     1002: 启动媒体引擎开始通话失败。请尝试重新进入频道。
     */
    ARErrorCodeStartCall = 1002,
    /**
     1003: 启动摄像头失败,请检查摄像头是否被其他应用占用,或者尝试重新进入频道。
     */
    ARErrorCodeStartCamera = 1003,
    /**
     1004: 启动视频渲染模块失败。
     */
    ARErrorCodeStartVideoRender = 1004,
    /**
     1005: 音频设备模块:音频设备出现错误(未明确指明为何种错误)。请检查音频设备是否被其它应用占用,或者尝试重新进入频道。
     */
    ARErrorCodeAdmGeneralError = 1005,
    /**
     1006: 音频设备模块:使用 java 资源出现错误。
     */
    ARErrorCodeAdmJavaResource = 1006,
    /**
     1007: 音频设备模块:设置的采样频率出现错误。
     */
    ARErrorCodeAdmSampleRate = 1007,
    /**
     1008: 音频设备模块:初始化播放设备出现错误。请检查播放设备是否被其他应用占用,或者尝试重新进入频道。
     */
    ARErrorCodeAdmInitPlayout = 1008,
    /**
     1009: 音频设备模块:启动播放设备出现错误。请检查播放设备是否正常,或者尝试重新进入频道。
     */
    ARErrorCodeAdmStartPlayout = 1009,
    /**
     1010: 音频设备模块:停止播放设备出现错误。
     */
    ARErrorCodeAdmStopPlayout = 1010,
    /**
     1011: 音频设备模块:初始化录音设备时出现错误。请检查录音设备是否正常,或者尝试重新进入频道。
     */
    ARErrorCodeAdmInitRecording = 1011,
    /**
     1012: 音频设备模块:启动录音设备出现错误。请检查录音设备是否正常,或者尝试重新进入频道。
     */
    ARErrorCodeAdmStartRecording = 1012,
    /**
     1013: 音频设备模块:停止录音设备出现错误。
     */
    ARErrorCodeAdmStopRecording = 1013,
    /**
     1015: 音频设备模块:运行时播放出现错误。请检查播放设备是否正常,或者尝试重新进入频道。
     */
    ARErrorCodeAdmRuntimePlayoutError = 1015,
    /**
     1017: 音频设备模块:运行时录音错误。请检查录音设备是否正常,或者尝试重新进入频道。
     */
    ARErrorCodeAdmRuntimeRecordingError = 1017,
    /**
     1018: 音频设备模块:录音失败。
     */
    ARErrorCodeAdmRecordAudioFailed = 1018,
    /**
     1020: 音频设备模块:回放频率异常。
     */
    ARErrorCodeAdmPlayAbnormalFrequency = 1020,
    /**
     1021: 音频设备模块:录制频率异常。
     */
    ARErrorCodeAdmRecordAbnormalFrequency = 1021,
    /**
     1022: 音频设备模块:初始化 Loopback 设备错误。
     */
    ARErrorCodeAdmInitLoopback  = 1022,
    /**
     1023: 音频设备模块:启动 Loopback 设备错误。
     */
    ARErrorCodeAdmStartLoopback = 1023,
    /**
     1027: 音频设备模块:  在没有录音权限时发生错误。
     */
    ARErrorCodeAdmNoPermission = 1027,
    /**
     1359: 音频设备模块:无录制设备。请检查是否有可用的录放音设备或者录放音设备是否已经被其他应用占用。
     */
    ARErrorCodeAdmNoRecordingDevice = 1359,
    /**
     1360: 音频设备模块:无播放设备。
     */
    ARErrorCodeAdmNoPlayoutDevice = 1360,
    /**
     1501: 视频设备模块:没有摄像头使用权限。请检查是否已经打开摄像头权限。
     */
    ARErrorCodeVdmCameraNotAuthorized = 1501,
    /**
     1600: 视频设备模块:未知错误。
     */
    ARErrorCodeVcmUnknownError = 1600,
    /**
     1601: 视频设备模块:视频编码器初始化错误。该错误为严重错误,请尝试重新加入频道。
     */
    ARErrorCodeVcmEncoderInitError = 1601,
    /**
     1602: 视频设备模块:视频编码器错误。该错误为严重错误,请尝试重新加入频道。
     */
    ARErrorCodeVcmEncoderEncodeError = 1602
};
/** 混音音乐文件状态 */
typedef NS_ENUM(NSInteger, ARAudioMixingStateCode){
    /**
     710: 视频设备模块:未知错误。
     */
    ARAudioMixingStatePlaying = 710,
    /**
     711: 音乐文件暂停播放
     */
    ARAudioMixingStatePaused = 711,
    /**
     713:音乐文件停止播放
     */
    ARAudioMixingStateStopped = 713,
    /**
     714:音乐文件播放出错
     */
    ARAudioMixingStateFailed = 714,
};
/** 混音音乐文件错误码 */
typedef NS_ENUM(NSInteger, ARAudioMixingErrorCode){
    /**
     701: 音乐文件打开出错
     */
    ARAudioMixingErrorCanNotOpen = 701,
    /**
     702: 音乐文件打开太频繁
     */
    ARAudioMixingErrorTooFrequentCall = 702,
    /**
     703: 音乐文件打开中断
     */
    ARAudioMixingErrorInterruptedEOF = 703,
    /**
     0: 音乐文件状态正常
     */
    ARAudioMixingErrorOK = 0,
};
/** 频道使用场景 */
typedef NS_ENUM(NSUInteger, ARChannelProfile ) {
    /**
     0: 通信场景
     */
    ARChannelProfileCommunication = 0,
    /**
     1: 直播场景
     */
    ARChannelProfileLiveBroadcasting = 1,
    /**
     2: 游戏语音场景
     */
    ARChannelProfileGame = 2
};
/** 视频显示模式 */
typedef NS_ENUM(NSUInteger, ARVideoRenderMode ) {
  /**
   1:优先保证视窗被填满。视频尺寸等比缩放,直至整个视窗被视频填满。如果视频长宽与显示窗口不同,则视频流会按照显示视窗的比例进行周边裁剪或图像拉伸后填满视窗。
   */
   ARVideoRenderModeHidden = 1,
  /**
   2:优先保证视频内容全部显示。视频尺寸等比缩放,直至视频窗口的一边与视窗边框对齐。如果视频尺寸与显示视窗尺寸不一致,在保持长宽比的前提下,将视频进行缩放后填满视窗,缩放后的视频四周会有一圈黑边。
   */
   ARVideoRenderModeFit = 2,
   /**
   4:视频尺寸进行缩放和拉伸以充满显示视窗。
   */
   ARVideoRenderModeFill = 4
};
/** 视频镜像模式 */
typedef NS_ENUM(NSUInteger, ARVideoMirrorMode ) {
    /**
     0: (Default) 由 SDK 决定镜像模式
     */
    ARVideoMirrorModeAuto = 0,
    /**
     1: 启用镜像模式
     */
    ARVideoMirrorModeEnabled = 1,
    /**
     2: 关闭镜像模式
     */
    ARVideoMirrorModeDisabled = 2
};
/** 直播场景里的用户角色 */
typedef NS_ENUM(NSInteger, ARClientRole) {
    /**
     1:主播
     */
    ARClientRoleBroadcaster = 1,
    /**
     2:观众(默认)
     */
    ARClientRoleAudience = 2,
};
/** 用户离线原因 */
typedef NS_ENUM(NSUInteger, ARUserOfflineReason) {
    /**
     0:用户主动离开
     */
    ARUserOfflineReasonQuit = 0,
    /**
     1:因过长时间收不到对方数据包,超时掉线。注意:由于 SDK 使用的是不可靠通道,也有可能对方主动离开本方没收到对方离开消息而误判为超时掉线
     */
    ARUserOfflineReasonDropped = 1,
    /**
     2:用户身份从主播切换为观众时触发
     */
    ARUserOfflineReasonBecomeAudience = 2,
};
/** 网络状态 */
typedef NS_ENUM(NSInteger, ARNetworkType) {
    /**
     -1:网络连接类型未知
     */
    ARNetworkTypeUnknown = 0,
    /**
     1:网络类型为 LAN
     */
    ARNetworkTypeLAN = 1,
    /**
     2:网络类型为 Wi-Fi(包含热点)
     */
    ARNetworkTypeWIFI = 2,
    /**
     3:网络类型为 2G 移动网络
     */
    ARNetworkTypeMobile2G = 3,
    /**
     4:网络类型为 3G 移动网络
     */
    ARNetworkTypeMobile3G = 4,
    /**
     5:网络类型为 4G 移动网络
     */
    ARNetworkTypeMobile4G = 5
};
/** 网络连接状态类型 */
typedef NS_ENUM(NSInteger, ARConnectionStateType) {
    /**
     1:网络连接断开
     */
    ARConnectionStateDisconnected = 1,
    /**
     2:建立网络连接中
     */
    ARConnectionStateConnecting = 2,
    /**
     3:网络已连接
     */
    ARConnectionStateConnected = 3,
    /**
     4:重新建立网络连接中
     */
    ARConnectionStateReconnecting = 4,
    /**
     5:网络连接失败
     */
    ARConnectionStateFailed = 5
};
/** 音频属性 */
typedef NS_ENUM(NSInteger, ARAudioProfile) {
    /**
     0:默认设置,通信场景下,默认ARAudioProfileSpeechStandard。直播场景下,默认ARAudioProfileMusicStandard
     */
    ARAudioProfileDefault = 0,
    /**
     1:指定 32 KHz采样率,语音编码,单声道,编码码率最大值为 18 Kbps
     */
    ARAudioProfileSpeechStandard = 1,
    /**
     2:指定 48 KHz采样率,音乐编码,单声道,编码码率最大值为 48 Kbps。
     */
    ARAudioProfileMusicStandard = 2,
    /**
     3:指定 48 KHz采样率,音乐编码,双声道,编码码率最大值为 56 Kbps
     */
    ARAudioProfileMusicStandardStereo = 3,
    /**
     4:指定 48 KHz 采样率,音乐编码,单声道,编码码率最大值为 128 Kbps
     */
    ARAudioProfileMusicHighQuality = 4,
    /**
     5:指定 48 KHz采样率,音乐编码,双声道,编码码率最大值为 192 Kbps
     */
    ARAudioProfileMusicHighQualityStereo = 5
};
/** 设置音频应用场景 */
typedef NS_ENUM(NSInteger, ARAudioScenario) {
    /**
     0: 默认的音频应用场景。 */
    ARAudioScenarioDefault = 0,
    /**
     1: 娱乐应用,需要频繁上下麦的场景
     */
    ARAudioScenarioChatRoomEntertainment = 1,
    /**
     2: 教育场景,适用于需要高流畅度和稳定性的场景。
     */
    ARAudioScenarioEducation = 2,
    /**
     3: 高音质语聊房场景,适用于音乐为主的场景。
     */
    ARAudioScenarioGameStreaming = 3,
    /**
     4: 秀场场景,适用于需要高音质的单主播场景。
     */
    ARAudioScenarioShowRoom = 4,
    /**
     5: 游戏开黑场景,适用于只有人声的场景。
     */
    ARAudioScenarioChatRoomGaming = 5
};
/** 远端视频流状态 */
typedef NS_ENUM(NSUInteger, ARVideoRemoteState) {
    /**
     0: 远端视频默认初始状态。在 ARVideoRemoteStateReasonLocalMuted(3)、ARVideoRemoteStateReasonRemoteMuted(5) 或 ARVideoRemoteStateReasonRemoteMuted(7) 的情况下,会报告该状态。
     */
    ARVideoRemoteStateStopped = 0,
    /**
     1: 本地用户已接收远端视频首包。
     */
    ARVideoRemoteStateStarting = 1,
    /**
     2: 远端视频流正在解码,正常播放。在 ARVideoRemoteStateReasonNetworkRecovery(2)、ARVideoRemoteStateReasonNetworkRecovery(4)、ARVideoRemoteStateReasonRemoteUnmuted(6) 或 ARVideoRemoteStateReasonAudioFallbackRecovery(9) 的情况下,会报告该状态。
     */
    ARVideoRemoteStateDecoding = 2,
    /**
     3: 远端视频流卡顿。在 ARVideoRemoteStateReasonNetworkCongestion(1) 或 ARVideoRemoteStateReasonAudioFallback(8) 的情况下,会报告该状态。
     */
    ARVideoRemoteStateFrozen = 3,
    /**
     4: 远端视频流播放失败。在 ARVideoRemoteStateReasonInternal(0) 的情况下,会报告该状态。
     */
    ARVideoRemoteStateFailed = 4,
};
/** 远端视频流状态改变的具体原因 */
typedef NS_ENUM(NSUInteger, ARVideoRemoteStateReason ) {
    /**
     0: 内部原因。
     */
    ARVideoRemoteStateReasonInternal = 0,
    /**
     1: 网络阻塞。
     */
    ARVideoRemoteStateReasonNetworkCongestion = 1,
    /**
     2: 网络恢复正常。
     */
    ARVideoRemoteStateReasonNetworkRecovery = 2,
    /**
     3: 本地用户停止接收远端视频流或本地用户禁用视频模块。
     */
    ARVideoRemoteStateReasonLocalMuted = 3,
    /**
     4: 本地用户恢复接收远端视频流或本地用户启动视频模块。
     */
    ARVideoRemoteStateReasonLocalUnmuted = 4,
    /**
     5: 远端用户停止发送视频流或远端用户禁用视频模块。
     */
    ARVideoRemoteStateReasonRemoteMuted = 5,
    /**
     6: 远端用户恢复发送视频流或远端用户启用视频模块。
     */
    ARVideoRemoteStateReasonRemoteUnmuted = 6,
    /**
     7: 远端用户离开频道。
     */
    ARVideoRemoteStateReasonRemoteOffline = 7,
    /**
     8: 远端视频流已回退为音频流。
     */
    ARVideoRemoteStateReasonAudioFallback = 8,
    /**
     9: 回退的远端音频流恢复为视频流。
     */
    ARVideoRemoteStateReasonAudioFallbackRecovery = 9
};
/** 选择高码率高分辨率视频或低码率低分辨率视频 */
typedef NS_ENUM(NSInteger, ARVideoStreamType ) {
    /**
    0:高码率、高分辨率视频
    */
    ARVideoStreamTypeHigh = 0,
    /**
    1:低码率、低分辨率视频
    */
    ARVideoStreamTypeLow = 1,
};
/** 视频输出方向模式 */
typedef NS_ENUM(NSInteger, ARVideoOutputOrientationMode ) {
    /**
     0:自适应布局(默认)
     该模式下SDK输出的视频方向与采集到的视频方向一致。接收端会根据收到的视频旋转信息对视频进行旋转。该模式适用于接收端可以调整视频方向的场景:
     * 如果采集的视频是横屏模式,则输出的视频也是横屏模式。
     * 如果采集的视频是竖屏模式,则输出的视频也是竖屏模式。
     */
    ARVideoOutputOrientationModeAdaptative = 0,
    /**
     1:横屏布局
     该模式下SDK固定输出人像(横屏)模式的视频。如果采集到的视频是竖屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
     */
    ARVideoOutputOrientationModeFixedLandscape = 1,
    /**
     2:竖屏布局
     该模式下SDK固定输出人像(竖屏)模式的视频。如果采集到的视频是横屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
     */
    ARVideoOutputOrientationModeFixedPortrait = 2,
};
/** 带宽受限时的视频编码降级偏好 */
typedef NS_ENUM(NSInteger, ARDegradationPreference) {
    /**
     0:(默认)降低编码帧率以保证视频质量。
     */
    ARDegradationMaintainQuality = 0,
    /**
     1:降低视频质量以保证编码帧率。
     */
    ARDegradationMaintainFramerate = 1,
    /**
     2:(预留参数,暂不支持)在编码帧率和视频质量之间保持平衡。
     */
    ARDegradationBalanced = 2,
};
/** 视频帧率 */
typedef NS_ENUM(NSInteger, ARVideoFrameRate) {
    /**
     1 fps.
     */
    ARVideoFrameRateFps1 = 1,
    /**
     7 fps.
     */
    ARVideoFrameRateFps7 = 7,
    /**
     10 fps.
     */
    ARVideoFrameRateFps10 = 10,
    /**
     15 fps.
     */
    ARVideoFrameRateFps15 = 15,
    /**
     24 fps.
     */
    ARVideoFrameRateFps24 = 24,
    /**
     30 fps.
     */
    ARVideoFrameRateFps30 = 30,
    /**
     60 fps (仅支持 macOS).
     */
    ARVideoFrameRateFps60 = 60,
};
/** 本地音频状态 */
typedef NS_ENUM(NSUInteger, ARAudioLocalState) {
    /**
     0: 本地音频默认初始状态。
     */
    ARAudioLocalStateStopped = 0,
    /**
     1: 本地音频录制设备启动成功。
     */
    ARAudioLocalStateRecording = 1,
    /**
     2: 本地音频首帧编码成功。
     */
    ARAudioLocalStateEncoding = 2,
    /**
     3: 本地音频启动失败。
     */
    ARAudioLocalStateFailed = 3,
};
/** 本地音频出错原因 */
typedef NS_ENUM(NSUInteger, ARAudioLocalError) {
    /**
     0: 本地音频状态正常。
     */
    ARAudioLocalErrorOk = 0,
    /**
     1: 本地音频出错原因不明确。
     */
    ARAudioLocalErrorFailure = 1,
    /**
     2: 没有权限启动本地音频录制设备。
     */
    ARAudioLocalErrorDeviceNoPermission = 2,
    /**
     3: 本地音频录制设备已经在使用中。
     */
    ARAudioLocalErrorDeviceBusy = 3,
    /**
     4: 本地音频录制失败,建议你检查录制设备是否正常工作。
     */
    ARAudioLocalErrorRecordFailure = 4,
    /**
     5: 本地音频编码失败。
     */
    ARAudioLocalErrorEncodeFailure = 5,
};
/** 远端音频状态 */
typedef NS_ENUM(NSUInteger, ARAudioRemoteState) {
    /**
     0: 远端音频流默认初始状态。在 ARAudioRemoteReasonLocalMuted(3)、ARAudioRemoteReasonRemoteMuted(5) 或 ARAudioRemoteReasonRemoteOffline(7) 的情况下,会报告该状态。
     */
    ARAudioRemoteStateStopped = 0,
    /**
     1: 本地用户已接收远端音频首包。
     */
    ARAudioRemoteStateStarting = 1,
    /**
     2: 远端音频流正在解码,正常播放。在 ARAudioRemoteReasonNetworkRecovery(2)、ARAudioRemoteReasonLocalUnmuted(4) 或 ARAudioRemoteReasonRemoteUnmuted(6) 的情况下,会报告该状态。
     */
    ARAudioRemoteStateDecoding = 2,
    /**
     3: 远端音频流卡顿。在 ARAudioRemoteReasonNetworkCongestion(1) 的情况下,会报告该状态。
     */
    ARAudioRemoteStateFrozen = 3,
    /**
     4: 远端音频流播放失败。在 ARAudioRemoteReasonInternal(0) 的情况下,会报告该状态。
     */
    ARAudioRemoteStateFailed = 4,
};
/** 远端音频流状态改变的具体原因 */
typedef NS_ENUM(NSUInteger, ARAudioRemoteStateReason) {
    /**
     0: 内部原因。
     */
    ARAudioRemoteReasonInternal = 0,
    /**
     1: 网络阻塞。
     */
    ARAudioRemoteReasonNetworkCongestion = 1,
    /**
     2: 网络恢复正常。
     */
    ARAudioRemoteReasonNetworkRecovery = 2,
    /**
     3: 本地用户停止接收远端音频流或本地用户禁用音频模块。
     */
    ARAudioRemoteReasonLocalMuted = 3,
    /**
     4: 本地用户恢复接收远端音频流或本地用户启用音频模块。
     */
    ARAudioRemoteReasonLocalUnmuted = 4,
    /**
     5: 远端用户停止发送音频流或远端用户禁用音频模块。
     */
    ARAudioRemoteReasonRemoteMuted = 5,
    /**
     6: 远端用户恢复发送音频流或远端用户启用音频模块。
     */
    ARAudioRemoteReasonRemoteUnmuted = 6,
    /**
     7: 远端用户离开频道。
     */
    ARAudioRemoteReasonRemoteOffline = 7,
};
/** 本地视频状态 */
typedef NS_ENUM(NSInteger, ARLocalVideoStreamState) {
    /**
    0: 本地视频默认初始状态。
    */
    ARLocalVideoStreamStateStopped = 0,
    /**
    1: 本地视频采集设备启动成功。
    */
    ARLocalVideoStreamStateCapturing = 1,
    /**
    2: 本地视频首帧编码成功。
    */
    ARLocalVideoStreamStateEncoding = 2,
    /**
    3: 本地视频启动失败。
     */
    ARLocalVideoStreamStateFailed = 3,
};
/** 本地视频出错原因 */
typedef NS_ENUM(NSInteger, ARLocalVideoStreamError) {
    /**
    0: 本地视频状态正常。
    */
    ARLocalVideoStreamErrorOK = 0,
    /**
    1: 出错原因不明确。
    */
    ARLocalVideoStreamErrorFailure = 1,
    /**
    2: 没有权限启动本地视频采集设备。
    */
    ARLocalVideoStreamErrorDeviceNoPermission = 2,
    /**
    3: 本地视频采集设备正在使用中。
    */
    ARLocalVideoStreamErrorDeviceBusy = 3,
    /**
    4: 本地视频采集失败,建议检查采集设备是否正常工作。
    */
    ARLocalVideoStreamErrorCaptureFailure = 4,
    /**
    5: 本地视频编码失败。
    */
    ARLocalVideoStreamErrorEncodeFailure = 5,
    /**
    6: (仅适用于 iOS)应用处于后台
     @since v4.2.0
    */
    ARLocalVideoStreamErrorCaptureInBackGround = 6,
    /**
    7: (仅支持 iOS) 应用窗口处于侧拉、分屏、画中画模式。
     @since v4.2.0
    */
    ARLocalVideoStreamErrorCaptureMultipleForegroundApps = 7,
    /**
    11:(仅支持 macOS)调用 startScreenCaptureByWindowId 方法共享窗口时, 共享窗口处于最小化的状态。
     @since v4.2.0
    */
    ARLocalVideoStreamErrorScreenCaptureWindowMinimized = 11,
    /**
     12:(仅支持 macOS)该错误码表示通过窗口 ID 共享的窗口已关闭,或通过窗口 ID 共享的全屏窗口已退出全屏。退出全屏模式后,远端用户将无法看到共享的窗口。为避免远端用户看到黑屏,Agora 建议你立即结束本次共享。
     @since v4.2.0
    */
    ARLocalVideoStreamErrorScreenCaptureWindowClosed = 12
};
/** 摄像头采集偏好 */
typedef NS_ENUM(NSInteger, ARCameraCaptureOutputPreference) {
    /**
     0:(默认)自动调整采集参数。SDK 根据实际的采集设备性能及网络情况,选择合适的摄像头输出参数,在设备性能及视频预览质量之间,维持平衡。
     */
    ARCameraCaptureOutputPreferenceAuto = 0,
    /**
     1:优先保证设备性能。SDK 根据用户在 setVideoEncoderConfiguration 中设置编码器的分辨率和帧率,选择最接近的摄像头输出参数,从而保证设备性能。在这种情况下,预览质量接近于编码器的输出质量*/
    ARCameraCaptureOutputPreferencePerformance = 1,
    /**
     2:优先保证视频预览质量。SDK 选择较高的摄像头输出参数,从而提高预览视频的质量。在这种情况下,会消耗更多的 CPU 及内存做视频前处理。
     */
    ARCameraCaptureOutputPreferencePreview = 2,
    /**
     3:仅供内部使用
     */
    ARCameraCaptureOutputPreferenceUnkown = 3
};
#if TARGET_OS_IOS
/** 摄像头方向 */
typedef NS_ENUM(NSInteger, ARCameraDirection) {
    /**
    0:使用后置摄像头
    */
    ARCameraDirectionRear = 0,
    /**
    1:使用前置摄像头
    */
    ARCameraDirectionFront = 1,
};
#endif
/** 语音路由 */
typedef NS_ENUM(NSInteger, ARAudioOutputRouting) {
    /**
     -1:使用默认的语音路由
     */
    ARAudioOutputRoutingDefault = -1,
    /**
     0:使用耳机为语音路由
     */
    ARAudioOutputRoutingHeadset = 0,
    /**
     1:使用听筒为语音路由
     */
    ARAudioOutputRoutingEarpiece = 1,
    /**
     2:使用不带麦的耳机为语音路由
     */
    ARAudioOutputRoutingHeadsetNoMic = 2,
    /**
     3:使用手机的扬声器为语音路由
     */
    ARAudioOutputRoutingSpeakerphone = 3,
    /**
     4:使用外接的扬声器为语音路由
     */
    ARAudioOutputRoutingLoudspeaker = 4,
    /**
     5:使用蓝牙耳机为语音路由
     */
    ARAudioOutputRoutingHeadsetBluetooth = 5
};
/** 引起网络连接状态发生改变的原因 */
typedef NS_ENUM(NSUInteger, ARConnectionChangedReason) {
    /**
     0: 建立网络连接中。
     */
    ARConnectionChangedConnecting = 0,
    /**
     1: 成功加入频道。
     */
    ARConnectionChangedJoinSuccess = 1,
    /**
     2: 网络连接中断。
     */
    ARConnectionChangedInterrupted = 2,
    /**
     3: 网络连接被服务器禁止。
     */
    ARConnectionChangedBannedByServer = 3,
    /**
     4: 加入频道失败。SDK 在尝试加入频道 20 分钟后还是没能加入频道,会返回该状态,并停止尝试重连。
     */
    ARConnectionChangedJoinFailed = 4,
    /**
     5: 离开频道。
     */
    ARConnectionChangedLeaveChannel = 5,
    /**
     6: 不是有效的 APP ID。请更换有效的 APP ID 重新加入频道。
     */
    ARConnectionChangedInvalidAppId = 6,
    /**
     7: 不是有效的频道名。请更换有效的频道名重新加入频道。
     */
    ARConnectionChangedInvalidChannelName = 7,
    /**
     8: 生成的 Token 无效。一般有以下原因:
     * 在控制台上启用了 App Certificate,但加入频道未使用 Token。当启用了 App Certificate,必须使用 Token。
     * 在调用 joinChannelByToken 加入频道时指定的 uid 与生成 Token 时传入的 uid 不一致。
     */
    ARConnectionChangedInvalidToken = 8,
    /**
     9: 当前使用的 Token 过期,不再有效,需要重新在你的服务端申请生成 Token。
     */
    ARConnectionChangedTokenExpired = 9,
    /**
     10: 此用户被服务器禁止。
     */
    ARConnectionChangedRejectedByServer = 10,
    /**
     11: 由于设置了代理服务器,SDK 尝试重连。
     */
    ARConnectionChangedSettingProxyServer = 11,
    /**
     12: 更新 Token 引起网络连接状态改变。
     */
    ARConnectionChangedRenewToken = 12,
    /**
     13: 客户端 IP 地址变更,可能是由于网络类型,或网络运营商的 IP 或端口发生改变引起。
     */
    ARConnectionChangedClientIpAddressChanged = 13,
    /**
     14: SDK 和服务器连接保活超时,进入自动重连状态 ARConnectionStateReconnecting(4).
     */
    ARConnectionChangedKeepAliveTimeout = 14,
};
/** 日志过滤分级 */
typedef NS_ENUM(NSUInteger, ARLogFilter) {
    /**
     不输出日志信息
     */
    ARLogFilterOff = 0,
    /**
     输出所有 API 日志信息。如果你想获取最完整的日志,可以将日志级别设为该等级。
     */
    ARLogFilterDebug = 0x080f,
    /**
     输出 CRITICAL、ERROR、WARNING 和 INFO 级别的日志信息。我们推荐你将日志级别设为该等级。
     */
    ARLogFilterInfo = 0x000f,
    /**
     输出 CRITICAL、ERROR 和 WARNING 级别的日志信息
     */
    ARLogFilterWarning = 0x000e,
    /**
     输出 CRITICAL 和 ERROR 级别的日志信息
     */
    ARLogFilterError = 0x000c,
    /**
     输出 CRITICAL 级别的日志信息
     */
    ARLogFilterCritical = 0x0008,
};
/** 远端用户的需求优先级。如果将某个用户的优先级设为高,那么发给这个用户的音视频流的优先级就会高于其他用户。 */
typedef NS_ENUM(NSInteger, ARUserPriority ) {
    /**
     50:用户需求优先级为高
     */
    ARUserPriorityHigh = 50,
    /**
     100:(默认)用户需求优先级为正常
     */
    ARUserPriorityNormal = 100,
};
/** 音视频流回退处理选项 */
typedef NS_ENUM(NSInteger, ARStreamFallbackOptions ) {
    /**
     0:上行/下行网络较弱时,不对音视频流作回退处理,但不能保证音视频流的质量。
     */
    ARStreamFallbackOptionDisabled = 0,
    /**
     1:在下行网络条件较差的情况下,SDK 将接收视频小流(低分辨率、低码率视频流)。此选项仅适用于 setRemoteSubscribeFallbackOption。
     */
    ARStreamFallbackOptionVideoStreamLow = 1,
    /**
     2:上行网络较弱时,只发布音频流;下行网络较弱时,先尝试只接收视频小流(低分辨率、低码率视频流),如果网络环境无法显示视频,则再回退到只接收音频流。
     */
    ARStreamFallbackOptionAudioOnly = 2,
};
/** 视频的编码类型 */
typedef NS_ENUM(NSInteger, ARVideoCodecType) {
    /**
     1: VP8.
     */
    ARVideoCodecTypeVP8 = 1,
    /**
     2: (默认值)H.264。
     */
    ARVideoCodecTypeH264 = 2,
    /**
     3:  EVP
     */
    ARVideoCodecTypeEVP = 3,
    /**
     4:  E264
     */
    ARVideoCodecTypeE264 = 4,
};
/** 自上次统计后本地视频质量的自适应情况(基于目标帧率和目标码率) */
typedef NS_ENUM(NSInteger, ARVideoQualityAdaptIndication) {
    /**
    0:本地视频质量不变
    */
    ARVideoQualityAdaptNone = 0,
    /**
    1:因网络带宽增加,本地视频质量改善
    */
    ARVideoQualityAdaptUpBandwidth = 1,
    /**
    2:因网络带宽减少,本地视频质量变差
    */
    ARVideoQualityAdaptDownBandwidth = 2,
};
/** 网络质量 */
typedef NS_ENUM(NSUInteger, ARNetworkQuality) {
    /**
     0:网络质量未知
     */
    ARNetworkQualityUnknown = 0,
    /**
     1:网络质量极好
     */
    ARNetworkQualityExcellent = 1,
    /**
     2:用户主观感觉和 excellent 差不多,但码率可能略低于 excellent
     */
    ARNetworkQualityGood = 2,
    /**
     3:用户主观感受有瑕疵但不影响沟通
     */
    ARNetworkQualityPoor = 3,
    /**
     4:勉强能沟通但不顺畅
     */
    ARNetworkQualityBad = 4,
     /**
      5:网络质量非常差,基本不能沟通
      */
    ARNetworkQualityVBad = 5,
     /**
      6:网络连接已断开,完全无法沟通
      */
    ARNetworkQualityDown = 6,
     /**
      7:网络质量探测功能不可使用 (目前没有使用)
      */
    ARNetworkQualityUnsupported = 7,
     /**
      8:网络质量探测中
      */
    ARNetworkQualityDetecting = 8,
};
/** 视频buffer */
typedef NS_ENUM(NSInteger, ARVideoBufferType ) {
    /**
     1:pixelbuffer
     */
    ARVideoBufferTypePixelBuffer = 1,
    /**
     2:rawdata
     */
    ARVideoBufferTypeRawData = 2,
};
/** 音频采集类型 */
typedef NS_ENUM(NSInteger, ARAudioType) {
    /**
     1:音频由App产生
     */
    ARAudioTypeApp = 1,
    /**
     2:音频由麦克风产生
     */
    ARAudioTypeMic = 2,
};
/** 录音音质 */
typedef NS_ENUM(NSInteger, ARAudioRecordingQuality) {
    /**
     低音质。采样率为 32 KHz,录制 10 分钟的文件大小为 1.2 M 左右
     */
    ARAudioRecordingQualityLow = 0,
    /**
     中音质。采样率为 32 KHz,录制 10 分钟的文件大小为 2 M 左右
     */
    ARAudioRecordingQualityMedium = 1,
    /**
     高音质。采样率为 32 KHz,录制 10 分钟的文件大小为 3.75 M 左右
     */
    ARAudioRecordingQualityHigh = 2
};
/** 音频的采样率 */
typedef NS_ENUM(NSInteger, ARAudioSampleRateType) {
    /** 32 kHz. */
    ARAudioSampleRateType32000 = 32000,
    /** 44.1 kHz. */
    ARAudioSampleRateType44100 = 44100,
    /** 48 kHz. */
    ARAudioSampleRateType48000 = 48000,
};
/** 导入的外部视频源状态 */
typedef NS_ENUM(NSUInteger, ARInjectStreamStatus) {
    /** 外部视频流导入成功 */
    ARInjectStreamStatusStartSuccess = 0,
    /** 外部视频流已存在 */
    ARInjectStreamStatusStartAlreadyExists = 1,
    /** 外部视频流导入未经授权 */
    ARInjectStreamStatusStartUnauthorized = 2,
    /** 导入外部视频流超时 */
    ARInjectStreamStatusStartTimedout = 3,
    /** 外部视频流导入失败*/
    ARInjectStreamStatusStartFailed = 4,
    /** 外部视频流停止导入成功 */
    ARInjectStreamStatusStopSuccess = 5,
    /** 未找到要停止导入的外部视频流 */
    ARInjectStreamStatusStopNotFound = 6,
    /** 要停止导入的外部视频流未经授权*/
    ARInjectStreamStatusStopUnauthorized = 7,
    /** 停止导入外部视频流超时 */
    ARInjectStreamStatusStopTimedout = 8,
    /** 停止导入外部视频流失败 */
    ARInjectStreamStatusStopFailed = 9,
    /** 导入的外部视频流被中断*/
    ARInjectStreamStatusBroken = 10,
};
/** 跨频道媒体流转发状态码
 */
typedef NS_ENUM(NSInteger, ARChannelMediaRelayState) {
    /** 0: SDK 正在初始化。
     */
    ARChannelMediaRelayStateIdle = 0,
    /** 1: SDK 尝试跨频道。
     */
    ARChannelMediaRelayStateConnecting = 1,
    /** 2: 源频道主播成功加入目标频道。
     */
    ARChannelMediaRelayStateRunning = 2,
    /** 3: 发生异常,详见 error 中提示的错误信息。
     */
    ARChannelMediaRelayStateFailure = 3,
};
/** 跨频道媒体流转发事件码
 */
typedef NS_ENUM(NSInteger, ARChannelMediaRelayEvent) {
    /** 0: 网络中断导致用户与服务器连接断开。
     */
    ARChannelMediaRelayEventDisconnect = 0,
    /** 1: 用户与服务器建立连接。
     */
    ARChannelMediaRelayEventConnected = 1,
    /** 2: 用户已加入源频道。
     */
    ARChannelMediaRelayEventJoinedSourceChannel = 2,
    /** 3: 用户已加入目标频道。
     */
    ARChannelMediaRelayEventJoinedDestinationChannel = 3,
    /** 4: SDK 开始向目标频道发送数据包。
     */
    ARChannelMediaRelayEventSentToDestinationChannel = 4,
    /** 5: 服务器收到了目标频道发送的视频流。
     */
    ARChannelMediaRelayEventReceivedVideoPacketFromSource = 5,
    /** 6: 服务器收到了目标频道发送的音频流。
     */
    ARChannelMediaRelayEventReceivedAudioPacketFromSource = 6,
    /** 7: 目标频道已更新。
     */
    ARChannelMediaRelayEventUpdateDestinationChannel = 7,
    /** 8: 内部原因导致目标频道更新失败。
     */
    ARChannelMediaRelayEventUpdateDestinationChannelRefused = 8,
    /** 9: 目标频道未发生改变,即目标频道更新失败。
     */
    ARChannelMediaRelayEventUpdateDestinationChannelNotChange = 9,
    /** 10: 目标频道名为 NULL。
     */
    ARChannelMediaRelayEventUpdateDestinationChannelIsNil = 10,
    /** 11: 视频属性已发送至服务器。
     */
    ARChannelMediaRelayEventVideoProfileUpdate = 11,
};
/** 跨频道媒体流转发出错的错误码
 */
typedef NS_ENUM(NSInteger, ARChannelMediaRelayError) {
    /** 0: 一切正常。
     */
    ARChannelMediaRelayErrorNone = 0,
    /** 1: 服务器回应出错。
     */
    ARChannelMediaRelayErrorServerErrorResponse = 1,
    /** 2: 服务器无回应。你可以调用 leaveChannel 方法离开频道。
     */
    ARChannelMediaRelayErrorServerNoResponse = 2,
    /** 3: SDK 无法获取服务,可能是因为服务器资源有限导致。
     */
    ARChannelMediaRelayErrorNoResourceAvailable = 3,
    /** 4: 发起跨频道转发媒体流请求失败。
     */
    ARChannelMediaRelayErrorFailedJoinSourceChannel = 4,
    /** 5: 接受跨频道转发媒体流请求失败。
     */
    ARChannelMediaRelayErrorFailedJoinDestinationChannel = 5,
    /** 6: 服务器接收跨频道转发媒体流失败。
     */
    ARChannelMediaRelayErrorFailedPacketReceivedFromSource = 6,
    /** 7: 服务器发送跨频道转发媒体流失败。
     */
    ARChannelMediaRelayErrorFailedPacketSentToDestination = 7,
    /** 8: SDK 因网络质量不佳与服务器断开。你可以调用 leaveChannel 方法离开当前频道。
     */
    ARChannelMediaRelayErrorServerConnectionLost = 8,
    /** 9: 服务器内部出错。
     */
    ARChannelMediaRelayErrorInternalError = 9,
    /** 10: 源频道的 Token 已过期。
     */
    ARChannelMediaRelayErrorSourceTokenExpired = 10,
    /** 11: 目标频道的 Token 已过期。
     */
    ARChannelMediaRelayErrorDestinationTokenExpired = 11,
};
/** 发布状态 */
typedef NS_ENUM(NSUInteger, ARStreamPublishState) {
    /** 0: 加入频道后的初始发布状态。
     */
    ARStreamPublishIdle = 0,
    /** 1: 发布失败。可能是因为:
     - 本地用户调用 muteLocalAudioStream(YES) 或 muteLocalVideoStream(YES) 停止发送本地媒体流。
     - 本地用户调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
     - 本地用户调用 enableLocalAudio(NO) 或 enableLocalVideo(NO) 关闭本地音频或视频采集。
     - 本地用户角色为观众。
     */
    ARStreamPublishNoPublished = 1,
    /** 2: 正在发布。
     */
    ARStreamPublishPublishing = 2,
    /** 3: 发布成功。
     */
    ARStreamPublishPublished = 3,
};
/** 订阅状态。 */
typedef NS_ENUM(NSUInteger, ARStreamSubscribeState) {
    /** 0: 加入频道后的初始订阅状态。
     */
    ARStreamSubscribeIdle = 0,
    /** 1: 订阅失败。可能是因为:
     - 远端用户:
        - 调用 muteLocalAudioStream(YES) 或 muteLocalVideoStream(YES) 停止发送本地媒体流。
        - 调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
        - 调用 enableLocalAudio(NO) 或 enableLocalVideo(NO) 关闭本地音频或视频采集。
     - 用户角色为观众。
     - 本地用户调用以下方法停止接收远端媒体流:
        - 调用 muteRemoteAudioStream(YES)、muteAllRemoteAudioStreams(YES) 或 setDefaultMuteAllRemoteAudioStreams(YES) 停止接收远端音频流。
        - 调用 muteRemoteVideoStream(YES)、muteAllRemoteVideoStreams(YES) 或 setDefaultMuteAllRemoteVideoStreams(YES) 停止接收远端视频流。
     */
    ARStreamSubscribeNoSubscribed = 1,
    /** 2: 正在订阅。
     */
    ARStreamSubscribeSubscribing = 2,
    /** 3: 收到了远端流,订阅成功。
     */
    ARStreamSubscribeSubscribed = 3,
};
/** 用于旁路直播的输出视频的编解码规格 */
typedef NS_ENUM(NSInteger, ARVideoCodecProfileType) {
    /** 66:Baseline 级别的视频编码规格,一般用于低阶或需要额外容错的应用,比如视频通话、手机视频等。 */
    ARVideoCodecProfileTypeBaseLine = 66,
    /** 77:Main 级别的视频编码规格,一般用于主流消费类电子产品,如 mp4、便携的视频播放器、PSP 和 iPad 等。 */
    ARVideoCodecProfileTypeMain = 77,
    /** 100:(默认)High 级别的视频编码规格,一般用于广播及视频碟片存储,高清电视。 */
    ARVideoCodecProfileTypeHigh = 100
};
/** 音频编码规格 */
typedef NS_ENUM(NSInteger, ARAudioCodecProfileType) {
    /** 0: (默认) LC-AAC 规格,表示基本音频编码规格。 */
    ARAudioCodecProfileLCAAC = 0,
    /** 1: HE-AAC 规格,表示高效音频编码规格。 */
    ARAudioCodecProfileHEAAC = 1
};
/** 推流错误信息 */
typedef NS_ENUM(NSUInteger, ARtmpStreamingErrorCode) {
    /** 推流成功 */
    ARtmpStreamingErrorCodeOK = 0,
    /** 参数无效。请检查输入参数是否正确。例如如果你在调用 addPublishStreamUrl 前没有调用 setLiveTranscoding 设置转码参数,SDK 会返回该错误。 */
    ARtmpStreamingErrorCodeInvalidParameters = 1,
    /** 推流已加密,不能推流。*/
    ARtmpStreamingErrorCodeEncryptedStreamNotAllowed = 2,
    /** 推流超时未成功。可调用 addPublishStreamUrl 重新推流。 */
    ARtmpStreamingErrorCodeConnectionTimeout = 3,
    /** 推流服务器出现错误。请调用 addPublishStreamUrl 重新推流。 */
    ARtmpStreamingErrorCodeInternalServerError = 4,
    /** RTMP 服务器出现错误。 */
    ARtmpStreamingErrorCodeRtmpServerError = 5,
    /** 推流请求过于频繁。*/
    ARtmpStreamingErrorCodeTooOften = 6,
    /** 单个主播的推流地址数目达到上线 10。请删掉一些不用的推流地址再增加推流地址。*/
    ARtmpStreamingErrorCodeReachLimit = 7,
    /** 主播操作不属于自己的流。例如更新其他主播的流参数、停止其他主播的流。请检查 App 逻辑。*/
    ARtmpStreamingErrorCodeNotAuthorized = 8,
    /** 服务器未找到这个流。 */
    ARtmpStreamingErrorCodeStreamNotFound = 9,
    /** 推流地址格式有错误。请检查推流地址格式是否正确。*/
    ARtmpStreamingErrorCodeFormatNotSupported = 10,
};
/** RTMP 推流时发生的事件。*/
typedef NS_ENUM(NSUInteger, ARtmpStreamingEvent) {
    /** RTMP 推流时,添加背景图或水印出错。*/
    ARtmpStreamingEventFailedLoadImage = 1,
};
/** 推流状态 */
typedef NS_ENUM(NSUInteger, ARtmpStreamingState) {
    /** 推流未开始或已结束。成功调用 removePublishStreamUrl 方法删除推流地址后,也会返回该状态。*/
    ARtmpStreamingStateIdle = 0,
    /** 正在连接推流服务器和 RTMP 服务器。调用 addPublishStreamUrl 方法后,会返回该状态。 */
    ARtmpStreamingStateConnecting = 1,
    /** 推流正在进行。成功推流后,会返回该状态*/
    ARtmpStreamingStateRunning = 2,
    /** 正在恢复推流。当 CDN 出现异常,或推流短暂中断时,SDK 会自动尝试恢复推流,并返回该状态。
     - 如成功恢复推流,则进入状态 ARtmpStreamingStateRunning(2)。
     如服务器出错或 60 秒内未成功恢复,则进入状态 ARtmpStreamingStateFailure(4)。如果觉得 60 秒太长,也可以主动调用 removePublishStreamUrl 和 addPublishStreamUrl 方法尝试重连。
     */
    ARtmpStreamingStateRecovering = 3,
    /** 推流失败。失败后,你可以通过返回的错误码排查错误原因,也可以再次调用 addPublishStreamUrl 重新尝试推流。 */
    ARtmpStreamingStateFailure = 4,
};
/** Last mile 质量探测结果的状态 */
typedef NS_ENUM(NSUInteger, ARLastmileProbeResultState) {
    /** 1: 表示本次 last mile 质量探测的结果是完整的 */
    ARLastmileProbeResultComplete = 1,
    /** 2: 表示本次 last mile 质量探测未进行带宽预测,因此结果不完整。一个可能的原因是测试资源暂时受限。*/
    ARLastmileProbeResultIncompleteNoBwe = 2,
    /** 3: 未进行 last mile 质量探测。一个可能的原因是网络连接中断。 */
    ARLastmileProbeResultUnavailable = 3,
};
/** 屏幕共享的内容类型 */
typedef NS_ENUM(NSUInteger, ARVideoContentHint) {
    /** 0:(默认)无指定的内容类型 */
    ARVideoContentHintNone = 0,
    /** 1: 内容类型为动画。当共享的内容是视频、电影或视频游戏时,推荐选择该内容类型。 */
    ARVideoContentHintMotion = 1,
    /** 2: 内容类型为细节。当共享的内容是图片或文字时,推荐选择该内容类型。 */
    ARVideoContentHintDetails = 2,
};
/** 媒体设备类型. */
typedef NS_ENUM(NSInteger, ARMediaDeviceType) {
    /** 未知设备 */
    ARMediaDeviceTypeAudioUnknown = -1,
    /** 音频播放设备 */
    ARMediaDeviceTypeAudioPlayout = 0,
    /** 音频采集设备 */
    ARMediaDeviceTypeAudioRecording = 1,
    /** 视频渲染设备 */
    ARMediaDeviceTypeVideoRender = 2,
    /** 视频采集设备 */
    ARMediaDeviceTypeVideoCapture = 3,
};
/**
推流模式。
 */
typedef NS_ENUM(NSInteger, ARStreamPushMode) {
    /**
     0: 音频
     */
    ARStreamPushModeAudMix = 0,
    /**
     1: 视频。
     */
    ARStreamPushModeVidMix = 1
};
/**
推流状态。
 */
typedef NS_ENUM(NSInteger, ARStreamPushState) {
    /**
     0: 连建立网络连接中
     */
    ARStreamPushStateConnecting = 0,
    /**
     1: 连接失败
     */
    ARStreamPushStateLostConnection = 1,
    /**
     1: 重连中。
     */
    ARStreamPushStateReConnecting = 2,
    /**
     1: 连接失败。
     */
    ARStreamPushStateFailed = 3
};
/**
推流原因。
 */
typedef NS_ENUM(NSInteger, ARStreamPushReason) {
    /**
     0: 推流正常
     */
    ARStreamPushReasonOK = 0,
    /**
     1: 网络原因。
     */
    ARStreamPushReasonNetwork = 1,
    /**
     2: 推流超时
     */
    ARStreamPushReasonTimeout = 2,
    /**
     3: 推流身份
     */
    ARStreamPushReasonAuth = 3
};
/**
用于直播推流的输出视频的编码规格
 */
typedef NS_ENUM(NSInteger, ARStreamVideoCodeProfileType) {
    /**
     66: Baseline 级别的视频编码规格,一般用于低阶或需要额外容错的应用,比如视频通话、手机视频等。
     */
    ARStreamVideoCodeProfileTypeBaseline = 66,
    /**
     77: Main 级别的视频编码规格,一般用于主流消费类电子产品,如 mp4、便携的视频播放器、PSP 和 iPad 等
     */
    ARStreamVideoCodeProfileTypeMain = 77,
    /**
     100(默认): High 级别的视频编码规格,一般用于广播及视频碟片存储,高清电视。
     */
    ARStreamVideoCodeProfileTypehigh = 100
};
/**
音频的采样率
 */
typedef NS_ENUM(NSInteger, ARStreamAudioSampleRateType) {
    /**
     32 kHz
     */
    ARStreamAudioSampleRateType32000 = 32000,
    /**
     44.1 kHz
     */
    ARStreamAudioSampleRateType44100 = 44100,
    /**
     48 kHz
     */
    ARStreamAudioSampleRateType48000 = 48000
};
/**
音频编码规格
 */
typedef NS_ENUM(NSInteger, ARStreamAudioCodecProfileType) {
    /**
     0:LC-AAC 规格,表示基本音频编码规格。
     */
    ARStreamAudioCodecProfileLCAAC = 0,
    /**
     1:HE-AAC 规格,表示高效音频编码规格。
     */
    ARStreamAudioCodecProfileHEAAC = 1
};
/** 加密模式 */
typedef NS_ENUM(NSInteger, AREncryptionMode) {
    /* OpenSSL Encryption Mode Start */
    /** 1: (默认)128 位 AES 加密,XTS 模式。 */
    AREncryptionModeAES128XTS = 1,
    /** 2: 128 位 AES 加密,ECB 模式。 */
    AREncryptionModeAES128ECB = 2,
    /** 3: 256 位 AES 加密,XTS 模式。 */
    AREncryptionModeAES256XTS = 3,
    /* OpenSSL Encryption Mode End */
    /** 4: 128 位 SM4 加密,ECB 模式。*/
    AREncryptionModeSM4128ECB = 4,
    /** 枚举值边界 */
    AREncryptionModeEnd,
};
/** 语音音效均衡波段的中心频率 */
typedef NS_ENUM(NSInteger, ARAudioEqualizationBandFrequency) {
    /** 31 Hz. */
    ARAudioEqualizationBand31 = 0,
    /** 62 Hz. */
    ARAudioEqualizationBand62 = 1,
    /** 125 Hz. */
    ARAudioEqualizationBand125 = 2,
    /** 250 Hz. */
    ARAudioEqualizationBand250 = 3,
    /** 500 Hz */
    ARAudioEqualizationBand500 = 4,
    /** 1 kHz. */
    ARAudioEqualizationBand1K = 5,
    /** 2 kHz. */
    ARAudioEqualizationBand2K = 6,
    /** 4 kHz. */
    ARAudioEqualizationBand4K = 7,
    /** 8 kHz. */
    ARAudioEqualizationBand8K = 8,
    /** 16 kHz. */
    ARAudioEqualizationBand16K = 9,
};
/** 音频混响类型 */
typedef NS_ENUM(NSInteger, ARAudioReverbType) {
    /** 原始音频强度,即所谓的 dry signal,取值范围 [-20,10],单位为 dB */
    ARAudioReverbDryLevel = 0,
    /** 早期反射信号强度,即所谓的 wet signal,取值范围 [-20,10],单位为 dB */
    ARAudioReverbWetLevel = 1,
    /** 所需混响效果的房间尺寸,一般房间越大,混响越强,取值范围 [0,100] */
    ARAudioReverbRoomSize = 2,
    /** wet signal 的初始延迟长度,取值范围 [0,200],单位为 ms*/
    ARAudioReverbWetDelay = 3,
     /** 混响持续的强度,取值范围 [0,100] */
    ARAudioReverbStrength = 4,
};
/** 本地语音变声、美音或语聊美声效果选项 */
typedef NS_ENUM(NSInteger, ARAudioVoiceChanger) {
    /** 原声,即关闭本地语音的变声、美音或语聊美声效果。*/
    ARAudioVoiceChangerOff = 0x00000000,
    /** 变声:老年男性 */
    ARAudioVoiceChangerOldMan = 0x00000001,
    /** 变声:小男孩 */
    ARAudioVoiceChangerBabyBoy = 0x00000002,
    /** 变声:小女孩 */
    ARAudioVoiceChangerBabyGirl = 0x00000003,
    /** 变声:猪八戒 */
    ARAudioVoiceChangerZhuBaJie = 0x00000004,
    /** 变声:空灵 */
    ARAudioVoiceChangerEthereal = 0x00000005,
    /** 变声:绿巨人 */
    ARAudioVoiceChangerHulk = 0x00000006,
    /** 美音:浑厚 */
    ARAudioVoiceBeautyVigorous = 0x00100001,
    /** 美音:低沉 */
    ARAudioVoiceBeautyDeep = 0x00100002,
    /** 美音:圆润 */
    ARAudioVoiceBeautyMellow = 0x00100003,
    /** 美音:假音 */
    ARAudioVoiceBeautyFalsetto = 0x00100004,
    /** 美音:饱满 */
    ARAudioVoiceBeautyFull = 0x00100005,
    /** 美音:清澈 */
    ARAudioVoiceBeautyClear = 0x00100006,
    /** 美音:高亢 */
    ARAudioVoiceBeautyResounding = 0x00100007,
    /** 美音:嘹亮 */
    ARAudioVoiceBeautyRinging = 0x00100008,
    /** 美音:空旷 */
    ARAudioVoiceBeautySpacial = 0x00100009,
    /** 语聊美声:磁性(男)。此枚举为男声定制化效果,不适用于女声。若女声使用此音效设置,则音频可能会产生失真。 */
    ARAudioGeneralBeautyVoiceMaleMagnetic = 0x00200001,
    /** 语聊美声:清新(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。*/
    ARAudioGeneralBeautyVoiceFemaleFresh = 0x00200002,
    /** 语聊美声:活力(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。 */
    ARAudioGeneralBeautyVoiceFemaleVitality = 0x00200003,
};
/** 本地语音混响选项 */
typedef NS_ENUM(NSInteger, ARAudioReverbPreset) {
    /** 原声,即关闭本地语音混响。*/
    ARAudioReverbPresetOff = 0x00000000,
    /** KTV(增强版)  */
    ARAudioReverbPresetFxKTV = 0x00100001,
    /** 演唱会(增强版)*/
    ARAudioReverbPresetFxVocalConcert = 0x00100002,
    /** 大叔 */
    ARAudioReverbPresetFxUncle = 0x00100003,
    /** 小姐姐 */
    ARAudioReverbPresetFxSister = 0x00100004,
    /** 录音棚(增强版) */
    ARAudioReverbPresetFxStudio = 0x00100005,
    /** 流行(增强版) */
    ARAudioReverbPresetFxPopular = 0x00100006,
    /** R&B(增强版) */
    ARAudioReverbPresetFxRNB = 0x00100007,
    /** 留声机 */
    ARAudioReverbPresetFxPhonograph = 0x00100008,
    /** 流行 */
    ARAudioReverbPresetPopular = 0x00000001,
    /** R&B */
    ARAudioReverbPresetRnB = 0x00000002,
    /** 摇滚 */
    ARAudioReverbPresetRock = 0x00000003,
    /** 嘻哈 */
    ARAudioReverbPresetHipHop = 0x00000004,
    /** 演唱会  */
    ARAudioReverbPresetVocalConcert = 0x00000005,
    /** KTV */
    ARAudioReverbPresetKTV = 0x00000006,
    /** 录音棚 */
    ARAudioReverbPresetStudio = 0x00000007,
    /** 虚拟立体声。虚拟立体声是指将单声道的音轨渲染出立体声的效果,使频道内所有用户听到有空间感的声音效果。为达到更好的虚拟立体声效果,AR 推荐在调用该方法前将 setAudioProfile 的 profile 参数设置为 ARAudioProfileMusicHighQualityStereo(5)。*/
    ARAudioReverbPresetVirtualStereo = 0x00200001
};
#endif /* AREnumerates_h */
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARMediaIO.h
New file
@@ -0,0 +1,224 @@
//
//  ARMediaIO.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/6/15.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "AREnumerates.h"
/** 视频像素格式
 关于 YVU 图像格式的描述,请参考:
 FourCC YUV 格式说明
 Recommended 8-Bit YUV Formats for Video Rendering
 */
typedef NS_ENUM(NSUInteger, ARVideoPixelFormat) {
    /** I420 */
    ARVideoPixelFormatI420   = 1,
    /** BGRA */
    ARVideoPixelFormatBGRA   = 2,
    /** NV12 */
    ARVideoPixelFormatNV12   = 8,
};
/** 视频的顺时针旋转角度
如果设置为其他数字,系统会自动忽略
 */
typedef NS_ENUM(NSInteger, ARVideoRotation) {
    /** 顺时针旋转 0 度 */
    ARVideoRotationNone      = 0,
    /** 顺时针旋转 90 度*/
    ARVideoRotation90        = 1,
    /** 顺时针旋转 180 度 */
    ARVideoRotation180       = 2,
    /** 顺时针旋转 270 度 */
    ARVideoRotation270       = 3,
};
/**
 ARVideoFrameConsumer 支持接收两种 Buffer 类型的视频帧数据:PixelBuffer 和裸数据。 自定义视频源时,开发者需要通过 bufferType 来指定一种 Buffer 类型,并在自定义视频源中只使用与其对应的方法来传递视频帧数据。
*/
@protocol ARVideoFrameConsumer <NSObject>
/** PixelBuffer 类型
 @param pixelBuffer PixelBuffer 类型的视频 Buffer
 @param timestamp   传入的视频帧的时间戳,开发者必须为每一个视频帧设置一个时间戳。
 @param rotation    视频的顺时针旋转角度, 详见 ARVideoRotation
 */
- (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
             withTimestamp:(CMTime)timestamp
                  rotation:(ARVideoRotation)rotation;
/** RawData 类型
 @param rawData   RawData 类型的视频 Buffer
 @param timestamp 传入的视频帧的时间戳,以毫秒为单位。
 @param format    ARVideoPixelFormat
 @param size      视频裸数据的尺寸
 @param rotation  视频的顺时针旋转角度, 详见 ARVideoRotation
 */
- (void)consumeRawData:(void * _Nonnull)rawData
         withTimestamp:(CMTime)timestamp
                format:(ARVideoPixelFormat)format
                  size:(CGSize)size
              rotation:(ARVideoRotation)rotation;
@end
/** ARVideoSourceProtocol 协议
 ARVideoSourceProtocol 定义了一套协议,开发者通过实现该接口,来创建自定义的视频源,并设置给 sdk 底层的 Media Engine
 实时通讯过程中,SDK 通常会启动默认的视频输入设备,即内置的摄像头,进行视频推流。 使用 ARVideoSourceProtocol 接口可以自定义视频源。通过调用 设置视频源 setVideoSource 接口,可以改变并控制默认的视频输入设备,再将自定义的视频源发送给 Media Engine,让 Media Engine 进行其它视频处理,如过滤视频、将视频发布到 RTC 链接等。
 */
@protocol ARVideoSourceProtocol <NSObject>
@required
/** ARVideoFrameConsumer 协议,详见 ARVideoFrameConsumer */
@property (strong) id<ARVideoFrameConsumer> _Nullable consumer;
/** 初始化视频源
 Media Engine 在初始化视频源的时候会回调此方法。开发者可以在这个方法中做一些准备工作,例如打开 Camera,或者初始化视频源,并通过返回值告诉 Media Engine,自定义的视频源是否已经准备好。
**Note**
 初始化视频源过程中,开发者需要在 bufferType 中指定一种 Buffer 类型,并在自定义视频源中只使用与其对应的方法来传递视频帧数据。
 在初始化视频源过程中,Media Engine 会传递给开发者的一个 ARVideoFrameConsumer 对象。开发者需要保存该对象,并在视频源启动后,通过这个对象把视频帧输入给 Media Engine。
 开发者需要手动输入 YES 或 NO,以告诉 Media Engine 自定义视频源是否已准备好。
 @return 初始化状态:
 * YES: 自定义的视频源已经完成了初始化工作
 * NO: 自定义的视频源设备没准备好或者初始化失败,Media Engine 会停下来并上报错误
 */
- (BOOL)shouldInitialize;
/** 启动视频源
 Media Engine 在启动视频源时会回调这个方法。开发者可以在该方法中启动视频帧捕捉。开发者需要通过返回值告诉告知 Media Engine 自定义的视频源是否开启成功。
 开发者需要手动输入 YES 或 NO,以告诉 Media Engine 自定义视频源是否开启:
 * YES:自定义的视频源已成功开启,接下来会打开 ARVideoFrameConsumer 的开关,接收开发者传输的视频帧
 * NO:自定义的视频源设备启动失败,Media Engine 会停下来并上报错误
 */
- (void)shouldStart;
/** 停止视频源
 Media Engine 在停止视频源的时候会回调这个方法。开发者可以在这个方法中停止视频的采集。Media Engine 通过这个回调通知开发者,ARVideoFrameConsumer 的帧输入开关即将关闭,之后输入的视频帧都会被丢弃。
 */
- (void)shouldStop;
/** 释放视频源
Media Engine 通知开发者视频源即将失效,开发者可以在这个方法中关闭视频源设备。引擎会销毁 ARVideoFrameConsumer 对象,开发者需要确保在此回调之后不再使用它。
 */
- (void)shouldDispose;
/** 获取 Buffer 类型
 Media Engine 在初始化的时候,会调用这个方法来查询该视频源所使用的 Buffer 类型。开发者必须指定且只能指定一种 Buffer 类型并通过返回值告诉 Media Engine
 @return ARVideoBufferType
 */
- (ARVideoBufferType)bufferType;
@end
/** ARVideoSinkProtocol 协议
 ARVideoSinkProtocol 定义了一套协议,开发者通过实现该接口,来创建自定义的视频渲染器,并设置给底层的 Media Engine。
 实时通讯过程中,SDK 通常会启动默认的视频渲染器进行视频渲染。 ARVideoSinkProtocol 可以自定义视频渲染器,再通过调用 设置本地视频渲染器 setLocalVideoRenderer 和 设置远端视频渲染器 setRemoteVideoRenderer 接口,改变并控制默认的视频渲染器。
 ARVideoSinkProtocol 由以下方法组成:
 - 初始化渲染器(shouldInitialize)
 - 启动渲染器 (shouldStart)
 - 停止渲染器 (shouldStop)
 - 释放渲染器 (shouldDispose)
 - 获取 Buffer 类型 (AgoraVideoBufferType)
 - 获取像素格式 (AgoraVideoPixelFormat)
 - (可选) 输出视频像素 Buffer (renderPixelBuffer)
 - (可选) 输出视频裸数据 (renderRawData)
 Note: ARVideoSinkProtocol 接口中定义的所有方法都是回调方法,Media Engine 内部维护着状态机,并使用这些方法将自定义视频源及渲染器的状态传给 Media Engine。因此请避免直接在 App 中直接调用这些接口。 下面这个例子给出了自定义 video sink 的步骤:
 - 调用 bufferType 和 AgoraVideoPixelFormat 方法设置视频帧的 Buffer 类型和像素格式。
 - 实现 shouldInitialize、shouldStart、shouldStop 和 shouldDispose 管理自定义的 Video Sink。
 - 根据 ARVideoFrameConsumer 实现 buffer 类型和像素格式。
 - 创建 ARVideoFrameConsumer 自定义的 Video Sink 对象。
 - 调用 setLocalVideoRenderer 和 setRemoteVideoRenderer 方法设置本地和远端视频渲染器。
 - Media Engine 会根据内部状态调用 ARVideoSinkProtocol 接口中的方法。
 */
@protocol ARVideoSinkProtocol <NSObject>
@required
/** 初始化渲染器
 Media Engine 初始化渲染器的时候调用这个方法。开发者可以在这个方法中做渲染器的初始化工作。如果是耗时操作,也可以提前初始化好,然后在这个方法中通过返回值告知 Media Engine 自定义渲染器已初始化好。 该方法需要开发者手动输入 YES 或 NO,告知 Media Engine 自定义渲染器的状态。
 @return - YES: Media Engine 会认为自定义的渲染器已经初始化好
 - NO: Media Engine 会认为自定义的渲染器初始化失败,不继续往下运行
 */
- (BOOL)shouldInitialize;
/** 启动渲染器
 Media Engine 在开启渲染功能的时候会回调这个方法。开发者可以在这个方法中启动渲染器。 该方法需要开发者手动输入 YES 或 NO,Media Engine 会根据输入值做对应的动作:
 - YES: Media Engine 继续进行渲染
 - NO:Media Engine 认为出错而停止渲染器的功能
 */
- (void)shouldStart;
/** 停止渲染器
 Media Engine 在停止渲染功能的时候会回调这个方法。开发者可以在这个方法中停止渲染。
 */
- (void)shouldStop;
/** 释放渲染器
 Media Engine 通知开发者渲染器即将被废弃。在 shouldDispose 返回之后,开发者就可以释放掉资源了。
 */
- (void)shouldDispose;
/** 获取 Buffer 类型
 用于在自定义渲染器的时候,需要指定 Buffer 类型,通过返回值告知引擎。Media Engine 会调用这个方法并检查返回值类型。
 @return  Buffer 类型
 */
- (ARVideoBufferType)bufferType;
/** 获取像素格式
 @return 用于自定义渲染器的时候,还需要指定视频数据的像素格式。
 */
- (ARVideoPixelFormat)pixelFormat;
@optional
/** (可选)输出视频的 PixelBuffer
 @param pixelBuffer 视频的 PixelBuffer
 @param rotation   视频像素的顺时针旋转角度, ARVideoRotation
 */
- (void)renderPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(ARVideoRotation)rotation;
/** 输出视频裸数据
 @param rawData RawData 格式的视频
 @param size     视频的尺寸
 @param rotation 视频的顺时针旋转角度, ARVideoRotation
 */
- (void)renderRawData:(void * _Nonnull)rawData size:(CGSize)size rotation:(ARVideoRotation)rotation;
@end
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARMediaPlayerKit.h
New file
@@ -0,0 +1,413 @@
//
//  ARMediaPlayerKit.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/11/2.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <AudioToolbox/AudioToolbox.h>
#import <Foundation/Foundation.h>
#import <VideoToolbox/VideoToolbox.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
typedef UIView View;
#elif TARGET_OS_MAC
#import <AppKit/AppKit.h>
typedef NSView View;
#endif
NS_ASSUME_NONNULL_BEGIN
// external key
/**
 * set analyze duration for real time stream
 * @example "setPlayerOption(kMediaPlayerRealTimeStreamAnalyzeDuration,1000000)"
 */
#define kMediaPlayerRealTimeStreamAnalyzeDuration    @"analyzeduration"
/**
 * 设置播放器禁用播放音频
 * @example  "setPlayerOption(kMediaPlayerDisableAudio,0)"
 */
#define kMediaPlayerDisableAudio                 @"audio_disable"
/**
 * 设置播放器禁用播放视频
 * @example  "setPlayerOption(kMediaPlayerDisableVideo,0)"
 */
#define kMediaPlayerDisableVideo                  @"video_disable"
typedef NS_ENUM(NSInteger, ARMediaPlayerSpeed) {
    /** origin playback speed
     */
    ARMediaPlayerSpeedDefault = 100,
    /** playback speed slow down to 0.75
     */
    ARMediaPlayerSpeed75Percent = 75,
    /** playback speed slow down to 0.5
     */
    ARMediaPlayerSpeed50Percent = 50,
    /** playback speed speed up to 1.25
     */
    ARMediaPlayerSpeed125Percent = 125,
    /** playback speed speed up to 1.5
     */
    ARMediaPlayerSpeed150Percent = 150,
      /** playback speed speed up to 2.0
     */
    ARMediaPlayerSpeed200Percent = 200,
};
/** ARMediaPlayerState,播放器的状态 */
typedef NS_ENUM(NSInteger, ARMediaPlayerState) {
    /** 0: 默认状态 */
    ARMediaPlayerStateIdle = 0,
    /** 1: 正在打开媒体文件 */
    ARMediaPlayerStateOpening = 1,
    /** 2: 成功打开媒体文件 */
    ARMediaPlayerStateOpenCompleted = 2,
    /** 3: 正在播放 */
    ARMediaPlayerStatePlaying = 3,
    /** 4: 暂停播放 */
    ARMediaPlayerStatePaused = 4,
    /** 5: 播放完毕 */
    ARMediaPlayerStatePlayBackCompleted = 5,
    /** 6: 停止播放 */
    ARMediaPlayerStateStopped = 6,
    /** 100: 播放失败 */
    ARMediaPlayerStateFailed = 100,
};
/** ARMediaPlayerError,播放器的错误码 */
typedef NS_ENUM(NSInteger, ARMediaPlayerError) {
    /** 0: 没有错误 */
    ARMediaPlayerErrorNone = 0,
    /** -1: 不正确的参数 */
    ARMediaPlayerErrorInvalidArguments = -1,
    /** -2: 内部错误 */
    ARMediaPlayerErrorInternal = -2,
    /** -3: 没有 resource */
    ARMediaPlayerErrorNoSource = -3,
    /** -4: 无效的 resource */
    ARMediaPlayerErrorInvalidMediaSource = -4,
    /** -5: 未知的媒体流类型 */
    ARMediaPlayerErrorUnknowStreamType = -5,
    /** -6: 对象没有初始化 */
    ARMediaPlayerErrorObjNotInitialized = -6,
    /** -7: 解码器不支持该 codec */
    ARMediaPlayerErrorCodecNotSupported = -7,
    /** -8: 无效的 renderer */
    ARMediaPlayerErrorVideoRenderFailed = -8,
    /** -9: 播放器内部状态错误 */
    ARMediaPlayerErrorInvalidState = -9,
    /** -10: 未找到该 URL */
    ARMediaPlayerErrorUrlNotFound = -10,
    /** -11: 播放器与服务器的连接无效 */
    ARMediaPlayerErrorInvalidConnectState = -11,
    /** -12: 播放缓冲区数据不足 */
    ARMediaPlayerErrorSrcBufferUnderflow = -12,
};
/** ARMediaPlayerEvent,播放器的事件
 */
typedef NS_ENUM(NSInteger, ARMediaPlayerEvent) {
    /** 0: 开始定位 */
    ARMediaPlayerEventSeekBegin = 0,
    /** 1: 完成定位 */
    ARMediaPlayerEventSeekComplete = 1,
    /** 2: 定位出错 */
    ARMediaPlayerEventSeekError = 2,
};
/**
 * ARMediaPlayerMetaDataType, 媒体附属信息数据类型
 */
typedef NS_ENUM(NSUInteger, ARMediaPlayerMetaDataType) {
    /** 0: 未知类型 */
    ARMediaPlayerMetaDataTypeUnknown = 0,
    /** 1: SEI(补充增强信息)类型 */
    ARMediaPlayerMetaDataTypeSEI = 1,
};
/** ARMediaPixelFormat, reporting the pixel format of the video stream. */
typedef NS_ENUM(NSInteger, ARMediaPixelFormat) {
    /** `0`: The format is known.
    */
    ARMediaPixelFormatUnknown = 0,
    /** `1`: The format is I420.
    */
    ARMediaPixelFormatI420 = 1,
    /** `2`: The format is BGRA.
    */
    ARMediaPixelFormatBGRA = 2,
    /** `3`: The format is Planar YUV422.
    */
    ARMediaPixelFormatI422 = 3,
    /** `8`: The format is NV12.
     */
    ARMediaPixelFormatNV12 = 8,
};
/** ARMediaStreamType,媒体流的类型 */
typedef NS_ENUM(NSInteger, ARMediaStreamType) {
    /** 0: 未知类型 */
    ARMediaStreamTypeUnknow = 0,
    /** 1: 视频流 */
    ARMediaStreamTypeVideo = 1,
    /** 2: 音频流 */
    ARMediaStreamTypeAudio = 2,
    /** 3: 字幕流 */
    ARMediaStreamTypeSubtitle = 3,
};
/** ARMediaPlayerRenderMode, 播放器视图的渲染模式 */
typedef NS_ENUM(NSUInteger, ARMediaPlayerRenderMode) {
    /** 1: 视频尺寸等比缩放,优先保证视窗被填满,因视频尺寸与显示视窗尺寸不一致而多出的视频将被截掉。
     */
    ARMediaPlayerRenderModeHidden = 1,
    /** 2: 视频尺寸等比缩放,优先保证视频内容全部显示,因视频尺寸与显示视窗尺寸不一致造成的视窗未被填满的区域填充黑色。
     */
    ARMediaPlayerRenderModeFit = 2,
};
@class ARMediaPlayer;
@class ARMediaStreamInfo;
/** MediaPlayer 会通过代理方法 ARMediaPlayerDelegate 向 App 上报一些运行时的事件。 */
@protocol ARMediaPlayerDelegate <NSObject>
@optional
/** 报告播放器状态改变
 当播放器状态改变时,SDK 会触发该回调,向你报告新的播放状态。
 @param playerKit ARMediaPlayer
 @param state 新的播放状态,详见 ARMediaPlayerState
 @param error 播放器错误码,详见 ARMediaPlayerError
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
       didChangedToState:(ARMediaPlayerState)state
                   error:(ARMediaPlayerError)error;
/** 报告当前播放进度
 播放媒体文件时,SDK 每隔 1 秒会自动触发该回调,向你报告当前播放进度。
 @param playerKit ARMediaPlayer
 @param position 当前播放进度 (秒)
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
    didChangedToPosition:(NSInteger)position;
/** 报告定位播放的结果
 @param playerKit ARMediaPlayer
 @param event 定位播放的结果,详见 ARMediaPlayerEvent
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
          didOccurEvent:(ARMediaPlayerEvent)event;
/** 报告已获取媒体附属信息
 当获取到媒体附属信息时,SDK 会触发该回调,向你报告媒体附属信息的数据类型和具体数据。
 @param playerKit ARMediaPlayer
 @param type 媒体附属信息数据类型,详见 ARMediaPlayerMetaDataType
 @param data 具体数据,用户自定义格式数据
 @param length 数据长度(字节)
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
            metaDataType:(ARMediaPlayerMetaDataType) type
          didReceiveData:(NSString *)data
                  length:(NSInteger)length;
/** 已获取视频帧回调
 每次接收到一帧视频帧时,都会触发该回调,报告视频帧信息。
 @param playerKit ARMediaPlayer
 @param pixelBuffer 视频帧信息
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
    didReceiveVideoFrame:(CVPixelBufferRef)pixelBuffer;
/** 已获取音频帧回调
 每次接收到一帧音频帧时,都会触发该回调,报告音频帧信息。
 @param playerKit ARMediaPlayer
 @param audioFrame 音频帧信息
 */
- (void)rtcMediaPlayer:(ARMediaPlayer *_Nonnull)playerKit
    didReceiveAudioFrame:(CMSampleBufferRef)audioFrame;
@end
/** ARMediaStreamInfo 类,包含媒体流的所有信息
 */
__attribute__((visibility("default"))) @interface ARMediaStreamInfo : NSObject
/** 此条媒体流的索引值 */
@property(nonatomic, assign) NSInteger streamIndex;
/** 此条媒体流的类型,详见 ARMediaStreamType */
@property(nonatomic, assign) ARMediaStreamType streamType;
/** 此条媒体流的编码规格 */
@property(nonatomic, copy) NSString *_Nonnull codecName;
/** 此条媒体流的语言 */
@property(nonatomic, copy) NSString *_Nullable language;
/** 如果此条媒体流是视频流,获取它的视频帧率 (fps) */
@property(nonatomic, assign) NSInteger videoFrameRate;
/** 如果此条媒体流是视频流,获取它的视频码率 (bps) */
@property(nonatomic, assign) NSInteger videoBitRate;
/** 如果此条媒体流是视频流,获取它的视频宽度 (pixel) */
@property(nonatomic, assign) NSInteger videoWidth;
/** 如果此条媒体流是视频流,获取它的视频高度 (pixel) */
@property(nonatomic, assign) NSInteger videoHeight;
/** 如果此条媒体流是音频流,获取它的音频采样率 (Hz) */
@property(nonatomic, assign) NSInteger audioSampleRate;
/** 如果此条媒体流是音频流,获取它的声道数 */
@property(nonatomic, assign) NSInteger audioChannels;
/** 此条媒体流的时长 (秒) */
@property(nonatomic, assign) NSInteger duration;
/** 如果此条媒体流是视频流,获取它的旋转角度 */
@property(nonatomic, assign) NSInteger rotation;
@end
/** 媒体播放器组件 */
__attribute__((visibility("default"))) @interface ARMediaPlayer : NSObject
/** 是否静音:
* YES: 静音
* NO: 不静音
*/
@property(nonatomic, assign) BOOL mute;
/** 本地播放音量。取值范围 0 到 100。 0 为无声,100 为媒体资源的原始音量。 */
@property(nonatomic, assign) NSInteger volume;
/** 播放状态,详见 ARMediaPlayerState*/
@property(nonatomic, readonly) ARMediaPlayerState state;
@property(nonatomic, weak) id<ARMediaPlayerDelegate> _Nullable delegate;
/** 初始化一个 ARMediaPlayer 实例
 @param delegate ARMediaPlayerDelegate
 @return 一个 ARMediaPlayer 实例
 */
- (instancetype)initWithDelegate:(id<ARMediaPlayerDelegate>)delegate;
/** 设置播放器的渲染视图
 @param view 视频渲染视图
 */
- (void)setView:(View *_Nullable)view;
/** 设置播放器视图的渲染模式
 @param mode 播放器视图的渲染模式,详见 ARMediaPlayerRenderMode
 */
- (void)setRenderMode:(ARMediaPlayerRenderMode)mode;
/** 打开媒体文件
 @param url 设置媒体文件的路径,本地路径或网络路径
 @param startPos 设置起始播放位置 (s),默认值为 0
 */
- (void)open:(NSString *)url startPos:(NSInteger)startPos;
/** 播放媒体文件
 打开 (open) 媒体文件或暂停 (pause 播放媒体文件后,你可以调用该方法播放媒体文件。
 */
- (void)play;
/** 暂停播放
 如果你想恢复播放,请调用 play() 方法。
 */
- (void)pause;
/** 停止播放
 */
- (void)stop;
/** 从指定的位置播放媒体文件
 成功调用该方法后,将收到didOccurEvent回调。
 @param position 指定的位置 (s)
 */
- (void)seekToPosition:(NSInteger)position;
/** 设置是否静音
 @param isMute 静音选项:
 * YES: 静音
 * NO: (默认)不静音
 @return 0方法调用成功,<0方法调用失败
 */
- (int)mute:(bool)isMute;
/** 获取当前的静音状态
 @return 方法调用成功,返回:
  - YES: 静音
  - NO: (默认)不静音
 * 方法调用失败,返回 NO
 */
- (bool)getMute;
/** 调节本地播放音量
 @param volume 本地播放音量,取值范围从 0 到 100: - 0: 无声 - 100: (默认)媒体文件的原始播放音量
 @return 0方法调用成功,<0方法调用失败
 */
- (int)adjustVolume:(int)volume;
/** 获取当前播放进度
 @return < 0: 方法调用失败,详见 ARMediaPlayerError
 * 其它:播放进度 (s)
 */
- (NSInteger)getPosition;
/** 获取媒体文件总时长
 @return < 0: 方法调用失败,详见 ARMediaPlayerError
 * 其它:媒体文件总时长 (s)
 */
- (NSInteger)getDuration;
/** 获取播放器当前状态
 @return 方法调用成功,返回播放器当前状态 详见 ARMediaPlayerState
 * 方法调用失败,返回 nil
 */
- (ARMediaPlayerState)getPlayerState;
/** 获取该媒体文件中媒体流的数量
 @return < 0: 方法调用失败,详见 ARMediaPlayerError
 * 其它:该媒体文件中媒体流的数量
 */
- (NSInteger)getStreamCount;
/** 通过此条媒体流的索引值获取媒体流信息
 @param index 媒体流索引值
 @return 方法调用成功,返回媒体流信息,详见 ARMediaStreamInfo
 * 方法调用失败,返回 nil
 */
- (ARMediaStreamInfo *_Nullable)getStreamByIndex:(int)index;
/** 销毁 ARMediaPlayerKit 实例
 调用该方法后,你将无法再使用 Player 提供的其他 API。如果你需要重新使用 Player, 你需要调用 initWithDelegate 方法,重新创建一个 ARMediaPlayerKit 实例。
 */
- (void)destroy;
@end
NS_ASSUME_NONNULL_END
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARObjects.h
New file
@@ -0,0 +1,1095 @@
//
//  ARObjects.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/3/20.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
#import "AREnumerates.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
typedef UIView VIEW_CLASS;
typedef UIColor COLOR_CLASS;
typedef CGSize SIZE_CLASS;
typedef CGPoint POINT_CLASS;
#elif TARGET_OS_MAC
#import <AppKit/AppKit.h>
typedef NSView VIEW_CLASS;
typedef NSColor COLOR_CLASS;
typedef NSSize SIZE_CLASS;
typedef NSPoint POINT_CLASS;
#endif
/** 视频画布对象的属性
*/
__attribute__((visibility("default"))) @interface ARtcVideoCanvas : NSObject
/**
 视频显示视窗
 VIEW_CLASS 为统称,具体为:
 - iOS: UIView
 - MacOS: NSView
 */
@property (strong, nonatomic) VIEW_CLASS* _Nullable view;
/** 视频显示模式*/
@property (assign, nonatomic) ARVideoRenderMode renderMode;
/**
 * 频道id
 * 0 ~ 9
 * a ~ z A ~Z
 * "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ",".
** Note **
 * 该参数默认值为空字符 ""。如果用户是通过 ARtcEngineKit 类的 joinChannelByToken 方法加入频道的,则将参数设为默认值,表示该用户在频道内的渲染视图。
 * 如果用户是通过 ARtcChannel 类的 joinChannelByToken 方法加入频道的,则将该参数设为该 ARtcChannel 类对应的 channelId,表示该用户在该 channelId 对应频道内的渲染视图。
*/
@property (copy, nonatomic) NSString * _Nullable channelId;
/** 用户id */
@property (copy, nonatomic) NSString * _Nonnull uid;
/** 视图镜像模式,详见 ARVideoMirrorMode
 **Note**:
 * 本地视图镜像模式:如果你使用前置摄像头,默认启动本地视图镜像模式;如果你使用后置摄像头,默认关闭本地视图镜像模式。
 * 远端用户视图镜像模式:默认关闭远端用户的镜像模式。
 */
@property (assign, nonatomic) ARVideoMirrorMode mirrorMode;
@end
/** 通话相关的统计信息
*/
__attribute__((visibility("default"))) @interface ARChannelStats : NSObject
/** 通话时长,单位为秒,累计值
 */
@property (assign, nonatomic) NSInteger duration;
/** 音视频总发送字节数 (bytes),累计值
 */
@property (assign, nonatomic) NSInteger txBytes;
/** 音视频总接收字节数 (bytes),累计值
 */
@property (assign, nonatomic) NSInteger rxBytes;
/** 音频发送字节数(bytes),累计值
 */
@property (assign, nonatomic) NSInteger txAudioBytes;
/** 视频发送字节数(bytes),累计值
 */
@property (assign, nonatomic) NSInteger txVideoBytes;
/** 音频接收字节数(bytes),累计值
 */
@property (assign, nonatomic) NSInteger rxAudioBytes;
/** 视频接收字节数(bytes),累计值
 */
@property (assign, nonatomic) NSInteger rxVideoBytes;
/** 音视频总发送码率(Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger txKBitrate;
/** 音视频总接收码率(Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger rxKBitrate;
/** 音频发送码率 (Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger txAudioKBitrate;
/** 音频接收码率 (Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger rxAudioKBitrate;
/** 视频发送码率 (Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger txVideoKBitrate;
/** 视频接收码率 (Kbps),瞬时值
 */
@property (assign, nonatomic) NSInteger rxVideoKBitrate;
/** Last mile 的延迟(ms)
 */
@property (assign, nonatomic) NSInteger lastmileDelay;
/** 使用抗丢包技术前,本地客户端到边缘服务器的丢包率,单位为 %
 */
@property (assign, nonatomic) NSInteger txPacketLossRate;
/** 使用抗丢包技术前,边缘服务器到本地客户端的丢包率,单位为 %
 */
@property (assign, nonatomic) NSInteger rxPacketLossRate;
/** 当前频道内的用户人数
 * 通信场景下,当前频道内的用户人数。
 * 直播场景下,如果本地用户为观众,为频道内的主播人数 + 1;如果本地用户为主播,为频道内的主播人数。
 */
@property (assign, nonatomic) NSInteger userCount;
/** 当前 App 的 CPU 使用率 (%)
 */
@property (assign, nonatomic) double cpuAppUsage;
/** 当前系统的 CPU 使用率 (%)
 */
@property (assign, nonatomic) double cpuTotalUsage;
/** 客户端到本地路由器的往返时延 (ms)
 */
@property (assign, nonatomic) NSInteger gatewayRtt;
/** 当前 App 的内存占比 (%)
**Note**
该值仅作参考。受系统限制可能无法获取。
 */
@property (assign, nonatomic) double memoryAppUsageRatio;
/** 当前系统的内存占比 (%)
**Note**
 该值仅作参考。受系统限制可能无法获取。
 */
@property (assign, nonatomic) double memoryTotalUsageRatio;
/** 当前 App 的内存大小 (KB)
**Note**
 该值仅作参考。受系统限制可能无法获取。
 */
@property (assign, nonatomic) NSInteger memoryAppUsageInKbytes;
@end
/** 视频编码器配置的属性 */
__attribute__((visibility("default"))) @interface ARVideoEncoderConfiguration : NSObject
/** 视频编码的分辨率 (px),用于衡量编码质量,以长x宽表示,默认值为 640 x 480。
 用户可以自行设置分辨率,也可以在如下列表中直接选择想要的分辨率:
 - ARVideoDimension120x120
 - ARVideoDimension160x120
 - ARVideoDimension180x180
 - ARVideoDimension240x180
 - ARVideoDimension320x180
 - ARVideoDimension240x240
 - ARVideoDimension320x240
 - ARVideoDimension424x240
 - ARVideoDimension360x360
 - ARVideoDimension480x360
 - ARVideoDimension640x360
 - ARVideoDimension480x480
 - ARVideoDimension640x480
 - ARVideoDimension840x480
 - ARVideoDimension960x720
 - ARVideoDimension1280x720
 - ARVideoDimension1920x1080 (macOS only)
 - ARVideoDimension2540x1440 (macOS only)
 - ARVideoDimension3840x2160 (macOS only)
**Note**
 * 该值不代表最终视频输出的方向。请查阅 ARVideoOutputOrientationMode 了解设置视频方向
 * 视频能否达到 720P 的分辨率取决于设备的性能,在性能配备较低的设备上有可能无法实现。如果采用 720P 分辨率而设备性能跟不上,则有可能出现帧率过低的情况。
 * iPhone 不支持 720P 以上的分辨率。
 */
@property (assign, nonatomic) CGSize dimensions;
/** 视频编码的帧率(fps)
用户可以自行设置帧率,也可以在如下列表中直接选择想要的帧率。默认值为 15 帧。建议不要超过 30 帧。
 *  ARVideoFrameRateFps1(1): 1 fps
 *  ARVideoFrameRateFps7(7): 7 fps
 *  ARVideoFrameRateFps10(10): 10 fps
 *  ARVideoFrameRateFps15(15): 15 fps
 *  ARVideoFrameRateFps24(24): 24 fps
 *  ARVideoFrameRateFps30(30): 30 fps
 *  ARVideoFrameRateFps60(30): 60 fps (macOS only)
*/
@property (assign, nonatomic) NSInteger frameRate;
/** 最低视频编码帧率(fps)
单位为 fps,默认值为 -1,表示使用系统默认的最低编码帧率。关于该参数的适用场景及注意事项,请参考 设置视频属性(iOS) 或 设置视频属性(macOS)。
*/
@property (assign, nonatomic) NSInteger minFrameRate;
/** 视频编码的码率
 该参数设置视频编码码率,单位为 Kbps。你可以根据场景需要,参考下表,手动设置你想要的码率。若设置的视频码率超出合理范围,SDK 会自动按照合理区间处理码率。你也可以直接选择如下任意一种模式进行设置:
 ARVideoBitrateStandard: (推荐)标准码率模式。该模式下,视频在通信和直播场景下的码率有所不同:通信场景下,码率与基准码率一致;直播场景下,码率对照基准码率翻倍。
 ARVideoBitrateCompatible: 适配码率模式。该模式下,视频在通信和直播场景下的码率均与基准码率一致。直播下如果选择该场景,视频帧率可能会低于设置的值。
 在通信和直播场景下采用不同的编码方式,以提升不同场景下的用户体验。通信场景保证流畅,而直播场景则更注重画面质量,因此直播场景对码率的需求大于通信场景。所以推荐将该参数设置为 ARVideoBitrateStandard。
**视频码率参考表**
| Resolution            | Frame Rate (fps)     | Base Bitrate (Kbps, for Communication)     | Live Bitrate (Kbps, for Live Broadcast)     |
|-------------------    |------------------    |----------------------------------------    |-----------------------------------------    |
| 160 &times; 120       | 15                   | 65                                         | 130                                         |
| 120 &times; 120       | 15                   | 50                                         | 100                                         |
| 320 &times; 180       | 15                   | 140                                        | 280                                         |
| 180 &times; 180       | 15                   | 100                                        | 200                                         |
| 240 &times; 180       | 15                   | 120                                        | 240                                         |
| 320 &times; 240       | 15                   | 200                                        | 400                                         |
| 240 &times; 240       | 15                   | 140                                        | 280                                         |
| 424 &times; 240       | 15                   | 220                                        | 440                                         |
| 640 &times; 360       | 15                   | 400                                        | 800                                         |
| 360 &times; 360       | 15                   | 260                                        | 520                                         |
| 640 &times; 360       | 30                   | 600                                        | 1200                                        |
| 360 &times; 360       | 30                   | 400                                        | 800                                         |
| 480 &times; 360       | 15                   | 320                                        | 640                                         |
| 480 &times; 360       | 30                   | 490                                        | 980                                         |
| 640 &times; 480       | 15                   | 500                                        | 1000                                        |
| 480 &times; 480       | 15                   | 400                                        | 800                                         |
| 640 &times; 480       | 30                   | 750                                        | 1500                                        |
| 480 &times; 480       | 30                   | 600                                        | 1200                                        |
| 848 &times; 480       | 15                   | 610                                        | 1220                                        |
| 848 &times; 480       | 30                   | 930                                        | 1860                                        |
| 640 &times; 480       | 10                   | 400                                        | 800                                         |
| 1280 &times; 720      | 15                   | 1130                                       | 2260                                        |
| 1280 &times; 720      | 30                   | 1710                                       | 3420                                        |
| 960 &times; 720       | 15                   | 910                                        | 1820                                        |
| 960 &times; 720       | 30                   | 1380                                       | 2760                                        |
| 1920 &times; 1080     | 15                   | 2080                                       | 4160                                        |
| 1920 &times; 1080     | 30                   | 3150                                       | 6300                                        |
| 1920 &times; 1080     | 60                   | 4780                                       | 6500                                        |
| 2560 &times; 1440     | 30                   | 4850                                       | 6500                                        |
| 2560 &times; 1440     | 60                   | 6500                                       | 6500                                        |
| 3840 &times; 2160     | 30                   | 6500                                       | 6500                                        |
| 3840 &times; 2160     | 60                   | 6500                                       | 6500                                        |
**Note**
该表中的基准码率适用于通信场景。直播场景下通常需要较大码率来提升视频质量。推荐通过设置 ARVideoBitrateStandard 模式来实现。你也可以直接将码率值设为基准码率值 x 2。
*/
@property (assign, nonatomic) NSInteger bitrate;
/** 最低编码码率
该参数设置最低编码码率,单位为 Kbps。
SDK会根据网络状况自动调整视频编码码率。将参数设为高于默认值可强制视频编码器输出高质量图片,但在网络状况不佳的情况下可能导致网络丢包并影响视频播放的流畅度造成卡顿。因此如非对画质有特殊需求,建议不要修改该参数的值。
**Note**
该参数仅适用于直播场景。
 */
@property (assign, nonatomic) NSInteger minBitrate;
/** 视频编码的方向模式
 * ARVideoOutputOrientationModeAdaptative(0): (默认)该模式下 SDK 输出的视频方向与采集到的视频方向一致。接收端会根据收到的视频旋转信息对视频进行旋转。该模式适用于接收端可以调整视频方向的场景:
   - 如果采集的视频是横屏模式,则输出的视频也是横屏模式。
   - 如果采集的视频是竖屏模式,则输出的视频也是竖屏模式。
 * ARVideoOutputOrientationModeFixedLandscape(1): 该模式下 SDK 固定输出风景(横屏)模式的视频。如果采集到的视频是竖屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
 * ARVideoOutputOrientationModeFixedPortrait(2): 该模式下 SDK 固定输出人像(竖屏)模式的视频,如果采集到的视频是横屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
 */
@property (assign, nonatomic) ARVideoOutputOrientationMode orientationMode;
/** 带宽受限时的视频编码降级偏好
ARDegradationPreference,有如下选项:
 * ARDegradationMaintainQuality(0):(默认)降低编码帧率以保证视频质量
 * ARDegradationMaintainFramerate(1):降低视频质量以保证编码帧率
 * ARDegradationMaintainFramerate(2):(预留参数,暂不支持)在编码帧率和视频质量之间保持平衡。
*/
@property (assign, nonatomic) ARDegradationPreference degradationPreference;
/** 设置本地发送视频的镜像模式
 * 只影响远端用户看到的视频画面。详见 ARVideoMirrorMode
 * 默认关闭镜像模式
 */
@property (assign, nonatomic) ARVideoMirrorMode mirrorMode;
/** 指定视频分辨率并初始化一个 ARVideoEncoderConfiguration 对象
 @param size 视频分辨率
 @param frameRate 视频帧率,详见 ARVideoFrameRate
 @param bitrate 视频码率
 @param orientationMode 视频方向,详见 ARVideoOutputOrientationMode
 @return 初始化的 ARVideoEncoderConfiguration 对象
 */
- (instancetype _Nonnull)initWithSize:(CGSize)size
                            frameRate:(ARVideoFrameRate)frameRate
                              bitrate:(NSInteger)bitrate
                      orientationMode:(ARVideoOutputOrientationMode)orientationMode;
/** 指定视频宽和高并初始化一个 ARVideoEncoderConfiguration 对象
 @param width 视频宽度
 @param height 视频高度
 @param frameRate 视频帧率,详见 ARVideoFrameRate
 @param bitrate 视频码率
 @param orientationMode 视频方向,详见 ARVideoOutputOrientationMode
 @return 初始化的 ARVideoEncoderConfiguration 对象
 */
- (instancetype _Nonnull)initWithWidth:(NSInteger)width
                                height:(NSInteger)height
                             frameRate:(ARVideoFrameRate)frameRate
                               bitrate:(NSInteger)bitrate
                       orientationMode:(ARVideoOutputOrientationMode)orientationMode;
@end
/** 音量信息的属性 */
__attribute__((visibility("default"))) @interface ARtcAudioVolumeInfo : NSObject
/** 说话者的用户 ID。 */
@property (copy, nonatomic) NSString * _Nonnull uid;
/** 说话者各自混音后的音量,取值范围为 [0,255] */
@property (assign, nonatomic) NSUInteger volume;
/** 本地用户的人声状态。
 * 0: 本地用户不在说话。
 * 1: 本地用户在说话。
**Note**
 * vad 无法报告远端用户的人声状态。对于远端用户,vad 的值始终为 0。
 * 若需使用此参数,请在 enableAudioVolumeIndication 方法中设置 report_vad 为 YES。
 */
@property (assign, nonatomic) NSUInteger vad;
/** 频道 ID,表明当前说话者在哪个频道。*/
@property (copy, nonatomic) NSString * _Nonnull channelId;
@end
/** 摄像头采集偏好设置 */
__attribute__((visibility("default"))) @interface ARCameraCapturerConfiguration : NSObject
/** 摄像头采集偏好,详见 ARCameraCaptureOutputPreference
 */
@property (assign, nonatomic) ARCameraCaptureOutputPreference preference;
#if TARGET_OS_IOS
/** 摄像头方向,详见 ARCameraDirection:
 * ARCameraDirectionRear: 使用后置摄像头
 * ARCameraDirectionFront: 使用前置摄像头
 */
@property (assign, nonatomic) ARCameraDirection cameraDirection;
#endif
@end
/** 远端音频统计信息
 */
__attribute__((visibility("default"))) @interface ARtcRemoteAudioStats : NSObject
/** 用户 ID,指定是哪个用户/主播的音频流
 */
@property (copy, nonatomic) NSString * _Nonnull uid;
/** 远端用户发送的音频流质量:
 0:质量未知
 1:质量极好
 2:用户主观感觉和极好差不多 ,但码率可能略低于极好
 3:用户主观感受有瑕疵,但不影响沟通
 4:勉强能沟通但不顺畅
 5:网络质量非常差,基本不能沟通
 6:网络连接已断开,完全无法沟通
 7:网络质量探测功能不可使用 (目前没有使用)
 8:网络质量探测中
 */
@property (assign, nonatomic) ARNetworkQuality quality;
/** 音频发送端到接收端的网络延迟(毫秒)
 */
@property (assign, nonatomic) NSUInteger networkTransportDelay;
/** 接收端到网络抖动缓冲的网络延迟(毫秒)
 */
@property (assign, nonatomic) NSUInteger jitterBufferDelay;
/** 统计周期内的远端音频流的丢帧率(%)
 */
@property (assign, nonatomic) NSUInteger audioLossRate;
/** 声道数
 */
@property (assign, nonatomic) NSUInteger numChannels;
/** 统计周期内接收到的远端音频采样率(Hz)
 */
@property (assign, nonatomic) NSUInteger receivedSampleRate;
/** 接收流在统计周期内的平均码率(Kbps)
 */
@property (assign, nonatomic) NSUInteger receivedBitrate;
/** 远端用户在加入频道后发生音频卡顿的累计时长(ms)
 */
@property (assign, nonatomic) NSUInteger totalFrozenTime;
/** 远端用户在加入频道后发生音频卡顿的累计时长占音频总有效时长的百分比(%)。音频有效时长是指远端用户加入频道后音频未被停止发送或禁用的时长。
 */
@property (assign, nonatomic) NSUInteger frozenRate;
@end
/** 本地视频统计回调
 */
__attribute__((visibility("default"))) @interface ARtcLocalVideoStats : NSObject
/** 实际发送码率 (Kbps) : 不包含丢包后重传视频等的发送码率 */
@property (assign, nonatomic) NSUInteger sentBitrate;
/** 实际发送帧率 (fps) : 不包含丢包后重传视频等的发送帧率 */
@property (assign, nonatomic) NSUInteger sentFrameRate;
/** 本地视频编码器的输出帧率,单位为 fps */
@property (assign, nonatomic) NSUInteger encoderOutputFrameRate;
/** 本地视频渲染器的输出帧率,单位为 fps */
@property (assign, nonatomic) NSUInteger rendererOutputFrameRate;
/** 当前编码器的目标编码码率,单位为 Kbps,该码率为 SDK 根据当前网络状况预估的一个值。*/
@property (assign, nonatomic) NSUInteger sentTargetBitrate;
/** 当前编码器的目标编码帧率,单位为 fps */
@property (assign, nonatomic) NSUInteger sentTargetFrameRate;
/** 统计周期内本地视频质量(基于目标帧率和目标码率)的自适应情况,详见 ARVideoQualityAdaptIndication。 */
@property (assign, nonatomic) ARVideoQualityAdaptIndication qualityAdaptIndication;
/** 视频编码码率(Kbps)。
 */
@property (assign, nonatomic) NSUInteger encodedBitrate;
/** 视频编码宽度(px)。
 */
@property (assign, nonatomic) NSUInteger encodedFrameWidth;
/** 视频编码高度(px)。
 */
@property (assign, nonatomic) NSUInteger encodedFrameHeight;
/** 视频发送的帧数,累计值。
 */
@property (assign, nonatomic) NSUInteger encodedFrameCount;
/** 视频的编码类型:
 * ARVideoCodecTypeVP8 = 1: VP8。
 * ARVideoCodecTypeH264 = 2: (默认值)H.264。
 */
@property (assign, nonatomic) ARVideoCodecType codecType;
/** 弱网对抗前本端到边缘服务器的视频丢包率 (%)。
 */
@property (assign, nonatomic) NSInteger txPacketLossRate;
/** 本地视频采集帧率 (fps)。
 */
@property (assign, nonatomic) NSInteger captureFrameRate;
@end
/** 本地音频统计信息
 */
__attribute__((visibility("default"))) @interface ARtcLocalAudioStats : NSObject
/** 声道数。
 */
@property (assign, nonatomic) NSUInteger numChannels;
/** 发送的采样率,单位为 Hz。
 */
@property (assign, nonatomic) NSUInteger sentSampleRate;
/** 发送码率的平均值,单位为 Kbps。
 */
@property (assign, nonatomic) NSUInteger sentBitrate;
/** 弱网对抗前本端到边缘服务器的音频丢包率 (%)。
 */
@property (assign, nonatomic) NSUInteger txPacketLossRate;
@end
/** 远端视频统计回调。
 */
__attribute__((visibility("default"))) @interface ARtcRemoteVideoStats : NSObject
/** 用户 ID,指定远程视频来自哪个用户
 */
@property (copy, nonatomic) NSString * _Nonnull uid;
/** 延时(毫秒),已废弃(Deprecated)
*/
@property (assign, nonatomic) NSUInteger delay;
/** 视频流宽(像素)
 */
@property (assign, nonatomic) NSUInteger width;
/** 视频流高(像素)
 */
@property (assign, nonatomic) NSUInteger height;
/** 接收流的平均码率(Kbps)
 */
@property (assign, nonatomic) NSUInteger receivedBitrate;
/** 远端视频解码器的输出帧率,单位为 fps
 */
@property (assign, nonatomic) NSUInteger decoderOutputFrameRate;
/** 远端视频渲染器的输出帧率,单位为 fps
 */
@property (assign, nonatomic) NSUInteger rendererOutputFrameRate;
/** 远端视频在使用抗丢包技术之后的丢包率(%)。
 */
@property (assign, nonatomic) NSUInteger packetLossRate;
/** 视频流类型,大流或小流: ARVideoStreamType
 */
@property (assign, nonatomic) ARVideoStreamType rxStreamType;
/** 远端用户在加入频道后发生视频卡顿的累计时长(ms)。通话过程中,视频帧率设置不低于 5 fps 时,连续渲染的两帧视频之间间隔超过 500 ms,则计为一次视频卡顿。
 */
@property (assign, nonatomic) NSUInteger totalFrozenTime;
/** 远端用户在加入频道后发生视频卡顿的累计时长占视频总有效时长的百分比(%)。视频有效时长是指远端用户加入频道后视频未被停止发送或禁用的时长。
 */
@property (assign, nonatomic) NSUInteger frozenRate;
@end
/** 用于封装视频帧数据传递给 SDK 的类
 */
__attribute__((visibility("default"))) @interface ARVideoFrame : NSObject
/** 传入的视频帧的格式
必须指定为下面的某一个值:
 * 1: I420
 * 2: BGRA
 * 3: NV21
 * 4: RGBA
 * 5: IMC2
 * 7: ARGB
 * 8: NV12
 * 12: iOS texture (CVPixelBufferRef)
 * 13: H264 extra data(sps,pps data)
 * 14: H264 nomal data
 * 15: H264 key frame data
 */
@property (assign, nonatomic) NSInteger format;
/** 传入的视频帧的时间戳 (ms).
以毫秒为单位。不正确的时间戳会导致丢帧或者音视频不同步。
 */
@property (assign, nonatomic) CMTime time; // Time for this frame.
/** 传入视频帧的行间距。单位为像素而不是字节。如果视频帧格式设为 12,则不使用该字段。
 */
@property (assign, nonatomic) int strideInPixels;
/** 传入视频帧的高度。单位为像素而不是字节。如果视频帧格式设为 12,则不使用该字段。
 */
@property (assign, nonatomic) int height;
/** iOS 纹理的 Buffer
 */
@property (assign, nonatomic) CVPixelBufferRef _Nullable textureBuf;
/** 裸数据格式的 Buffer。如果视频帧格式设为 12,则不使用该字段。
 */
@property (strong, nonatomic) NSData * _Nullable dataBuf;
/** 视频左边裁减掉的像素数量,默认为 0
 */
@property (assign, nonatomic) int cropLeft;
/** 视频顶部裁减掉的像素数量,默认为 0
 */
@property (assign, nonatomic) int cropTop;
/** 视频右边裁减掉的像素数量,默认为 0
 */
@property (assign, nonatomic) int cropRight;
/** 视频底部裁减掉的像素数量,默认为 0
 */
@property (assign, nonatomic) int cropBottom;
/** 是否对传入的视频做顺时针旋转操作
可选值为 0,90,180,270。默认为 0。
 */
@property (assign, nonatomic) int rotation;
/** 视频缓冲区的长度
 */
@property (assign, nonatomic) int length;
/* Note
 * 1. strideInPixels
 *    Stride is in pixels, not bytes.
 * 2. About the frame width and height.
 *    No field is defined for the width. However, it can be deduced by:
 *       croppedWidth = (strideInPixels - cropLeft - cropRight)
 *    And
 *       croppedHeight = (height - cropTop - cropBottom)
 * 3. About crop.
 *    _________________________________________________________________.....
 *    |                        ^                                      |  ^
 *    |                        |                                      |  |
 *    |                     cropTop                                   |  |
 *    |                        |                                      |  |
 *    |                        v                                      |  |
 *    |                ________________________________               |  |
 *    |                |                              |               |  |
 *    |                |                              |               |  |
 *    |<-- cropLeft -->|          valid region        |<- cropRight ->|
 *    |                |                              |               | height
 *    |                |                              |               |
 *    |                |_____________________________ |               |  |
 *    |                        ^                                      |  |
 *    |                        |                                      |  |
 *    |                     cropBottom                                |  |
 *    |                        |                                      |  |
 *    |                        v                                      |  v
 *    _________________________________________________________________......
 *    |                                                               |
 *    |<---------------- strideInPixels ----------------------------->|
 *
 *    If your buffer contains garbage data, you can crop them. For example, if the frame size is
 *    360 &times; 640, often the buffer stride is 368, that is, the extra 8 pixels on the
 *    right are for padding, and should be removed. In this case, you can set:
 *    strideInPixels = 368;
 *    height = 640;
 *    cropRight = 8;
 *    // cropLeft, cropTop, cropBottom are set to a default of 0
 */
@end
/** 检测到的人脸信息
 */
__attribute__((visibility("default"))) @interface ARFacePositionInfo : NSObject
/** 人脸在画面中的 x 坐标 (px)。以摄像头采集画面的左上角为原点,x 坐标为人脸左上角相对于原点的横向位移。
 */
@property (assign, nonatomic) NSInteger x;
/** 人脸在画面中的 y 坐标 (px)。以摄像头采集画面的左上角为原点,y 坐标为人脸左上角相对原点的纵向位移。
 */
@property (assign, nonatomic) NSInteger y;
/** 人脸在画面中的宽度 (px)。
 */
@property (assign, nonatomic) NSInteger width;
/** 人脸在画面中的高度 (px)。
 */
@property (assign, nonatomic) NSInteger height;
/** 人脸距设备屏幕的距离 (cm)。
 */
@property (assign, nonatomic) NSInteger distance;
@end
/** 频道媒体设置选项
 */
__attribute__((visibility("default"))) @interface ARtcChannelMediaOptions : NSObject
/** 设置加入频道时是否自动订阅音频流:
 - YES: (默认)订阅
 - NO: 不订阅
 该成员功能与 muteAllRemoteAudioStreams 相同。加入频道后,你可以通过 muteAllRemoteAudioStreams 方法重新设置是否订阅频道内的远端音频流。
 */
@property (nonatomic, assign) BOOL autoSubscribeAudio;
/** 设置加入频道是是否自动订阅视频流:
 - YES: (默认)订阅
 - NO: 不订阅
 该成员功能与 muteAllRemoteVideoStreams 相同。加入频道后,你可以通过 muteAllRemoteVideoStreams 方法重新设置是否订阅频道内的远端视频流。
 */
@property (nonatomic, assign) BOOL autoSubscribeVideo;
@end
/** 实况直播注入流配置
 */
__attribute__((visibility("default"))) @interface ARLiveInjectStreamConfig: NSObject
/** 添加进入直播的外部视频源尺寸。
默认值为 0,即保留视频导入前的尺寸
 */
@property (assign, nonatomic) CGSize size;
/** 添加进入直播的外部视频源的 GOP。
默认值为 30 帧
 */
@property (assign, nonatomic) NSInteger videoGop;
/** 添加进入直播的外部视频源的帧率。
默认值为 15 fps
 */
@property (assign, nonatomic) NSInteger videoFramerate;
/** 添加进入直播的外部视频源的码率
默认值为 400 Kbps
视频码率的设置与分辨率相关。如果设置的视频码率超出合理范围,SDK 会按照合理区间自动设置码率。
 */
@property (assign, nonatomic) NSInteger videoBitrate;
/** 添加进入直播的外部音频采样率
默认值为 48000。详见 ARAudioSampleRateType。
**Note:**
建议目前采用默认值,不要自行设置。
 */
@property (assign, nonatomic) ARAudioSampleRateType audioSampleRate;
/** 添加进入直播的外部音频码率
默认值为 48 kbps。
**Note:**
建议目前采用默认值,不要自行设置。
 */
@property (assign, nonatomic) NSInteger audioBitrate;
/** 添加进入直播的外部音频频道数
取值范围 [1,2],默认值为 1。
**Note:**
建议目前采用默认值,不要自行设置。
 */
@property (assign, nonatomic) NSInteger audioChannels;
/** 创建默认实况直播注入流配置
 @return 默认配置
 */
+(ARLiveInjectStreamConfig *_Nonnull) defaultConfig;
@end
/** 目标频道信息
 */
__attribute__((visibility("default"))) @interface ARChannelMediaRelayInfo: NSObject
/** 能加入频道的 Token。
 */
@property (copy, nonatomic) NSString * _Nullable token;
/** 频道名。
 */
@property (copy, nonatomic) NSString * _Nullable channelName;
/** 用户 ID。
 */
@property (copy, nonatomic) NSString * _Nonnull uid;
/** 初始化 ARChannelMediaRelayInfo 类
 @param token 能加入频道的 Token。
 */
- (instancetype _Nonnull)initWithToken:(NSString *_Nullable)token;
@end
/** 跨频道媒体流转发参数配置类
 */
__attribute__((visibility("default"))) @interface ARChannelMediaRelayConfiguration: NSObject
/** 目标频道信息 ARChannelMediaRelayInfo ,包含如下成员:
 - `channelName`: 目标频道的频道名。
 - `uid`: 标识转发流到目标频道的主播 ID。取值范围为 0 到(232-1),请确保与目标频道中的所有 UID 不同。默认值为 0,表示 SDK 随机分配一个 UID。
 - `token`: 能加入目标频道的 token。由你在 destinationInfos 中设置的 channelName 和 uid 生成。
   - 如未启用 App Certificate,可直接将该参数设为默认值 nil,表示 SDK 填充 App ID。
   - 如已启用 App Certificate,则务必填入使用 channelName 和 uid 生成的 token。
 */
@property (strong, nonatomic, readonly) NSDictionary<NSString *, ARChannelMediaRelayInfo *> *_Nullable destinationInfos;
/** 源频道信息 ARChannelMediaRelayInfo ,包含如下成员:
 - `channelName`: 源频道名。默认值为 nil,表示 SDK 填充当前的频道名。
 - `uid`: 标识源频道中想要转发流的主播 ID。默认值为 0,表示 SDK 随机分配一个 uid。请确保设为 0。
 - `token`: 能加入源频道的 token。由你在 sourceInfo 中设置的 channelName 和 uid 生成。
   - 如未启用 App Certificate,可直接将该参数设为默认值 nil,表示 SDK 填充 App ID。
   - 如已启用 App Certificate,则务必填入使用 channelName 和 uid 生成的 token,且其中的 uid 必须为 0。
 */
@property (strong, nonatomic) ARChannelMediaRelayInfo *_Nonnull sourceInfo;
/** 设置目标频道信息。
 @param destinationInfo  目标频道信息 ARChannelMediaRelayInfo ,包含如下成员:
 - `channelName`: 目标频道的频道名。
 - `uid`:标识转发流到目标频道的主播 ID。取值范围为 0 到(232-1),请确保与目标频道中的所有 UID 不同。默认值为 0,表示 SDK 随机分配一个 UID。
 - `token`: 能加入目标频道的 token。由你在 destinationInfo 中设置的 channelName 和 uid 生成。
   - 如未启用 App Certificate,可直接将该参数设为默认值 nil,表示 SDK 填充 App ID。
   - 如已启用 App Certificate,则务必填入使用 channelName 和 uid 生成的 token。
 @param channelName 目标频道名,该参数必填,且需与该方法 destinationInfo 参数中的 channelName 一致。
 @return 0方法调用成功,<0方法调用失败
 */
- (BOOL)setDestinationInfo:(ARChannelMediaRelayInfo *_Nonnull)destinationInfo forChannelName:(NSString *_Nonnull)channelName;
/** 删除目标频道。
 @param channelName 想要删除的目标频道名。
 @return 0方法调用成功,<0方法调用失败
 */
- (BOOL)removeDestinationInfoForChannelName:(NSString *_Nonnull)channelName;
@end
/** 提供旁路推流时特定用户音频/视频转码设置的类
 */
__attribute__((visibility("default"))) @interface ARLiveTranscodingUser: NSObject
/** 旁路推流的用户 ID
 */
@property (copy, nonatomic) NSString *_Nonnull uid;
/** 直播视频上用户视频在布局中相对左上角的位置和大小信息
 */
@property (assign, nonatomic) CGRect rect;
/**  直播视频上用户视频帧的图层编号
 整数,取值范围为 0 到 100:
 - 最小值为 0(默认值),表示该区域图像位于最下层
 - 最大值为 100,表示该区域图像位于最上层
 Note: 如果取值小于 0 或大于 100,会返回错误 ARErrorCodeInvalidArgument。
 */
@property (assign, nonatomic) NSInteger zOrder;
/** 直播视频上用户视频的透明度。取值范围为 [0.0,1.0]。
 * 0.0: 表示该区域图像完全透明
 * 1.0: 表示该区域图像完全不透明。默认值为 1.0.
 */
@property (assign, nonatomic) double alpha;
/** 直播音频所在声道
 取值范围为 [0,5],默认值为 0 :
  - 0:(推荐) 默认混音设置,最多支持双声道,与主播端上行音频相关
  - 1: 对应主播的音频,推流中位于 FL 声道。如果主播端上行音频是多声道,会先把多声道混音成单声道。
  - 2: 对应主播的音频,推流中位于 FC 声道。如果主播端上行音频是多声道,会先把多声道混音成单声道。
  - 3: 对应主播的音频,推流中位于 FR 声道。如果主播端上行音频是多声道,会先把多声道混音成单声道。
  - 4: 对应主播的音频,推流中位于 BL 声道。如果主播端上行音频是多声道,会先把多声道混音成单声道。
  - 5: 对应主播的音频,推流中位于 BR 声道。如果主播端上行音频是多声道,会先把多声道混音成单声道。
Note: 选项不为 0 时,需要特殊的播放器支持。
 */
@property (assign, nonatomic) NSInteger audioChannel;
@end
/** 图像属性
 用于设置直播视频的水印和背景图片的属性
 */
__attribute__((visibility("default"))) @interface ARImage: NSObject
/** 直播视频上图片的 HTTP/HTTPS 地址,字符长度不得超过 1024 字节。
 */
@property (strong, nonatomic) NSURL *_Nonnull url;
/** 图片在视频帧上的位置和大小,类型为 CGRect
 */
@property (assign, nonatomic) CGRect rect;
@end
/** 管理旁路推流转码的类
 */
__attribute__((visibility("default"))) @interface ARLiveTranscoding: NSObject
/** 推流视频的总尺寸(宽和高),单位为像素。
- 如果推视频流,宽和高的值均不得低于 64,否则 SDK 会调整为 64。
- 如果推音频流,请将宽和高都设为 0。
 */
@property (assign, nonatomic) CGSize size;
/** 用于旁路直播的输出视频的码率。单位为 Kbps。400 Kbps 为默认值。
用于旁路直播的输出视频的码率。单位为 Kbps。400 Kbps 为默认值。
你可以根据 Video Profile 参考表中的码率值进行设置;如果设置的码率超出合理范围,服务器会在合理区间内自动调整码率值。
 */
@property (assign, nonatomic) NSInteger videoBitrate;
/** 用于旁路直播的输出视频的帧率。取值范围是 (0,30],单位为 fps。
@note 15 fps 为默认值。服务器会将高于 30 fps 的帧率设置改为 30 fps。
 */
@property (assign, nonatomic) NSInteger videoFramerate;
/** 用于旁路直播的输出视频的 GOP。单位为帧。默认值为 30 帧。*/
@property (assign, nonatomic) NSInteger videoGop;
/** 用于旁路直播的输出视频的编码规格。
 可以设置为 66、77 或 100,详见 ARVideoCodecProfileType。
 如果设置其它值,服务器会统一设为默认值 100。
 */
@property (assign, nonatomic) ARVideoCodecProfileType videoCodecProfile;
/** 用于管理参与旁路直播的视频转码合图的用户。最多支持 17 人同时参与转码合图,详见 ARLiveTranscodingUser
 */
@property (copy, nonatomic) NSArray<ARLiveTranscodingUser *> *_Nullable transcodingUsers;
/** 预留参数:用户自定义的发送到旁路推流客户端的信息,用于填充 H264/H265 视频中 SEI 帧内容。长度限制:4096 字节。关于 SEI 的详细信息,详见SEI 帧相关问题。
 */
@property (copy, nonatomic) NSString *_Nullable transcodingExtraInfo;
/** 用于旁路直播的输出视频上的水印图片
 仅支持 PNG 格式的图片。添加后所有旁路直播的观众都可以看到水印。水印图片的定义详见 ARImage
 */
@property (strong, nonatomic) ARImage *_Nullable watermark;
/** 用于旁路直播的输出视频上的背景图片
添加后所有旁路直播的观众都可以看到背景图片。背景图片的定义详见 ARImage
 */
@property (strong, nonatomic) ARImage *_Nullable backgroundImage;
/** 用于旁路直播的输出视频的背景色
 格式为 RGB 定义下的十六进制整数,不要带 # 号,如 0xFFB6C1 表示浅粉色。默认 0x000000,黑色。
 COLOR_CLASS 为类型统称,具体为:
* iOS: UIColor
* macOS: NSColor
 */
@property (strong, nonatomic) COLOR_CLASS *_Nullable backgroundColor;
/** 用于旁路直播的输出音频的采样率,详见 ARAudioSampleRateType
 */
@property (assign, nonatomic) ARAudioSampleRateType audioSampleRate;
/** 用于旁路直播的输出音频的码率。单位为 Kbps,默认值为 48,最大值为 128
 */
@property (assign, nonatomic) NSInteger audioBitrate;
/** 用于旁路直播的输出音频的声道数,默认值为 1。
 取值范围为 [1,5] 中的整型,建议取 1 或 2。3、4、5需要特殊播放器支持:
 * 1: 单声道
 * 2: 双声道
 * 3: 三声道
 * 4: 四声道
 * 5: 五声道
 */
@property (assign, nonatomic) NSInteger audioChannels;
/**
 用于旁路直播输出音频的编码规格,默认值为 ARAudioCodecProfileLCAAC(0)。详见 ARAudioCodecProfileType。
 */
@property (assign, nonatomic) ARAudioCodecProfileType audioCodecProfile;
/** 应用默认的转码设置
 @return 应用默认设置的 ARLiveTranscoding 对象
 */
+(ARLiveTranscoding *_Nonnull) defaultTranscoding;
/** 添加一个用户到已有的用户中。
 @param user 参数合图的用户,定义详见 ARLiveTranscodingUser 。
 @return 0: 方法调用成功,< 0: 方法调用失败。
 */
-(int)addUser:(ARLiveTranscodingUser * _Nonnull)user;
/** 删除转码合图用户
 @param uid 待删除的用户 ID
 @return 0: 方法调用成功,< 0: 方法调用失败。
 */
-(int)removeUser:(NSString *_Nonnull)uid;
@end
/** Last mile 网络探测配置 */
__attribute__((visibility("default"))) @interface ARLastmileProbeConfig : NSObject
/** 是否探测上行网络带宽。有些用户不需要进行网络探测,如直播频道中的普通观众。
- NO:不探测
- YES:探测
*/
@property (assign, nonatomic) BOOL probeUplink;
/** 是否探测下行网络带宽
- NO:不探测
- YES:探测
*/
@property (assign, nonatomic) BOOL probeDownlink;
/** 用户期望的最高发送码率
 单位为 bps,范围为 [100000,5000000]。anyRTC 推荐参考 setVideoEncoderConfiguration 中的码率值设置该参数的值。 */
@property (assign, nonatomic) NSUInteger expectedUplinkBitrate;
/** 用户期望的最高接收码率
 单位为 bps,范围为 [100000,5000000]。
*/
@property (assign, nonatomic) NSUInteger expectedDownlinkBitrate;
@end
/** 单向网络质量探测结果 */
__attribute__((visibility("default"))) @interface ARLastmileProbeOneWayResult : NSObject
/** 网络丢包率,范围 [0,100]。 */
@property (assign, nonatomic) NSUInteger packetLossRate;
/** 网络抖动,单位为毫秒。*/
@property (assign, nonatomic) NSUInteger jitter;
/** 可用网络带宽预估,单位为 Kbps。*/
@property (assign, nonatomic) NSUInteger availableBandwidth;
@end
/** 上下行 last mile 质量探测结果 */
__attribute__((visibility("default"))) @interface ARLastmileProbeResult : NSObject
/* Last mile 质量探测结果的状态
*/
@property (assign, nonatomic) ARLastmileProbeResultState state;
/** 往返时延,单位为毫秒 */
@property (assign, nonatomic) NSUInteger rtt;
/** 上行网络质量报告
 包含丢包率、网络抖动和可用带宽预估,详见 ARLastmileProbeOneWayResult。
*/
@property (strong, nonatomic) ARLastmileProbeOneWayResult *_Nonnull uplinkReport;
/** 下行网络质量报告
 包含丢包率、网络抖动和可用带宽预估,详见 ARLastmileProbeOneWayResult。
*/
@property (strong, nonatomic) ARLastmileProbeOneWayResult *_Nonnull downlinkReport;
@end
/** 设置屏幕共享编码配置的类
 */
__attribute__((visibility("default"))) @interface ARScreenCaptureParameters: NSObject
/**  屏幕共享视频发送的最大像素值
 默认值为 1920 * 1080,即 2073600 像素。该像素值为计费标准。
 当共享的屏幕分辨率宽高比与该值设置不一致时,SDK 按如下策略进行编码。假设 dimensions 为 1920 * 1080:
 - 如果屏幕分辨率小于 dimensions,如 1000 * 1000,SDK 直接按 1000 * 1000 进行编码。
 - 如果屏幕分辨率大于 dimensions,如 2000 * 1500,SDK 按屏幕分辨率的宽高比,即 4:3,取 dimensions 以内的最大分辨率进行编码,即 1440 * 1080。
 无论实际编码分辨率如何,均按 dimensions 设置的值计费。
 */
@property (assign, nonatomic) CGSize dimensions;
/** 共享视频的帧率,单位为 fps;默认值为 5,建议不要超过 15。
 */
@property (assign, nonatomic) NSInteger frameRate;
/** 共享视频的码率,单位为 Kbps;默认值为 0,表示由 SDK 根据当前共享的分辨率计算出一个合理的值。
 */
@property (assign, nonatomic) NSInteger bitrate;
/** 是否采集鼠标用于屏幕共享
- YES:(默认)采集鼠标
- NO:不采集鼠标
 */
@property (assign, nonatomic) BOOL captureMouseCursor;
/** 调用 startScreenCaptureByWindowId 方法共享窗口时,是否将该窗口前置。
 - YES:前置窗口。
 - NO: (默认)不前置窗口。
 */
@property (assign, nonatomic) BOOL windowFocus;
/** 待屏蔽窗口的 ID 列表。
 调用 startScreenCaptureByDisplayId 开启主屏幕共享 (即屏幕 ID 为 0)时,你可以通过该参数屏蔽指定的窗口。开启主屏幕共享后,你可以在调用 updateScreenCaptureParameters 更新屏幕共享的配置参数时,通过该参数动态屏蔽指定的窗口。
 */
@property (copy, nonatomic) NSArray * _Nullable excludeWindowList;
@end
#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
/** 提供设备信息的类
 */
__attribute__((visibility("default"))) @interface ARtcDeviceInfo : NSObject
/** 设备类型,详见 ARMediaDeviceType
 */
@property (assign, nonatomic) ARMediaDeviceType type;
/** 设备 ID
 */
@property (copy, nonatomic) NSString * _Nullable deviceId;
/** 设备名称
 */
@property (copy, nonatomic) NSString * _Nullable deviceName;
@end
#endif
/** 配置内置加密模式和密钥
 */
__attribute__((visibility("default"))) @interface AREncryptionConfig: NSObject
 /** 内置加密模式,默认为 AREncryptionModeAES128XTS 加密模式。详见 AREncryptionMode 。
  */
 @property (assign, nonatomic) AREncryptionMode encryptionMode;
 /** 内置加密密钥,字符串类型。
 **Note**
 如果未指定该参数或将该参数设置为空,则无法启用内置加密,且 SDK 会返回错误码 -2 (ARErrorCodeInvalidArgument)。
  */
 @property (copy, nonatomic) NSString * _Nullable encryptionKey;
 @end
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARStreamingKit.h
New file
@@ -0,0 +1,64 @@
//
//  ARStreamingKit.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/12/24.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ARtcEngineKit.h"
NS_ASSUME_NONNULL_BEGIN
@interface ARStreamingKit : NSObject
/**
设置RtcEngine对象。
@param rtcKit  一个 ARtcEngineKit 实例对象。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setRtcEngine:(ARtcEngineKit *)rtcKit;
/**
开始推Rtmp的流
@param url  rtmp流地址
@return 0方法调用成功,<0方法调用失败
*/
- (int)pushStream:(NSString *_Nonnull)url;
/**
停止推Rtmp的流
@return 0方法调用成功,<0方法调用失败
*/
- (int)unPushStream;
/**
设置推流模式。
@param mode  推流模式,详见ARStreamPushMode。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setMode:(ARStreamPushMode)mode;
/**
设置合流参数
@param transcoding  合流参数,详见ARLiveTranscoding。
*/
- (int)setLiveTranscoding:(ARLiveTranscoding *_Nonnull)transcoding;
/**
 销毁 ARStreamingKit 实例
*/
- (void)destroy;
@end
NS_ASSUME_NONNULL_END
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcChannel.h
New file
@@ -0,0 +1,256 @@
//
//  ARtcChannel.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/3/24.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ARtcEngineKit.h"
#import "ARObjects.h"
#import "ARtcChannelDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface ARtcEngineKit()
/** 实例化ARtcChannel对象
@param channelId   当前 ARtcChannel 对象的频道 ID
*/
- (ARtcChannel * _Nullable)createRtcChannel:(NSString * _Nonnull)channelId;
@end
@interface ARtcChannel : NSObject
/** 销毁 ARtcChannel 对象
@return channelId   当前 ARtcChannel 对象的频道 ID
*/
- (int)destroy;
/** 设置 ARtcChannel 对象的 Delegate
@param channelDelegate   ARtcChannelDelegate
*/
- (void)setRtcChannelDelegate:(id<ARtcChannelDelegate> _Nullable)channelDelegate;
/** 获取当前 ARtcChannel 对象的频道 ID
@return channelId   当前 ARtcChannel 对象的频道 ID
*/
- (NSString * _Nullable)getChannelId;
/** 通过用户 ID 加入频道
@param token   动态密钥
@param uid   用户 ID
@param options   频道媒体设置选项 ARtcChannelMediaOptions
@return 0方法调用成功,<0方法调用失败
*/
- (int)joinChannelByToken:(NSString * _Nullable)token
                      uid:(NSString * _Nullable)uid
                  options:(ARtcChannelMediaOptions * _Nonnull)options;
/** 离开频道
@return 0方法调用成功,<0方法调用失败
*/
- (int)leaveChannel;
/** 将本地音视频流发布到本频道
@return 0方法调用成功,<0方法调用失败
*/
- (int)publish;
/** 停止将本地音视频流发布到本频道
@return 0方法调用成功,<0方法调用失败
*/
- (int)unpublish;
/** 设置用户角色
该方法仅适用于直播场景。
在加入频道前,用户需要通过本方法设置观众(默认)或主播角色。在直播场景中,只有角色为主播时可调用 publish 方法。
如果你在加入频道后调用该方法切换用户角色,调用成功后会触发以下回调:
- 本地:didClientRoleChanged 回调。
- 远端:didJoinedOfUid 或 didOfflineOfUid 回调。
@param role 直播场景里的用户角色
- ARClientRoleBroadcaster(1): 直播频道中的主播,可以发布和接收音视频流。
- ARClientRoleAudience(2): (默认)直播频道中的观众,只可以接收音视频流。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setClientRole:(ARClientRole)role;
/** 更新 Token
该方法用于更新 Token。如果启用了 Token 机制,过一段时间后使用的 Token 会失效。当以下任意一种情况发生时:
- SDK 触发 tokenPrivilegeWillExpire 回调。
- connectionChangedToState 回调 reason 参数报告 ARConnectionChangedTokenExpired(9)。
App 应重新获取 Token,然后调用该 API 更新 Token,否则 SDK 无法和服务器建立连接。
**Note**
推荐使用 rtcChannelRequestToken 回调报告 ARErrorCodeTokenExpired(-109),而不是 didOccurError 回调.
@param token The new token.
@return 0方法调用成功,<0方法调用失败
*/
- (int)renewToken:(NSString *_Nonnull)token;
/** 更新远端视图显示模式
初始化远端用户视图后,你可以调用该方法更新远端用户视图在本地显示时的渲染和镜像模式。该方法只影响本地用户看到的视频画面。
**Note**
 * 请在调用 setupRemoteVideo 方法初始化远端视图后,调用该方法。
 * 你可以在通话中多次调用该方法,多次更新远端用户视图的显示模式。
@param uid   用户 ID
@param renderMode   远端用户视图的渲染模式,详见 ARVideoRenderMode ;
@param mirrorMode   远端用户视图的镜像模式,详见 ARVideoMirrorMode 。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setRemoteRenderMode:(NSString *_Nonnull)uid renderMode:(ARVideoRenderMode)renderMode mirrorMode:(ARVideoMirrorMode)mirrorMode;
/** 设置是否默认接收音频流
该方法在加入频道前后都可调用。如果在加入频道后调用 setDefaultMuteAllRemoteAudioStreams (YES),会接收不到设置后加入频道的用户的音频流。
**Note**
 停止接收音频流后,如果想要恢复接收,请调用 muteRemoteAudioStream (NO),并指定你想要接收的远端用户 uid;如果想恢复接收多个用户的音频流,则需要多次调用 muteRemoteAudioStream。setDefaultMuteAllRemoteAudioStreams (NO) 只能恢复接收后面加入频道的用户的音频流。
 @param mute 设置是否默认接收音频流:
 * YES: 默认停止接收所有远端音频流
 * NO: 默认继续接收所有远端音频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDefaultMuteAllRemoteAudioStreams:(BOOL)mute;
/** 设置是否默认接收视频流
  该方法在加入频道前后都可调用。如果在加入频道后调用setDefaultMuteAllRemoteVideoStreams(YES),会接收不到设置后加入频道的用户的视频流。
  **Note**
 停止接收视频流后,如果想要恢复接收,请调用 muteRemoteVideoStream (NO),并指定你想要接收的远端用户 uid;如果想恢复接收多个用户的视频流,则需要多次调用 muteRemoteVideoStream。setDefaultMuteAllRemoteVideoStreams (NO) 只能恢复接收后面加入频道的用户的视频流。
 @param mute 是否默认接收视频流
 * YES: 不接收
 * NO: 接收
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDefaultMuteAllRemoteVideoStreams:(BOOL)mute;
/** 停止/恢复接收指定用户的音频流
**Note**
 如果之前有调用过 muteAllRemoteAudioStreams(YES) 对所有远端音频进行静音,在调用本 API 之前请确保你已调用 muteAllRemoteAudioStreams(NO)。 muteAllRemoteAudioStreams 是全局控制,muteRemoteAudioStream 是精细控制。
 @param uid  指定用户的用户 ID
 @param mute 停止/恢复接收指定用户的音频流:
 * YES: 停止接收指定音频流
 * NO: 继续接收指定音频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteRemoteAudioStream:(NSString *_Nonnull)uid mute:(BOOL)mute;
/** 调节本地播放的指定远端用户音量
加入频道后,你可以多次调用该方法调节不同远端用户在本地播放的音量,或对某个远端用户在本地播放的音量调节多次。
**Note**
- 该方法要在加入频道后调用。
- 该方法调节的是本地播放的指定远端用户混音后的音量。
- 该方法每次只能调整一位远端用户在本地播放的音量。若需调整多位远端用户在本地播放的音量,则需多次调用该方法。
@param uid 远端用户 ID,需和远端用户加入频道时用的 uid 一致。
@param volume 播放音量,取值范围为 [0,100]。
- 0: 静音
- 100: 原始音量
@return 0方法调用成功,<0方法调用失败
*/
- (int)adjustUserPlaybackSignalVolume:(NSString *_Nonnull)uid volume:(int)volume;
/** 停止/恢复接收所有远端音频流
@param mute YES: 停止接收所有远端音频流;NO: 继续接收所有远端音频流(默认)。
@return 0方法调用成功,<0方法调用失败
*/
- (int)muteAllRemoteAudioStreams:(BOOL)mute;
/** 停止/恢复接收指定视频流
**Note**
 如果之前有调用过 muteAllRemoteVideoStreams(YES) 暂停接收所有远端视频,在调用本 API 之前请确保你已调用 muteAllRemoteVideoStreams(NO)。 muteAllRemoteVideoStreams 是全局控制,muteRemoteVideoStream 是精细控制。
 @param uid  远端用户ID
 @param mute 停止/恢复接收指定视频流:
 * YES: 停止接收指定用户的视频流
 * NO: 允许接收指定用户的视频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteRemoteVideoStream:(NSString *_Nonnull)uid mute:(BOOL)mute;
/** 停止/恢复接收所有视频流
 @param mute 禁止/允许接收所有人的视频流
 * YES: 停止接收所有视频流
 * NO: 允许接收所有视频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteAllRemoteVideoStreams:(BOOL)mute;
/** 设置订阅的视频流类型
 如果发送端选择发送视频双流(大流或小流),接收端可以选择接收大流还是小流。其中大流可以理解为高分辨率高码率的视频流,小流则是低分辨率低码率的视频流。该方法可以根据视频窗口的大小动态调整对应视频流的大小,以节约带宽和计算资源。
@param uid   用户 ID
@param streamType   设置视频流大小,详见ARVideoStreamType
@return 0方法调用成功,<0方法调用失败
*/
- (int)setRemoteVideoStream:(NSString *_Nonnull)uid type:(ARVideoStreamType)streamType;
/** 设置默认订阅的视频流类型
 @param streamType 设置默认接收的视频流类型,详见 ARVideoStreamType 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setRemoteDefaultVideoStreamType:(ARVideoStreamType)streamType;
@end
NS_ASSUME_NONNULL_END
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcChannelDelegate.h
New file
@@ -0,0 +1,216 @@
//
//  ARtcChannelDelegate.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/3/24.
//  Copyright © 2020 zjq. All rights reserved.
//
#ifndef ARtcChannelDelegate_h
#define ARtcChannelDelegate_h
@protocol ARtcChannelDelegate <NSObject>
@optional
/** 发生警告回调
@param rtcChannel   ARtcChannel 类。
@param warningCode   ARWarningCode
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel didOccurWarning:(ARWarningCode)warningCode;
/** 发生错误回调
@param rtcChannel   ARtcChannel 类。
@param errorCode   ARErrorCode
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel didOccurError:(ARErrorCode)errorCode;
/** 加入频道回调
@param rtcChannel   ARtcChannel 类。
@param uid   用户ID
@param elapsed   从调用joinChannelByToken开始到发生此事件过去的时间(ms)。
*/
- (void)rtcChannelDidJoinChannel:(ARtcChannel *_Nonnull)rtcChannel withUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 重新加入频道回调
@param rtcChannel   ARtcChannel 类。
@param uid   用户ID
@param elapsed   从开始重连到重连成功的时间(ms)。
*/
- (void)rtcChannelDidRejoinChannel:(ARtcChannel *_Nonnull)rtcChannel withUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 已离开频道回调
当用户调用 leaveChannel 离开频道后,SDK 会触发该回调。在该回调方法中,App 可以得到此次通话的总通话时长、SDK 收发数据的流量等信息。
@param rtcChannel  ARtcChannel 类。
@param stats   通话相关的统计信息:ARChannelStats
*/
- (void)rtcChannelDidLeaveChannel:(ARtcChannel *_Nonnull)rtcChannel withStats:(ARChannelStats *_Nonnull)stats;
/** 用户角色已切换回调
直播场景下,当本地用户在加入频道后调用 setClientRole 切换角色时会触发此回调,即主播切换为观众时,或观众切换为主播时。
@param rtcChannel ARtcChannel 类。
@param oldRole   切换前的角色
@param newRole   切换后的角色
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel didClientRoleChanged:(ARClientRole)oldRole newRole:(ARClientRole)newRole;
/** 远端用户/主播加入回调
@param rtcChannel ARtcChannel 类。
@param uid   新加入频道的远端用户/主播 ID。如果 joinChannelByToken 中指定了 uid,则此处返回该 ID;否则使用ar云平台服务器自动分配的 ID。
@param elapsed   从本地用户加入频道 joinChannelByToken开始到发生此事件过去的时间(ms)。
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel didJoinedOfUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 远端用户(通信场景)/主播(直播场景)离开当前频道回调
@param rtcChannel ARtcChannel 类。
@param uid   离线的用户 ID。
@param reason   离线原因,详见 ARUserOfflineReason。
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel didOfflineOfUid:(NSString *_Nonnull)uid reason:(ARUserOfflineReason)reason;
/** 网络连接状态已改变回调
该回调在网络连接状态发生改变的时候触发,并告知用户当前的网络连接状态,和引起网络状态改变的原因。
@param rtcChannel ARtcChannel 类。
@param state 当前的网络连接状态,详见 ARConnectionStateType。
@param reason 引起网络连接状态发生改变的原因,详见 ARConnectionChangedReason。
*/
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel connectionChangedToState:(ARConnectionStateType)state reason:(ARConnectionChangedReason)reason;
/** 网络连接中断,且 SDK 无法在 10 秒内连接服务器回调
SDK 在调用 joinChannelByToken 后无论是否加入成功,只要 10 秒和服务器无法连接就会触发该回调。
如果 SDK 在断开连接后,20 分钟内还是没能重新加入频道,SDK 会停止尝试重连。
@param rtcChannel ARtcChannel 类。
 */
- (void)rtcChannelDidLost:(ARtcChannel * _Nonnull)rtcChannel;
/** Token 服务即将过期回调
 在调用 joinChannelByToken 时如果指定了 Token,由于 Token 具有一定的时效,在通话过程中如果 Token 即将失效,SDK 会提前 30 秒触发该回调,提醒应用程序更新 Token。 当收到该回调时,用户需要重新在服务端生成新的 Token,然后调用 renewToken 将新生成的 Token 传给 SDK。
 @param rtcChannel  ARtcChannel 类。
 @param token  即将服务失效的 Token
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel tokenPrivilegeWillExpire:(NSString *_Nonnull)token;
/** Token 过期回调
在调用 joinChannelByToken 时如果指定了 Token,由于 Token 具有一定的时效,在通话过程中 SDK 可能由于网络原因和服务器失去连接,重连时可能需要新的 Token。 该回调通知 App 需要生成新的 Token,并需调用 renewToken 为 SDK 指定新的 Token。
@param rtcChannel  ARtcChannel 类。
*/
- (void)rtcChannelRequestToken:(ARtcChannel *_Nonnull)rtcChannel;
/** 监测到活跃用户的回调
该回调获取当前时间段内累积音量最大者。如果用户开启了 enableAudioVolumeIndication 功能,则当音量检测模块监测到频道内有新的活跃用户说话时,会通过本回调返回该用户的 uid。
**Note**
- 你需要开启 enableAudioVolumeIndication 方法才能收到该回调
- uid 返回的是当前时间段内声音最大的用户 uid,而不是瞬时声音最大的用户 uid。
 @param rtcChannel      ARtcChannel 类。
 @param speakerUid 当前时间段声音最大的用户的 uid。
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel activeSpeaker:(NSString * _Nonnull)speakerUid;
/** 本地或远端视频大小和旋转信息发生改变回调
 @param rtcChannel   ARtcChannel 类。
 @param uid     图像尺寸和旋转信息发生变化的用户的用户 ID
 @param size    新的视频尺寸
 @param rotation 旋转信息 (0 到 360)
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel videoSizeChangedOfUid:(NSString *_Nonnull)uid size:(CGSize)size rotation:(NSInteger)rotation;
/** 远端视频状态发生改变回调
@param rtcChannel  ARtcChannel 类。
@param uid 发生视频状态改变的远端用户 ID。
@param state 远端视频流状态。详见 ARVideoRemoteState。
@param reason 远端视频流状态改变的具体原因。详见 ARVideoRemoteStateReason。
@param elapsed 从本地用户调用 joinChannelByToken 方法到发生本事件经历的时间,单位为 ms。
*/
- (void)rtcChannel:(ARtcChannel *_Nonnull)rtcChannel remoteVideoStateChangedOfUid:(NSString *_Nonnull)uid state:(ARVideoRemoteState)state reason:(ARVideoRemoteStateReason)reason elapsed:(NSInteger)elapsed;
/** 远端音频流状态发生改变回调。
 远端用户/主播音频状态发生改变时,SDK 会触发该回调向本地用户报告当前的远端音频流状态。
 @param rtcChannel  ARtcChannel 类。
 @param uid 发生音频状态改变的远端用户 ID。
 @param state  远端音频流状态。详见 ARAudioRemoteState。
 @param reason 远端音频流状态改变的具体原因。详见 ARAudioRemoteStateReason。
 @param elapsed 从本地用户调用 joinChannelByToken 方法到发生本事件经历的时间,单位为 ms。
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel remoteAudioStateChangedOfUid:(NSString *_Nonnull)uid state:(ARAudioRemoteState)state reason:(ARAudioRemoteStateReason)reason elapsed:(NSInteger)elapsed;
/** 当前通话统计回调。 该回调在通话或直播中每两秒触发一次。
 @param rtcChannel ARtcChannel 类。
 @param stats 通话相关的数据统计信息,详见 ARChannelStats
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel reportRtcStats:(ARChannelStats * _Nonnull)stats;
/** 通话中每个用户的网络上下行 last mile 质量报告回调
 该回调描述每个用户在通话中的 last mile 网络状态,其中 last mile 是指设备到 ar云平台 边缘服务器的网络状态。
 该回调每 2 秒触发一次。如果远端有多个用户,该回调每 2 秒会被触发多次。
 @param rtcChannel  ARtcChannel 类。
 @param uid       用户 ID。表示该回调报告的是持有该 ID 的用户的网络质量。
 @param txQuality
 该用户的上行网络质量。基于上行视频的发送码率、上行丢包率、平均往返时延和网络抖动计算。该值代表当前的上行网络质量,帮助判断是否可以支持当前设置的视频编码属性。
 假设上行码率是 500 Kbps,那么支持 480 x 480 的分辨率、30 fps 的帧率没有问题,但是支持 1280 x 720 的分辨率就会有困难。详见 ARNetworkQuality。
 @param rxQuality 该用户的下行网络质量。基于下行网络的丢包率、平均往返延时和网络抖动计算。详见 ARNetworkQuality。
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel networkQuality:(NSString * _Nonnull)uid txQuality:(ARNetworkQuality)txQuality rxQuality:(ARNetworkQuality)rxQuality;
/** 通话中远端视频流的统计信息回调
 该回调描述远端用户在通话中端到端的视频流统计信息,针对每个远端用户/主播每 2 秒触发一次。
 如果远端同时存在多个用户/主播,该回调每 2 秒会被触发多次。
 @param rtcChannel   ARtcChannel 类。
 @param stats  远端视频统计数据,详见 ARtcRemoteVideoStats
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel remoteVideoStats:(ARtcRemoteVideoStats * _Nonnull)stats;
/** 通话中远端音频流的统计信息回调,用于取代 audioQualityOfUid
 该回调描述远端用户在通话中端到端的音频流统计信息,针对每个远端用户/主播每 2 秒触发一次。
 如果远端同时存在多个用户/主播,该回调每 2 秒会被触发多次。
 和 audioTransportStatsOfUid 回调相比,该回调更贴近用户的主观感受。
 比如,当网络发生丢包时,因 FEC(Forward Error Correction,向前纠错码)或重传恢复,最终的音频丢帧率不高,则可以认为整个质量较好。
 @param rtcChannel   ARtcChannel 类。
 @param stats  远端音频统计数据,详细定义见 ARtcRemoteAudioStats。
 */
- (void)rtcChannel:(ARtcChannel * _Nonnull)rtcChannel remoteAudioStats:(ARtcRemoteAudioStats * _Nonnull)stats;
@end
#endif /* ARtcChannelDelegate_h */
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcEngineDelegate.h
New file
@@ -0,0 +1,915 @@
//
//  ARtcEngineDelegate.h
//  ARtcKit
//
//  Created by 余生丶 on 2020/3/18.
//  Copyright © 2020 zjq. All rights reserved.
//
#ifndef ARtcEngineDelegate_h
#define ARtcEngineDelegate_h
#import "AREnumerates.h"
#import "ARObjects.h"
@class ARtcEngineKit;
@protocol ARtcEngineDelegate <NSObject>
@optional
//MARK: - 核心事件回调
/**-----------------------------------------------------------------------------
* @name 核心事件回调
* -----------------------------------------------------------------------------
*/
/** 发生警告回调
@param engine   ARtcEngineKit对象
@param warningCode   警告码,详见 ARWarningCode
*/
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didOccurWarning:(ARWarningCode)warningCode;
/** 发生错误回调
@param engine   ARtcEngineKit对象
@param errorCode   错误码,详见 ARErrorCode
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didOccurError:(ARErrorCode)errorCode;
/** 加入频道回调
@param engine   ARtcEngineKit对象
@param channel   频道名称
@param uid   用户ID
@param elapsed   从调用joinChannelByToken开始到发生此事件过去的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channel withUid:(NSString * _Nonnull)uid elapsed:(NSInteger)elapsed;
/** 重新加入频道回调
有时候由于网络原因,客户端可能会和服务器失去连接,SDK 会进行自动重连,自动重连成功后触发此回调方法。
@param engine   ARtcEngineKit对象
@param channel   频道名称
@param uid   用户ID
@param elapsed   从开始重连到重连成功的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didRejoinChannel:(NSString *_Nonnull)channel withUid:(NSString * _Nonnull)uid elapsed:(NSInteger)elapsed;
/** 已离开频道回调
 当用户调用 leaveChannel 离开频道后,SDK 会触发该回调。在该回调方法中,App 可以得到此次通话的总通话时长、SDK 收发数据的流量等信息。
 @param engine ARtcEngineKit对象
 @param stats  通话相关的统计信息,详见 ARChannelStats
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didLeaveChannelWithStats:(ARChannelStats * _Nonnull)stats;
/** 用户角色已切换回调
直播场景下,当本地用户在加入频道后调用 setClientRole 切换角色时会触发此回调,即主播切换为观众时,或观众切换为主播时。
@param engine   ARtcEngineKit对象
@param oldRole   切换前的角色
@param newRole   切换后的角色
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didClientRoleChanged:(ARClientRole)oldRole newRole:(ARClientRole)newRole;
/** 远端用户/主播加入回调
@param engine   ARtcEngineKit对象
@param uid   新加入频道的远端用户/主播 ID。如果 joinChannelByToken 中指定了 uid,则此处返回该 ID;否则使用ar云平台服务器自动分配的 ID。
@param elapsed   从本地用户加入频道 joinChannelByToken开始到发生此事件过去的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didJoinedOfUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 远端用户(通信场景)/主播(直播场景)离开当前频道回调
@param engine   ARtcEngineKit对象
@param uid   离线的用户 ID。
@param reason   离线原因,详见 ARUserOfflineReason。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didOfflineOfUid:(NSString *_Nonnull)uid reason:(ARUserOfflineReason)reason;
/** 网络连接状态已改变回调
该回调在网络连接状态发生改变的时候触发,并告知用户当前的网络连接状态,和引起网络状态改变的原因。
@param engine ARtcEngineKit对象
@param state 当前的网络连接状态,详见 ARConnectionStateType。
@param reason 引起网络连接状态发生改变的原因,详见 ARConnectionChangedReason。
*/
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine connectionChangedToState:(ARConnectionStateType)state reason:(ARConnectionChangedReason)reason;
/** 本地网络类型发生改变回调
@param engine   ARtcEngineKit对象
@param type   网络连接类型,详见 ARNetworkType。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine networkTypeChangedToType:(ARNetworkType)type;
/** 网络连接中断,且 SDK 无法在 10 秒内连接服务器回调
@param engine   ARtcEngineKit对象
*/
- (void)rtcEngineConnectionDidLost:(ARtcEngineKit *_Nonnull)engine;
/** Token 服务即将过期回调
 在调用 joinChannelByToken 时如果指定了 Token,由于 Token 具有一定的时效,在通话过程中如果 Token 即将失效,SDK 会提前 30 秒触发该回调,提醒应用程序更新 Token。 当收到该回调时,用户需要重新在服务端生成新的 Token,然后调用 renewToken 将新生成的 Token 传给 SDK。
 @param engine ARtcEngineKit 对象
 @param token  即将服务失效的 Token
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine tokenPrivilegeWillExpire:(NSString *_Nonnull)token;
/** Token 过期回调
 在调用 joinChannelByToken 时如果指定了 Token,由于 Token 具有一定的时效,在通话过程中 SDK 可能由于网络原因和服务器失去连接,重连时可能需要新的 Token。 该回调通知 App 需要生成新的 Token,并需调用 renewToken 为 SDK 指定新的 Token。
 @param engine ARtcEngineKit 对象
 */
- (void)rtcEngineRequestToken:(ARtcEngineKit * _Nonnull)engine;
//MARK: - 媒体事件回调
/**-----------------------------------------------------------------------------
* @name 媒体事件回调
* -----------------------------------------------------------------------------
*/
/** 提示频道内谁正在说话、说话者音量及本地用户是否在说话的回调
 与 audioVolumeIndicationBlock 相同。
 该回调报告频道内瞬时音量最高的几个用户(最多三个用户)的用户 ID、他们的音量及本地用户是否在说话。
 该回调默认禁用。可以通过 enableAudioVolumeIndication 方法开启;开启后,无论频道内是否有人说话,SDK 都会按 enableAudioVolumeIndication 方法中设置的时间间隔触发 reportAudioVolumeIndicationOfSpeakers 回调。每次触发,用户会收到两个独立的 reportAudioVolumeIndicationOfSpeakers 回调,其中一个包含本地用户的音量信息,另一个包含远端所有用户的音量信息,详见下方参数描述。
**Note:**
 - 若需使用该回调 speakers 数组中的 vad 参数(即本地人声检测功能),请在 enableAudioVolumeIndication 方法中设置 report_vad 为 YES 。
 - 如果有用户将自己静音(调用了 muteLocalAudioStream ),会对该回调的行为产生影响。
 - 本地用户静音后 SDK 即不再报告本地用户的音量提示回调。
 - 远端说话者静音后 20 秒,远端的音量提示回调中将不再包含该用户;如果远端所有用户都将自己静音,20 秒后 SDK 不再报告远端用户的音量提示回调。
 @param engine      ARtcEngineKit 对象
 @param speakers    ARtcAudioVolumeInfo 数组。
 - 在本地用户的回调中,此数组中包含以下成员:
  - `uid` = 0,
  - volume 等于 totalVolume,返回本地用户混音后的音量;
  - vad,返回本地用户人声状态。
 - 在远端用户的回调中,此数组中包含以下成员:
  - uid 为每位说话者各自的用户 ID;
  - volume 为说话者各自混音后的音量;
  - vad = 0,对远端用户无效。 如果报告的 speakers 数组为空,则表示此时远端没有人说话。
 @param totalVolume (混音后的)总音量,取值范围为 [0,255]。
 - 在本地用户的回调中,totalVolume 为本地用户混音后的音量。
 - 在远端用户的回调中,totalVolume 为所有说话者混音后的总音量。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray<ARtcAudioVolumeInfo *> * _Nonnull)speakers totalVolume:(NSInteger)totalVolume;
/** 监测到活跃用户的回调
该回调获取当前时间段内累积音量最大者。如果用户开启了 enableAudioVolumeIndication 功能,则当音量检测模块监测到频道内有新的活跃用户说话时,会通过本回调返回该用户的 uid。
**Note**
- 你需要开启 enableAudioVolumeIndication 方法才能收到该回调
- uid 返回的是当前时间段内声音最大的用户 uid,而不是瞬时声音最大的用户 uid。
 @param engine     ARtcEngineKit 对象
 @param speakerUid 当前时间段声音最大的用户的 uid。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine activeSpeaker:(NSString * _Nonnull)speakerUid;
/** 已发送本地音频首帧的回调
 @param engine  ARtcEngineKit 对象
 @param elapsed 从本地用户调用joinChannelByToken开始到发生此事件过去的时间(ms)。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine firstLocalAudioFrame:(NSInteger)elapsed;
 /** 已显示本地视频首帧的回调
 第一帧本地视频显示时,触发此回调。
 @param engine  ARtcEngineKit 对象
 @param size    本地渲染的视频尺寸(宽度和高度)
 @param elapsed 从本地用户调用joinChannelByToken到发生此事件过去的时间(ms)。 如果在joinChannelByToken前调用了startPreview,是从startPreview到发生此事件过去的时间。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed;
/** 远端音频流状态发生改变回调。
 远端用户/主播音频状态发生改变时,SDK 会触发该回调向本地用户报告当前的远端音频流状态。
 @param engine ARtcEngineKit 对象
 @param uid 发生音频状态改变的远端用户 ID。
 @param state  远端音频流状态。详见 ARAudioRemoteState。
 @param reason 远端音频流状态改变的具体原因。详见 ARAudioRemoteStateReason。
 @param elapsed 从本地用户调用 joinChannelByToken 方法到发生本事件经历的时间,单位为 ms。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine remoteAudioStateChangedOfUid:(NSString *_Nonnull)uid state:(ARAudioRemoteState)state reason:(ARAudioRemoteStateReason)reason elapsed:(NSInteger)elapsed;
/** 本地音频状态发生改变回调。
 本地音频的状态发生改变时(包括本地麦克风录制状态和音频编码状态),SDK会触发该回调报告当前的本地音频状态。在本地音频出现故障时,该回调可以帮助你了解当前音频的状态以及出现故障的原因,方便你排查问题。
 **Note:**
 当状态为 ARAudioLocalStateFailed(3) 时,你可以在 error 参数中查看返回的错误信息。
 @param engine ARtcEngineKit 对象
 @param state 当前的本地音频状态。详见 ARAudioLocalState。
 @param error 本地音频出错原因。详见 ARAudioLocalError。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine localAudioStateChange:(ARAudioLocalState)state error:(ARAudioLocalError)error;
/** 已显示远端视频首帧回调
@param engine ARtcEngineKit 对象
@param uid 远端用户 ID
@param size 视频尺寸(宽和高)
@param elapsed 从本地用户调用joinChannelByToken到发生此事件过去的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine firstRemoteVideoFrameOfUid:(NSString *_Nonnull)uid size:(CGSize)size elapsed:(NSInteger)elapsed;
/** 音频发布状态改变回调
 本地音频的发布状态发生改变时,SDK会触发该回调报告当前的本地音频发布状态。
 @param engine     ARtcEngineKit 对象
 @param channel    频道名
 @param oldState   之前的发布状态,详见 ARStreamPublishState 。
 @param newState   当前的发布状态,详见 ARStreamPublishState 。
 @param elapseSinceLastState 两次状态变化时间间隔(毫秒)。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didAudioPublishStateChange:(NSString *_Nonnull)channel oldState:(ARStreamPublishState)oldState newState:(ARStreamPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState;
/** 视频发布状态改变回调
 本地视频的发布状态发生改变时,SDK会触发该回调报告当前的本地视频发布状态。
 @param engine     ARtcEngineKit 对象
 @param channel    频道名
 @param oldState   之前的发布状态,详见 ARStreamPublishState 。
 @param newState   当前的发布状态,详见 ARStreamPublishState 。
 @param elapseSinceLastState 两次状态变化时间间隔(毫秒)。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didVideoPublishStateChange:(NSString *_Nonnull)channel oldState:(ARStreamPublishState)oldState newState:(ARStreamPublishState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState;
/** 音频订阅状态发生改变回调
 本地订阅远程音频的状态发生改变时,SDK会触发该回调报告当前订阅远程音频的状态。
 @param engine    ARtcEngineKit 对象
 @param channel   频道名
 @param uid       远端用户的 ID
 @param oldState 之前的订阅状态,详见 ARStreamSubscribeState 。
 @param newState  当前的订阅状态,详见 ARStreamSubscribeState 。
 @param elapseSinceLastState 两次状态变化时间间隔(毫秒)。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didAudioSubscribeStateChange:(NSString *_Nonnull)channel withUid:(NSString * _Nonnull)uid oldState:(ARStreamSubscribeState)oldState newState:(ARStreamSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState;
/** 视频订阅状态发生改变回调
 本地订阅远程视频的状态发生改变时,SDK会触发该回调报告当前订阅远程视频的状态。
 @param engine    ARtcEngineKit 对象
 @param channel   频道名
 @param uid       远端用户的 ID
 @param oldState  之前的订阅状态,详见 ARStreamSubscribeState 。
 @param newState  当前的订阅状态,详见 ARStreamSubscribeState 。
 @param elapseSinceLastState 两次状态变化时间间隔(毫秒)。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didVideoSubscribeStateChange:(NSString *_Nonnull)channel withUid:(NSString * _Nonnull)uid oldState:(ARStreamSubscribeState)oldState newState:(ARStreamSubscribeState)newState elapseSinceLastState:(NSInteger)elapseSinceLastState;
/** 本地或远端视频大小和旋转信息发生改变回调
 @param engine   ARtcEngineKit 对象
 @param uid     图像尺寸和旋转信息发生变化的用户的用户 ID
 @param size    新的视频尺寸
 @param rotation 旋转信息 (0 到 360)
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSString *_Nonnull)uid size:(CGSize)size rotation:(NSInteger)rotation;
/** 远端视频状态发生改变回调
@param engine ARtcEngineKit 对象。
@param uid 发生视频状态改变的远端用户 ID。
@param state 远端视频流状态。详见 ARVideoRemoteState。
@param reason 远端视频流状态改变的具体原因。详见 ARVideoRemoteStateReason。
@param elapsed 从本地用户调用 joinChannelByToken 方法到发生本事件经历的时间,单位为 ms。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine remoteVideoStateChangedOfUid:(NSString *_Nonnull)uid state:(ARVideoRemoteState)state reason:(ARVideoRemoteStateReason)reason elapsed:(NSInteger)elapsed;
/** 本地视频状态发生改变回调
本地视频的状态发生改变时,SDK 会触发该回调返回当前的本地视频状态。
在本地视频出现故障时,你可以通过该回调了解当前视频的状态以及出现故障的原因,方便排查问题。
 @param engine ARtcEngineKit 对象。
 @param state 本地视频状态,详见 ARLocalVideoStreamState。当本地视频状态为 ARLocalVideoStreamStateFailed(3) 时,你可以在 error 参数中查看返回的错误原因。
 @param error 本地视频出错原因,详见 ARLocalVideoStreamError。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine localVideoStateChange:(ARLocalVideoStreamState)state error:(ARLocalVideoStreamError)error;
//MARK: - 统计数据事件回调
/**-----------------------------------------------------------------------------
* @name 统计数据事件回调
* -----------------------------------------------------------------------------
*/
/** 通话中远端音频流的统计信息回调,用于取代 audioQualityOfUid
 该回调描述远端用户在通话中端到端的音频流统计信息,针对每个远端用户/主播每 2 秒触发一次。
 如果远端同时存在多个用户/主播,该回调每 2 秒会被触发多次。
 和 audioTransportStatsOfUid 回调相比,该回调更贴近用户的主观感受。
 比如,当网络发生丢包时,因 FEC(Forward Error Correction,向前纠错码)或重传恢复,最终的音频丢帧率不高,则可以认为整个质量较好。
 @param engine ARtcEngineKit 对象。
 @param stats  远端音频统计数据,详细定义见 ARtcRemoteAudioStats。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine remoteAudioStats:(ARtcRemoteAudioStats * _Nonnull)stats;
/** 当前通话统计回调。 该回调在通话或直播中每两秒触发一次。
 @param engine ARtcEngineKit 对象。
 @param stats 通话相关的数据统计信息,详见 ARChannelStats
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine reportRtcStats:(ARChannelStats * _Nonnull)stats;
/** 通话前网络上下行 last mile 质量报告回调
 该回调描述本地用户在加入频道前的 last mile 网络探测的结果,其中 last mile 是指设备到 边缘服务器的网络状态。
 在调用 enableLastmileTest 之后,该回调每 2 秒触发一次。
 @param engine  ARtcEngineKit 对象。
 @param quality 网络上下行质量,基于上下行网络的丢包率和抖动计算,探测结果主要反映上行网络的状态。详见 ARNetworkQuality。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine lastmileQuality:(ARNetworkQuality)quality;
/** 通话中每个用户的网络上下行 last mile 质量报告回调
 该回调描述每个用户在通话中的 last mile 网络状态,其中 last mile 是指设备到 ar云平台 边缘服务器的网络状态。
 该回调每 2 秒触发一次。如果远端有多个用户,该回调每 2 秒会被触发多次。
 @param engine  ARtcEngineKit 对象
 @param uid       用户 ID。表示该回调报告的是持有该 ID 的用户的网络质量。
 @param txQuality
 该用户的上行网络质量。基于上行视频的发送码率、上行丢包率、平均往返时延和网络抖动计算。该值代表当前的上行网络质量,帮助判断是否可以支持当前设置的视频编码属性。
 假设上行码率是 500 Kbps,那么支持 480 x 480 的分辨率、30 fps 的帧率没有问题,但是支持 1280 x 720 的分辨率就会有困难。详见 ARNetworkQuality。
 @param rxQuality 该用户的下行网络质量。基于下行网络的丢包率、平均往返延时和网络抖动计算。详见 ARNetworkQuality。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine networkQuality:(NSString * _Nonnull)uid txQuality:(ARNetworkQuality)txQuality rxQuality:(ARNetworkQuality)rxQuality;
/** 通话前网络质量探测报告回调
 通话前网络上下行 last mile 质量探测报告回调。在调用 startLastmileProbeTest 之后,SDK 会在约 30 秒内返回该回调。
 @param engine ARtcEngineKit 对象
 @param result 上下行 last mile 质量探测结果,详见 ARLastmileProbeResult。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine lastmileProbeTestResult:(ARLastmileProbeResult * _Nonnull)result;
/** 本地视频流统计信息回调
 @param engine ARtcEngineKit 对象。
 @param stats 报告更新本地视频统计信息,该回调方法每两秒触发一次。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine localVideoStats:(ARtcLocalVideoStats * _Nonnull)stats;
/** 通话中本地音频流的统计信息回调。
 该回调描述本地设备发送音频流的统计信息。SDK 每 2 秒触发该回调一次。
 @param engine ARtcEngineKit 对象。
 @param stats 本地音频统计数据。详见 ARtcLocalAudioStats。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine localAudioStats:(ARtcLocalAudioStats * _Nonnull)stats;
/** 通话中远端视频流的统计信息回调
 该回调描述远端用户在通话中端到端的视频流统计信息,针对每个远端用户/主播每 2 秒触发一次。
 如果远端同时存在多个用户/主播,该回调每 2 秒会被触发多次。
 @param engine ARtcEngineKit 对象。
 @param stats  远端视频统计数据,详见 ARtcRemoteVideoStats
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine remoteVideoStats:(ARtcRemoteVideoStats * _Nonnull)stats;
//MARK: - 音频播放事件回调
/**-----------------------------------------------------------------------------
* @name 音频播放事件回调
* -----------------------------------------------------------------------------
*/
/** 本地音乐文件播放已结束回调
本地用户调用 startAudioMixing 播放音乐文件音乐结束后,会触发该回调。如果调用 startAudioMixing 失败,会在 didOccurWarning 回调里,返回警告代码 ARWarningCodeAudioMixingOpenError。
@param engine  ARtcEngineKit 对象。
*/
- (void)rtcEngineLocalAudioMixingDidFinish:(ARtcEngineKit *_Nonnull)engine;
/** 本地音效文件播放已结束回调
 当调用 playEffect 播放音效结束后,会触发该回调。
 @param engine  ARtcEngineKit 对象。
 @param soundId 自行设定的音效 ID,需保证唯一性。
 */
- (void)rtcEngineDidAudioEffectFinish:(ARtcEngineKit * _Nonnull)engine soundId:(NSInteger)soundId;
//MARK: - CDN 旁路推流事件回调
/**-----------------------------------------------------------------------------
 * @name CDN 旁路推流事件回调
 * -----------------------------------------------------------------------------
 */
/** RTMP 推流状态发生改变回调
 该回调返回本地用户调用 addPublishStreamUrl 或 removePublishStreamUrl 方法的结果。
 RTMP 推流状态发生改变时,SDK 会触发该回调,并在回调中明确状态发生改变的 URL 地址及当前推流状态。
 该回调方便推流用户了解当前的推流状态;推流出错时,你可以通过返回的错误码了解出错的原因,方便排查问题。
@param engine ARtcEngineKit 对象。
@param url 推流状态发生改变的 URL 地址。
@param state 当前的推流状态,详见 ARtmpStreamingState。当推流状态为 ARtmpStreamingStateFailure(4) 时,你可以在 errorCode 参数中查看返回的错误信息。
@param errorCode 具体的推流错误信息,详见 ARtmpStreamingErrorCode。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine rtmpStreamingChangedToState:(NSString * _Nonnull)url state:(ARtmpStreamingState)state errorCode:(ARtmpStreamingErrorCode)errorCode;
/** RTMP 推流事件回调。
 @param engine ARtcEngineKit 对象。
 @param url RTMP 推流 URL。
 @param eventCode RTMP 推流事件码。详见 ARtmpStreamingEvent 。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine rtmpStreamingEventWithUrl:(NSString * _Nonnull)url eventCode:(ARtmpStreamingEvent)eventCode;
/** 开启旁路推流的结果回调
 返回 addPublishStreamUrl 方法的调用结果。如果调用不成功,你可以在 errorCode 参数中查看详细的错误信息。
 @param engine    ARtcEngineKit 对象
 @param url       主播推流地址或输入的外部音视频流地址
 @param errorCode 常见的错误码如下,详情见 ARErrorCode
 - ARErrorCodeNoError(0):推流成功
 - ARErrorCodeFailed(1):推流失败
 - ARErrorCodeInvalidArgument(2):参数错误,如果你在调用 addPublishStreamUrl 前没有调用 setLiveTranscoding 配置 ARLiveTranscoding ,会导致此错误。
 - ARErrorCodeTimedOut(10):推流超时未成功
 - ARErrorCodeAlreadyInUse(19):推流地址已经在推流
 - ARErrorCodeAbort(20): SDK 与推流服务器断开连接,推流中断
 - ARErrorCodeResourceLimited(22):后台没有足够资源推流
 - ARErrorCodeEncryptedStreamNotAllowedPublish(130):推流已加密不能推流
 - ARErrorCodePublishStreamCDNError(151):CDN 相关错误。请调用 removePublishStreamUrl 方法删除原来的推流地址,然后调用 addPublishStreamUrl 方法重新推流到新地址。
 - ARErrorCodePublishStreamNumReachLimit(152):单个主播的推流地址数目达到上限 10。请删掉一些不用的推流地址再增加推流地址。
 - ARErrorCodePublishStreamNotAuthorized(153):操作不属于主播自己的流,例如更新其他主播的流参数、停止其他主播的流。请检查 App 逻辑。
 - ARErrorCodePublishStreamInternalServerError(154):推流服务器出现错误。请调用 addPublishStreamUrl 重新推流。
 - ARErrorCodePublishStreamFormatNotSuppported(156):推流地址格式有错误。请检查推流地址格式是否正确。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine streamPublishedWithUrl:(NSString * _Nonnull)url errorCode:(ARErrorCode)errorCode;
/** 停止旁路推流的结果回调
 返回 removePublishStreamUrl 方法的调用结果。
 @param engine ARtcEngineKit object.
 @param url    主播停止推流的 RTMP 地址
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine streamUnpublishedWithUrl:(NSString * _Nonnull)url;
/** 旁路推流设置被更新回调
 setLiveTranscoding 方法中的直播参数 LiveTranscoding rtcEngineTranscodingUpdated 回调会被触发并向主播报告更新信息。
 **Note:**
 首次调用 setLiveTranscoding 方法设置转码参数 LiveTranscoding 时,不会触发此回调。
 @param engine ARtcEngineKit 对象。
 */
- (void)rtcEngineTranscodingUpdated:(ARtcEngineKit * _Nonnull)engine;
//MARK: - 直播输入在线媒体流事件回调
/**-----------------------------------------------------------------------------
* @name 直播输入在线媒体流事件回调
* -----------------------------------------------------------------------------
*/
/** 输入外部视频流状态回调
 @param engine  ARtcEngineKit 对象
 @param url 输入进直播的外部视频源 URL 地址
 @param uid 用户 ID
 @param status 详见ARInjectStreamStatus
 */
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine streamInjectedStatusOfUrl:(NSString *_Nonnull)url uid:(NSString * _Nonnull)uid status:(ARInjectStreamStatus)status;
//MARK: - 数据流事件回调
/**-----------------------------------------------------------------------------
 * @name 数据流事件回调
 * -----------------------------------------------------------------------------
 */
/** 接收到对方数据流消息的回调
 该回调表示本地用户收到了远端用户调用 sendStreamMessage 方法发送的流消息。
 @param engine   ARtcEngineKit 对象
 @param uid      用户ID
 @param streamId 数据流 ID
 @param data     接收到的数据
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine receiveStreamMessageFromUid:(NSString * _Nonnull)uid streamId:(NSInteger)streamId data:(NSData * _Nonnull)data;
/** 接收对方数据流消息错误的回调
 该回调表示本地用户未收到远端用户调用 sendStreamMessage 方法发送的流消息。
 @param engine   ARtcEngineKit 对象
 @param uid      用户 ID
 @param streamId 数据流 ID
 @param error   错误代码: ARErrorCode
 @param missed 丢失的消息数量
 @param cached 数据流中断时,后面缓存的消息数量
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didOccurStreamMessageErrorFromUid:(NSString * _Nonnull)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached;
//MARK: - Miscellaneous Delegate Methods
//MARK: - 音视频流回退事件回调
/**-----------------------------------------------------------------------------
 * @name 本地发布流已回退为音频流
 * -----------------------------------------------------------------------------
 */
 /** 远端订阅流已回退为音频流
  如果你调用了 setRemoteSubscribeFallbackOption, 接口并将回退选项设置为 ARStreamFallbackOptionAudioOnly,当下行网络环境不理想、仅接收远端音频流时,或当下行网络改善、恢复订阅音视频流时,会触发该回调。
 **Note:**
  远端订阅流因弱网环境不能同时满足音视频而回退为小流时,你可以使用 remoteVideoStats 方法来监控远端视频大小流的切换。
 @param engine              ARtcEngineKit 对象。
 @param isFallbackOrRecover 回退为音频流或恢复为音视频流:
 * YES: 由于网络环境不理想,远端订阅流已回退为音频流
 * NO: 由于网络环境改善,订阅的音频流已恢复为音视频流
 @param uid  远端用户ID
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSString *_Nonnull)uid;
//MARK: - 媒体设备事件回调
/**-----------------------------------------------------------------------------
* @name 媒体设备事件回调
* -----------------------------------------------------------------------------
*/
#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
/** 设备状态改变回调 (仅支持 macOS)
 @param engine     ARtcEngineKit 对象
 @param deviceId   设备ID
 @param deviceType 设备类型,详见 ARMediaDeviceType
 @param state      设备的状态:
 - 0: 已添加。
 - 1: 删除。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine device:(NSString * _Nonnull)deviceId type:(ARMediaDeviceType)deviceType stateChanged:(NSInteger) state;
#endif
/** 语音路由已发生变化回调
当语音路由发生变化时,SDK 会触发此回调。
 @param engine  ARtcEngineKit 对象
 @param routing 设置语音路由,详见 ARAudioOutputRouting
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didAudioRouteChanged:(ARAudioOutputRouting)routing;
#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
/** 报告本地人脸检测结果。
 调用 enableFaceDetection(YES) 开启本地人脸检测后,你可以通过该回调实时获取以下人脸检测的信息:
 - 摄像头采集的画面大小
 - 人脸在画面中的位置
 - 人脸距设备屏幕的距离,该值由 SDK 通过摄像头采集的画面大小和人脸在画面中的位置拟合计算得出。
**Note**
 - 当检测到摄像头前没有人脸时,该回调触发频率会降低,以节省设备耗能。
 - 当人脸距离设备屏幕过近时,SDK 不会触发该回调。
 @param engine ARtcEngineKit 对象。
 @param width 摄像头采集画面的宽度 (px)。
 @param height 摄像头采集画面的高度 (px)。
 @param faces 检测到的人脸信息,详见 ARFacePositionInfo 。
 检测到几张人脸,就会报告几个 ARFacePositionInfo 数组。数组长度可以为 0,表示没有检测到摄像头前出现人脸。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray<ARFacePositionInfo *> *_Nullable)faces;
#endif
//MARK: - 跨频道媒体流转发回调
/**-----------------------------------------------------------------------------
* @name 跨频道媒体流转发回调
* -----------------------------------------------------------------------------
*/
/** 跨频道媒体流转发状态发生改变回调。
 当跨频道媒体流转发状态发生改变时,SDK 会触发该回调,并报告当前的转发状态以及相关的错误信息。
 @param engine ARtcEngineKit 对象
 @param state 跨频道媒体流转发状态 ARChannelMediaRelayState。
 @param error 跨频道媒体流转发出错的错误码 ARChannelMediaRelayError。
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine channelMediaRelayStateDidChange:(ARChannelMediaRelayState)state error:(ARChannelMediaRelayError)error;
/** 跨频道媒体流转发事件回调。
 @param engine ARtcEngineKit 对象
 @param event 跨频道媒体流转发事件码
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didReceiveChannelMediaRelayEvent:(ARChannelMediaRelayEvent)event;
//MARK: - 其它回调方法(不推荐使用)
/**-----------------------------------------------------------------------------
* @name 其它回调方法
* -----------------------------------------------------------------------------
*/
/** 已完成远端视频首帧解码回调
**Note**
收到该回调,可调用setupRemoteVideo方法显示远端视图。推荐使用 remoteVideoStateChangedOfUid 回调的 ARVideoRemoteStateStarting(1) 和 ARVideoRemoteStateDecoding(2)。
@param engine ARtcEngineKit 对象
@param uid 远端用户 ID
@param size 视频流尺寸(宽度和高度)
@param elapsed 从本地用户调用 joinChannelByToken到发生此事件过去的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine firstRemoteVideoDecodedOfUid:(NSString *_Nonnull)uid size:(CGSize)size elapsed:(NSInteger)elapsed;
/** 已接收远端音频首帧的回调
**Note**
推荐使用 remoteAudioStateChangedOfUid 回调。
@param engine ARtcEngineKit 对象
@param uid 远端用户 ID
@param elapsed 从本地用户调用joinChannelByToken到发生此事件的时间(ms)。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine firstRemoteAudioFrameOfUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 已解码远端音频首帧的回调
**Note**
推荐使用 remoteAudioStateChangedOfUid 回调。SDK 完成远端音频首帧解码,并发送给音频模块用以播放时,会触发此回调。有两种情况:
 * 远端用户首次上线后发送音频
 * 远端用户音频离线再上线发送音频。音频离线指本地在 15 秒内没有收到音频包,可能有如下原因:
    * 远端用户离开频道
    * 远端用户掉线
    * 远端用户停止发送音频流(调用了 muteLocalAudioStream)
    * 远端用户关闭音频(调用了 disableAudio)
@param engine ARtcEngineKit 对象
@param uid 远端用户 ID
@param elapsed 从本地用户调用 joinChannelByToken 直至该回调触发的延迟,单位为毫秒。
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSString *_Nonnull)uid elapsed:(NSInteger)elapsed;
/** 远端用户暂停/重新发送视频回调(由muteLocalVideoStream触发 )
**Note**
 推荐使用 remoteVideoStateChangedOfUid 回调的:
 * ARVideoRemoteStateStopped(0) and ARVideoRemoteStateReasonRemoteMuted(5).
 * ARVideoRemoteStateDecoding(2) 和 ARVideoRemoteStateReasonRemoteUnmuted(6)。
 当频道内的用户或主播数超过 20 人,该回调会失效。
 @param engine ARtcEngineKit 对象
 @param muted  暂停或恢复发送视频流:
 * Yes: 该用户已暂停发送其视频流
 * No: 该用户已恢复发送其视频流
 @param uid    远端用户 UID
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSString *_Nonnull)uid;
/** 远端用户音频静音回调
 该回调是由远端用户调用 muteLocalAudioStream 方法关闭或开启音频发送触发的。当频道内的用户或主播人数超过 20 时,该回调不生效。
**Note**
推荐使用 remoteAudioStateChangedOfUid 回调:
 * ARAudioRemoteReasonRemoteMuted(5)
 * ARAudioRemoteReasonRemoteUnmuted(6)
@param engine ARtcEngineKit 对象
@param muted YES: 静音 NO:取消静音
@param uid 远端用户 ID
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSString *_Nonnull)uid;
/** 其他用户启用/关闭视频回调(enableVideo 或 disableVideo触发)
**Note**
推荐使用 remoteVideoStateChangedOfUid 回调的:
 * ARVideoRemoteStateStopped(0) 和 ARVideoRemoteStateReasonRemoteMuted(5)。
 * ARVideoRemoteStateDecoding(2) 和 ARVideoRemoteStateReasonRemoteUnmuted(6)。
提示有其他用户启用/关闭了视频功能。关闭视频功能是指该用户只能进行语音直播,不能显示、发送自己的视频,也不能接收、显示别人的视频。
该回调是由远端用户调用 enableVideo 或 disableVideo 方法开启或关闭视频模块触发的。
@param engine ARtcEngineKit 对象
@param enabled 是否启用了视频功能:
 * YES: 该用户已启用了视频功能。启用后,该用户可以进行视频通话或直播。
 * NO: 该用户已关闭了视频功能。关闭后,该用户只能进行语音通话或直播,不能显示、发送自己的视频,也不能接收、显示别人的视频。
@param uid 远端用户 ID
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSString *_Nonnull)uid;
/** 其他用户启用/关闭本地视频回调(enableLocalVideo触发)
**Note**
推荐使用 remoteVideoStateChangedOfUid 回调的:
 * ARVideoRemoteStateStopped(0) 和 ARVideoRemoteStateReasonRemoteMuted(5)。
 * ARVideoRemoteStateDecoding(2) 和 ARVideoRemoteStateReasonRemoteUnmuted(6)。
@param engine ARtcEngineKit 对象
@param enabled 是否启用了视频功能
 * YES: 该用户已启用本地视频功能。启用后,其他用户可以接收到该用户的视频流。
 * NO: 该用户已关闭视频功能。关闭后,该用户仍然可以接收其他用户的视频流,但其他用户接收不到该用户的视频流。
@param uid 远端用户 ID
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSString *_Nonnull)uid;
/** 麦克风状态已改变回调
 该回调是由本地用户调用 enableLocalAudio 方法开启或关闭本地音频采集触发的。
**Note**
推荐使用 localAudioStateChange 回调的: ARAudioLocalStateStopped(0) 或 ARAudioLocalStateRecording(1)。
@param engine ARtcEngineKit 对象
@param enabled YES: 麦克风已启用 NO: 麦克风已禁用
*/
- (void)rtcEngine:(ARtcEngineKit *_Nonnull)engine didMicrophoneEnabled:(BOOL)enabled;
/** 网络连接中断回调
 SDK 在和服务器建立连接后,失去了网络连接超过 4 秒,会触发该回调。在触发事件后,SDK 会主动重连服务器,所以该事件可以用于 UI 提示。
 与 rtcEngineConnectionDidLost 回调的区别是:
 rtcEngineConnectionDidInterrupted 回调一定是发生在加入频道成功后,且 SDK 刚失去和服务器连接超过 4 秒时触发。
 rtcEngineConnectionDidLost 回调是无论之前加入频道是否连接成功,只要 10 秒内和服务器无法建立连接都会触发。
 如果 SDK 在断开连接后,20 分钟内还是没能重新加入频道,SDK 会停止尝试重连。
**Note**
推荐使用connectionChangedToState回调。
@param engine ARtcEngineKit 对象
*/
- (void)rtcEngineConnectionDidInterrupted:(ARtcEngineKit *_Nonnull)engine;
/** 连接已被禁止回调
 当你被服务端禁掉连接的权限时,会触发该回调。
**Note**
推荐使用connectionChangedToState回调。
@param engine ARtcEngineKit 对象
*/
- (void)rtcEngineConnectionDidBanned:(ARtcEngineKit *_Nonnull)engine;
/** 通话中远端音频流传输的统计信息回调
 该回调描述远端用户通话中端到端的网络统计信息,通过音频包计算,用客观的数据,如丢包、网络延迟等,展示当前网络状态。
 通话中,当用户收到远端用户/主播发送的音频数据包后,会每 2 秒触发一次该回调。
 和 remoteAudioStats 回调相比,该回调以数据展示当前网络状态,因此更客观。
**Note**
 推荐使用remoteAudioStats回调。
 @param engine ARtcEngineKit 对象
 @param uid 用户 ID,指定是哪个用户/主播的音频包
 @param delay 音频包从发送端到接收端的延时(毫秒)
 @param lost 音频包从发送端到接收端的丢包率(%)
 @param rxKBitRate 远端音频包的接收码率(Kbps)
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine audioTransportStatsOfUid:(NSString *_Nonnull)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate;
/** 通话中远端视频流传输的统计信息回调
 该回调描述远端用户通话中端到端的网络统计信息,通过视频包计算,用客观的数据,如丢包、网络延迟等,展示当前网络状态。
 通话中,当用户收到远端用户/主播发送的视频数据包后,会每 2 秒触发一次该回调。
 和 remoteVideoStats 回调相比,该回调以数据展示当前网络状态,因此更客观。
**Note**
 推荐使用remoteVideoStats回调。
 @param engine ARtcEngineKit 对象
 @param uid 用户 ID,指定是哪个用户/主播的视频包
 @param delay 视频包从发送端到接收端的延时(毫秒)
 @param lost 视频包从发送端到接收端 800 ms 内的丢包率(%)
 @param rxKBitRate 远端视频包的接收码率(Kbps)
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine videoTransportStatsOfUid:(NSString *_Nonnull)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate;
/** 远端音频质量回调
 该回调描述远端用户在通话中的音频质量,针对每个远端用户/主播每 2 秒触发一次。如果远端同时存在多个用户/主播,该回调每 2 秒会被触发多次。
**Note**
 推荐使用remoteVideoStats回调。
 @param engine  ARtcEngineKit 对象
 @param uid 用户 ID,指定是谁发的音频流。
 @param quality 语音质量,详见 ARNetworkQuality
 @param delay  音频包从发送端到接收端的延迟(毫秒)。包括声音采样前处理、网络传输、网络抖动缓冲引起的延迟。
 @param lost    音频包从发送端到接收端的丢包率(%)
 */
- (void)rtcEngine:(ARtcEngineKit * _Nonnull)engine audioQualityOfUid:(NSString *_Nonnull)uid quality:(ARNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost;
/** 摄像头就绪回调
 提示已成功打开摄像头,可以开始捕获视频。
**Note**
 推荐使用localVideoStateChange回调 state 参数中的 ARLocalVideoStreamStateCapturing(1)。
 @param engine ARtcEngineKit 对象
 */
- (void)rtcEngineCameraDidReady:(ARtcEngineKit * _Nonnull)engine;
/** 视频功能停止回调
 提示视频功能已停止。 App 如需在停止视频后对 view 做其他处理(比如显示其他画面),可以在这个回调中进行。
**Note**
 推荐使用localVideoStateChange回调 state 参数中的 ARLocalVideoStreamStateCapturing(0)。
 @param engine ARtcEngineKit 对象
 */
- (void)rtcEngineVideoDidStop:(ARtcEngineKit * _Nonnull)engine;
@end
#endif /* ARtcEngineDelegate_h */
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcEngineKit.h
New file
@@ -0,0 +1,2143 @@
//
//  ARtcEngineKit.h
//  ARtcKit
//
//  Created by zjq on 2020/3/18.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ARtcEngineDelegate.h"
#import "ARObjects.h"
#import "ARMediaIO.h"
NS_ASSUME_NONNULL_BEGIN
@class ARtcEngineKit;
@class ARtcChannel;
__attribute__((visibility("default"))) @interface ARtcEngineKit : NSObject
//MARK: - 核心方法
/**-----------------------------------------------------------------------------
* @name 核心方法
* -----------------------------------------------------------------------------
*/
/** 实例化ARtcEngineKit对象
该方法初始化一个 ARtcEngineKit 单例。使用 ARtcEngineKit,必须先调用该接口进行初始化。
**Note**
请确保在调用其他 API 前先调用该方法创建并初始化 ARtcEngineKit。 一个 ARtcEngineKit 实例对象只能使用一个 App ID。如需更换 App ID,必须先调用 destroy 销毁当前实例,再调用本方法重新创建实例。
@param appId    ar云平台 为 App 开发者签发的 App ID。每个项目都应该有一个独一无二的 App ID。如果你的开发包里没有 App ID,请从ar云平台官网申请一个新的 App ID。在你调用 joinChannelByToken加入ar云平台的全球网络实现一对一或一对多直播通信时需要:
 * 用 App ID 标示你的项目和所属组织
 * 用一个独一无二的频道名称
@param delegate ARtcEngineDelegate.
@return 一个 ARtcEngineKit 实例对象
*/
+ (instancetype _Nonnull)sharedEngineWithAppId:(NSString *_Nonnull)appId delegate:(id<ARtcEngineDelegate> _Nullable)delegate;
/** 销毁 RtcEngine 实例
 该方法用于释放SDK 使用的所有对象资源。帮助偶尔使用音视频通话的 App 在无需通话时释放资源。一旦 App 调用了 destroy 接口销毁创建的 ARtcEngineKit 实例,将无法调用 SDK 内的任何方法也不再会有任何回调产生。如需重启通话,请调用初始化方法 sharedEngineWithAppId创建一个新的 ARtcEngineKit 实例。
**Note**
 * 该方法需要在子线程中操作
 * 该方法为同步调用。 App 不得在 SDK 生成的回调中调用该方法,不然 SDK 只能等候该回调返回才能重新获取相应的对象资源造成死锁。
 */
+ (void)destroy;
/** 设置频道使用场景
 * 为保证实时音视频质量,我们建议相同频道内的用户使用同一种频道场景。
 * 该方法必须在加入频道前调用,进入频道后无法再设置频道场景。
@param profile   频道使用场景,详见ARChannelProfile。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setChannelProfile:(ARChannelProfile)profile;
/** 设置用户角色
在加入频道前,用户需要通过本方法设置观众(默认)或主播角色。在加入频道后,用户可以通过本方法切换用户角色。
如果你在加入频道后调用该方法切换用户角色,调用成功后,本地会触发 didClientRoleChanged 回调;远端会触发 didJoinedOfUid 或 didOfflineOfUid(ARUserOfflineReasonBecomeAudience) 回调。
**Note**
该方法仅适用于直播场景。
@param role   直播场景里的用户角色,详见ARClientRole:
 * ARClientRoleBroadcaster = 1; 主播
 * ARClientRoleAudience = 2; 观众(默认)
@return 0方法调用成功,<0方法调用失败
*/
- (int)setClientRole:(ARClientRole)role;
/** 加入频道
该方法让用户加入通话频道,在同一个频道内的用户可以互相通话,多个用户加入同一个频道,可以群聊。 使用不同 App ID 的 App 是不能互通的。如果已在通话中,用户必须调用 leaveChannel 退出当前通话,才能进入下一个频道。SDK 在通话中使用 iOS 系统的 AVAudioSession 共享对象进行录音和播放, App 对该对象的操作可能会影响 SDK 的音频相关功能。
调用该 API 后会触发 joinSuccessBlock 或 didJoinChannel 回调。block 比 delegate 优先级高,如果两种回调都实现了,只有 block 会触发。
我们建议你将 joinSuccessBlock 设置为 nil,使用 delegate 回调。
加入频道后,本地会触发 didJoinChannel 回调;通信场景下的用户和直播场景下的主播加入频道后,远端会触发 didJoinedOfUid 回调。
在网络状况不理想的情况下,客户端可能会与 ar云平台 的服务器失去连接;SDK 会自动尝试重连,重连成功后,本地会触发 didRejoinChannel 回调。
**Note**
 * 频道内每个用户的 UID 必须是唯一的。如果将 UID 设为 nil,系统将自动分配一个 UID。如果想要从不同的设备同时接入同一个频道,请确保每个设备上使用的 UID 是不同的。
 * 在加入频道时,SDK 调用 setCategory(AVAudioSessionCategoryPlayAndRecord) 将 AVAudioSession 设置到 PlayAndRecord 模式, App 不应将其设置到其他模式。设置该模式时,正在播放的声音会被打断(比如正在播放的响铃声)。
 @param token 动态密钥
 * 安全要求不高: 将值设为 nil
 * 安全要求高: 将值设置为 Token。如果你已经启用了 App Certificate,请务必使用 Token。
 * 请务必确保用于生成 Token 的 App ID 和 sharedEngineWithappId 方法初始化引擎时用的是同一个 App ID。
 @param channelId 标识通话频道的字符串,长度在 64 字节以内的字符串。
 以下为支持的字符集范围(共 89 个字符):
 * 26 个小写英文字母 a-z
 * 26 个大写英文字母 A-Z
 * 10 个数字 0-9
 * 空格
 * "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
@param uid 用户 ID,建议设置长度1~48,确保uid符合规则,并保证唯一性。如果不填或设置为nil,SDK 会自动分配一个,并在 joinSuccessBlock 回调方法中返回,App 层必须记住该返回值并维护,SDK 不对该返回值进行维护。
 * 26 个小写英文字母 a-z
 * 26 个大写英文字母 A-Z
 * 10 个数字 0-9
@param joinSuccessBlock 成功加入频道回调。joinSuccessBlock 优先级高于 didJoinChannel,2 个同时存在时,didJoinChannel 会被忽略。 需要有 didJoinChannel 回调时,请将 joinSuccessBlock 设置为 nil 。
@return 0方法调用成功,<0方法调用失败
 * ARErrorCodeInvalidArgument(-2)
 * ARErrorCodeNotReady(-3)
 * ARErrorCodeRefused(-5)
*/
- (int)joinChannelByToken:(NSString * _Nullable)token
                channelId:(NSString * _Nonnull)channelId
                      uid:(NSString * _Nullable)uid
              joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSString * _Nonnull uid, NSInteger elapsed))joinSuccessBlock;
/** 快速切换直播频道。
 当直播频道中的观众想从一个频道切换到另一个频道时,可以调用该方法,实现快速切换。
 成功调用该方切换频道后,本地会先收到离开原频道的回调 didLeaveChannelWithStats,再收到成功加入新频道的回调 didJoinChannel。
**Note**
 该方法仅适用直播频道中的观众用户。
 @param token 动态密钥
 * 安全要求不高: 将值设为 nil
 * 安全要求高: 将值设置为 Token。如果你已经启用了 App Certificate,请务必使用 Token。
 * 请务必确保用于生成 Token 的 App ID 和 sharedEngineWithappId 方法初始化引擎时用的是同一个 App ID。
 @param channelId 标识通话频道的字符串,长度在 64 字节以内的字符串。
 以下为支持的字符集范围(共 89 个字符):
 * 26 个小写英文字母 a-z
 * 26 个大写英文字母 A-Z
 * 10 个数字 0-9
 * 空格
 * "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
 @param joinSuccessBlock 成功加入频道回调。joinSuccessBlock 优先级高于 didJoinChannel,2 个同时存在时,didJoinChannel 会被忽略。 需要有 didJoinChannel 回调时,请将 joinSuccessBlock 设置为 nil 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)switchChannelByToken:(NSString * _Nullable)token
                  channelId:(NSString * _Nonnull)channelId
                joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSString *_Nonnull uid, NSInteger elapsed))joinSuccessBlock;
/** 离开频道
离开频道,即挂断或退出通话。
当调用 joinChannelByToken 方法后,必须调用 leaveChannel 结束通话,否则无法开始下一次通话。 不管当前是否在通话中,都可以调用本方法,没有副作用。该方法会把会话相关的所有资源释放掉。该方法是异步操作,调用返回时并没有真正退出频道。
 * 成功调用该方法离开频道后,本地会触发 didLeaveChannelWithStats 回调;
 * 通信场景下的用户和直播场景下的主播离开频道后,远端会触发 didOfflineOfUid(ARUserOfflineReasonBecomeAudience) 回调。
**Note**
- 如果你调用了本方法后立即调用 destroy 方法,SDK 将无法触发 didLeaveChannelWithStats 回调。
- 如果你在旁路推流时调用本方法, SDK 将自动调用 removePublishStreamUrl 方法。
- 在调用本方法时,iOS 默认情况下 SDK 会停用 audio session,可能会对其他应用程序造成影响。如果想改变这种默认行为,可以通过setAudioSessionOperationRestriction 方法设置 ARAudioSessionOperationRestrictionDeactivateSession,这样在 leaveChannel 时,SDK 不会停用 audio session。
 @param leaveChannelBlock 成功离开频道的回调,提供通话相关的统计信息,详见 ARChannelStats
 @return 0方法调用成功,<0方法调用失败
 */
- (int)leaveChannel:(void (^ _Nullable) (ARChannelStats *_Nonnull stat))leaveChannelBlock;
/** 更新 Token
该方法用于更新 Token。如果启用了 Token 机制,过一段时间后使用的 Token 会失效。当以下任意一种情况发生时:
 * tokenPrivilegeWillExpire 回调。
 * connectionChangedToState 回调的 reason 参数报告 ARConnectionChangedTokenExpired(9)。
**Note**
 App 应重新获取 Token,然后调用该 API 更新 Token,否则 SDK 无法和服务器建立连接。
 @param token 新的 Token
 @return 0方法调用成功,<0方法调用失败
 */
- (int)renewToken:(NSString * _Nonnull)token;
/** 获取当前网络连接状态
@return 当前的网络连接状态,详见 ARConnectionStateType。
*/
- (ARConnectionStateType)getConnectionState;
/** 开始跨频道媒体流转发。该方法可用于实现跨频道连麦等场景。
 成功调用该方法后,SDK 会触发 channelMediaRelayStateDidChange 和 didReceiveChannelMediaRelayEvent 回调,并在回调中报告当前的跨频道媒体流转发状态和事件。
 如果 channelMediaRelayStateDidChange 回调报告 ARChannelMediaRelayStateRunning(2) 和 ARChannelMediaRelayStateIdle(0),且 didReceiveChannelMediaRelayEvent 回调报告 ARChannelMediaRelayEventSentToDestinationChannel(4),则表示 SDK 开始在源频道和目标频道之间转发媒体流。
 如果 channelMediaRelayStateDidChange 回调报告 ARChannelMediaRelayStateFailure(3),则表示跨频道媒体流转发出现异常。
**Note**
 - 请在成功加入频道后调用该方法。
 - 该方法仅对直播场景下的主播有效。
 - 成功调用该方法后,若你想再次调用该方法,必须先调用 stopChannelMediaRelay 方法退出当前的转发状态。
 - 跨频道媒体流转发功能需要提交工单联系技术支持开通。
 @param config 跨频道媒体流转发参数配置: ARChannelMediaRelayConfiguration 类。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startChannelMediaRelay:(ARChannelMediaRelayConfiguration * _Nonnull)config;
/** 更新媒体流转发的频道。成功开始跨频道转发媒体流后,如果你希望将流转发到多个目标频道,或退出当前的转发频道,可以调用该方法。
 成功调用该方法后,SDK 会触发 didReceiveChannelMediaRelayEvent 回调,并在回调中报告状态码 ARChannelMediaRelayEventUpdateDestinationChannel(7)。
 **Note**
 - 请在 startChannelMediaRelay 方法后调用该方法,更新媒体流转发的频道。
 - 跨频道媒体流转发最多支持 4 个目标频道。如果直播间里已经有 4 个频道了,你可以在调用该方法之前,调用 ARChannelMediaRelayConfiguration 中的 removeDestinationInfoForChannelName 方法移除不需要的频道。
 @param config 跨频道媒体流转发参数配置: ARChannelMediaRelayConfiguration 类。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)updateChannelMediaRelay:(ARChannelMediaRelayConfiguration * _Nonnull)config;
/** 停止跨频道媒体流转发。一旦停止,主播会退出所有目标频道。
 成功调用该方法后,SDK 会触发 channelMediaRelayStateDidChange 回调。如果报告 ARChannelMediaRelayStateIdle(0) 和 ARChannelMediaRelayErrorNone(0),则表示已停止转发媒体流。
 Note: 如果该方法调用不成功,SDK 会触发 channelMediaRelayStateDidChange 回调,并报告状态码 ARChannelMediaRelayErrorServerNoResponse(2) 或 ARChannelMediaRelayEventUpdateDestinationChannelRefused(8)。你可以调用 leaveChannel 方法离开频道,跨频道媒体流转发会自动停止。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopChannelMediaRelay;
//MARK: - 音频核心方法
/**-----------------------------------------------------------------------------
* @name 音频核心方法
* -----------------------------------------------------------------------------
*/
/** 启用音频模块
 本方法可以启用音频模块,默认开启状态。
**Note**
 * 该方法设置的是内部引擎为开启状态,在频道内和频道外均可调用,且在 leaveChannel 后仍然有效。
 * 该方法重置整个引擎,响应速度较慢,因此 ar云平台 建议使用如下方法来控制音频模块:
    * enableLocalAudio:是否启动麦克风采集并创建本地音频流
    * muteLocalAudioStream:是否发布本地音频流
    * muteRemoteAudioStream:是否接收并播放远端音频流
    * muteAllRemoteAudioStreams:是否接收并播放所有远端音频流
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableAudio;
/** 关闭音频模块
 **Note**
 * 该方法设置的是内部引擎为禁用状态,在频道内和频道外均可调用,且在 leaveChannel 后仍然有效。
 * 该方法重置整个引擎,响应速度较慢,因此建议使用如下方法来控制音频模块:
    - enableLocalAudio:是否启动麦克风采集并创建本地音频流
    - muteLocalAudioStream:是否发布本地音频流
    - muteRemoteAudioStream:是否接收并播放远端音频流
    - muteAllRemoteAudioStreams:是否接收并播放所有远端音频流
 @return 0方法调用成功,<0方法调用失败
 */
- (int)disableAudio;
/** 设置音频编码配置
**Note**
 * 该方法需要在 joinChannelByToken 之前设置好,joinChannelByToken 之后设置不生效。
 * 通信场景下,该方法设置 profile 生效,设置 scenario 不生效。
 * 通信和直播场景下,音质(码率)会有网络自适应的调整,通过该方法设置的是一个最高码率。
 * 在有高音质需求的场景(例如音乐教学场景)中,建议将 profile 设置为 ARAudioProfileMusicHighQuality(4),scenario 设置为 ARAudioScenarioGameStreaming(3)
 @param profile  音频属性,详见ARAudioProfile
 @param scenario 设置音频应用场景,详细定义见 ARAudioScenario。不同的音频场景下,设备的系统音量是不同的。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setAudioProfile:(ARAudioProfile)profile scenario:(ARAudioScenario)scenario;
/** 调节录音音量
 @param volume 录音音量可在 0~400 范围内进行调节:
 * 0: 静音
 * 100: 原始音量
 * 400: 最大可为原始音量的 4 倍(自带溢出保护)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)adjustRecordingSignalVolume:(NSInteger)volume;
/** 调节本地播放的所有远端用户音量
**Note**
- 该方法调节的是本地播放的所有远端用户混音后的音量。
- 静音本地音频需同时调用 adjustPlaybackSignalVolume 和 adjustAudioMixingPlayoutVolume 方法,并将 volume 参数设置为 0。
@param volume 播放音量,取值范围为 [0,400]。
* 0: 静音
* 100: 原始音量
* 400: 最大可为原始音量的 4 倍(自带溢出保护)
@return 0方法调用成功,<0方法调用失败
*/
- (int)adjustPlaybackSignalVolume:(NSInteger)volume;
/** 启用说话者音量提示
@param interval 指定音量提示的时间间隔
 * <= 0: 禁用音量提示功能
 * > 0: 提示间隔,单位为毫秒。建议设置到大于 200 毫秒。最小不得少于 10 毫秒。启用该方法后,无论频道内是否有人说话,都会在 reportAudioVolumeIndicationOfSpeakers回调中按设置的时间间隔返回音量提示
@param smooth 指定音量提示的灵敏度。取值范围为 [0,10],建议值为 3,数字越大,波动越灵敏;数字越小,波动越平滑。
@param report_vad 本地人声检测功能
 * YES:开启本地人声检测功能。开启后, reportAudioVolumeIndicationOfSpeakers 回调的 vad 参数会报告是否在本地检测到人声。
 * NO:(默认)关闭本地人声检测功能。除引擎自动进行本地人声检测的场景外, reportAudioVolumeIndicationOfSpeakers 回调的 vad 参数不会报告是否在本地检测到人声。
@return 0方法调用成功,<0方法调用失败
*/
- (int)enableAudioVolumeIndication:(NSInteger)interval smooth:(NSInteger)smooth report_vad:(BOOL)report_vad;
/** 开关本地音频采集
当用户加入频道时,它的语音功能默认是开启的。该方法可以关闭或重新开启本地语音功能,即停止或重新开启本地音频采集。
该方法不影响接收或播放远端音频流,enableLocalAudio(NO) 适用于只听不发的用户场景。
语音功能关闭或重新开启后,会收到回调 didMicrophoneEnabled。
**Note**
 该方法与 muteLocalAudioStream 的区别在于:
 * enableLocalAudio:开启或关闭本地语音采集及处理。使用 enableLocalAudio 关闭或开启本地采集后,本地听远端播放会有短暂中断。
 * muteLocalAudioStream:停止或继续发送本地音频流。
 @param enabled 开关本地音频采集
 * YES: 重新开启本地语音功能,即开启本地语音采集(默认)
 * NO: 关闭本地语音功能,即停止本地语音采集或处理
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableLocalAudio:(BOOL)enabled;
/** 开关本地音频发送
 该方法用于允许/禁止往网络发送本地音频流。成功调用该方法后,远端会触发 remoteAudioStateChangedOfUid 回调。
**Note**
 * 该方法不影响录音状态,并没有禁用麦克风。
 * 如果你在该方法后调用 setChannelProfile 方法,SDK 会根据你设置的频道场景以及用户角色,重新设置是否停止发送本地音频。因此我们建议在 setChannelProfile 后调用该方法。
 @param mute 是否发送本地音频流
 * YES: 停止发送本地音频流
 * NO: (默认)继续发送本地音频流
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteLocalAudioStream:(BOOL)mute;
/** 停止/恢复接收指定用户的音频流
**Note**
 如果之前有调用过 muteAllRemoteAudioStreams(YES) 对所有远端音频进行静音,在调用本 API 之前请确保你已调用 muteAllRemoteAudioStreams(NO)。 muteAllRemoteAudioStreams 是全局控制,muteRemoteAudioStream 是精细控制。
 @param uid  指定用户的用户 ID
 @param mute 停止/恢复接收指定用户的音频流:
 * YES: 停止接收指定音频流
 * NO: 继续接收指定音频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteRemoteAudioStream:(NSString *_Nonnull)uid mute:(BOOL)mute;
/** 停止/恢复接收所有远端音频流
@param mute YES: 停止接收所有远端音频流;NO: 继续接收所有远端音频流(默认)。
@return 0方法调用成功,<0方法调用失败
*/
- (int)muteAllRemoteAudioStreams:(BOOL)mute;
/** 设置是否默认接收音频流
该方法在加入频道前后都可调用。如果在加入频道后调用 setDefaultMuteAllRemoteAudioStreams (YES),会接收不到设置后加入频道的用户的音频流。
**Note**
 停止接收音频流后,如果想要恢复接收,请调用 muteRemoteAudioStream (NO),并指定你想要接收的远端用户 uid;如果想恢复接收多个用户的音频流,则需要多次调用 muteRemoteAudioStream。setDefaultMuteAllRemoteAudioStreams (NO) 只能恢复接收后面加入频道的用户的音频流。
 @param mute 设置是否默认接收音频流:
 * YES: 默认停止接收所有远端音频流
 * NO: 默认继续接收所有远端音频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDefaultMuteAllRemoteAudioStreams:(BOOL)mute;
/** 调节本地播放的指定远端用户音量
加入频道后,你可以多次调用该方法调节不同远端用户在本地播放的音量,或对某个远端用户在本地播放的音量调节多次。
**Note**
- 该方法要在加入频道后调用。
- 该方法调节的是本地播放的指定远端用户混音后的音量。
- 该方法每次只能调整一位远端用户在本地播放的音量。若需调整多位远端用户在本地播放的音量,则需多次调用该方法。
@param uid 远端用户 ID,需和远端用户加入频道时用的 uid 一致。
@param volume 播放音量,取值范围为 [0,100]。
- 0: 静音
- 100: 原始音量
@return 0方法调用成功,<0方法调用失败
*/
- (int)adjustUserPlaybackSignalVolume:(NSString *_Nonnull)uid volume:(int)volume;
//MARK: - 视频核心方法
/**-----------------------------------------------------------------------------
* @name 视频核心方法
* -----------------------------------------------------------------------------
*/
/** 启用视频模块
该方法用于打开视频模式。可以在加入频道前或者通话中调用,在加入频道前调用,则自动开启视频模式,在通话中调用则由音频模式切换为视频模式。调用 disableVideo 方法可关闭视频模式。
成功调用该方法后,远端会触发 didVideoEnabled(YES) 和 remoteVideoStateChangedOfUid 回调。
**Note**
 * 该方法设置的是内部引擎为启用状态,在 leaveChannel 后仍然有效。
 * 该方法重置整个引擎,响应速度较慢,因此建议使用如下方法来控制视频模块:
    - enableLocalVideo:是否启动摄像头采集并创建本地视频流
    - muteLocalVideoStream:是否发布本地视频流
    - muteRemoteVideoStream:是否接收并播放远端视频流
    - muteAllRemoteVideoStreams:是否接收并播放所有远端视频流
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableVideo;
/**
该方法用于关闭视频。可以在加入频道前或者通话中调用,在加入频道前调用,则自动开启纯音频模式,在通话中调用则由视频模式切换为纯音频模式。调用 enableVideo 方法可开启视频模式。成功调用该方法后,远端会触发 didVideoEnabled(NO) 回调。
- 该方法设置的是内部引擎为启用状态,在 leaveChannel 后仍然有效。
@return 0方法调用成功,<0方法调用失败
*/
/** 关闭视频模块
该方法用于关闭视频。可以在加入频道前或者通话中调用,在加入频道前调用,则自动开启纯音频模式,在通话中调用则由视频模式切换为纯音频模式。调用 enableVideo 方法可开启视频模式。
成功调用该方法后,远端会触发remoteVideoStateChangedOfUid回调。
**Note**
 * 该方法设置的是内部引擎为启用状态,在 leaveChannel 后仍然有效。
 * 该方法重置整个引擎,响应速度较慢,因此建议使用如下方法来控制视频模块:
    - enableLocalVideo:是否启动摄像头采集并创建本地视频流
    - muteLocalVideoStream:是否发布本地视频流
    - muteRemoteVideoStream:是否接收并播放远端视频流
    - muteAllRemoteVideoStreams:是否接收并播放所有远端视频流
 @return 0方法调用成功,<0方法调用失败
 */
- (int)disableVideo;
/** 设置视频编码配置
该方法设置视频编码配置。每个配置对应一套视频参数,如分辨率、帧率、码率、视频方向等。 所有设置的参数均为理想情况下的最大值。当视频引擎因网络环境等原因无法达到设置的分辨率、帧率或码率的最大值时,会取最接近最大值的那个值。
如果加入频道后不需要重新设置视频编码配置,建议在 enableVideo 之前调用该方法,可以加快首帧出图时间。
@param config   视频编码器配置的属性
@return 0方法调用成功,<0方法调用失败
*/
- (int)setVideoEncoderConfiguration:(ARVideoEncoderConfiguration *_Nonnull)config;
/** 初始化本地视图
 该方法初始化本地视图并设置本地用户视频显示信息,只影响本地用户看到的视频画面,不影响本地发布视频。调用该方法绑定本地视频流的显示视窗(view),并设置本地用户视图的渲染模式和镜像模式。在 App 开发中,通常在初始化后调用该方法进行本地视频设置,然后再加入频道。退出频道后,绑定仍然有效,如果需要解除绑定,可以指定空 (nil) view 调用本方法。
**Note**
 * 该方法在加入频道前后都能调用。
 * 如果你希望在通话中更新本地用户视图的渲染或镜像模式,请使用 setLocalRenderMode 方法。
 @param local 通过 ARtcVideoCanvas 设置本地视频显示属性。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setupLocalVideo:(ARtcVideoCanvas *_Nullable)local;
/** 初始化远端用户视图
该方法绑定远端用户和显示视图,并设置远端用户视图在本地显示时的渲染模式和镜像模式,只影响本地用户看到的视频画面。调用该接口时需要指定远端用户的 uid,一般可以在进频道前提前设置好。
如果 App 不能事先知道对方的 uid,可以在 APP 收到 didJoinedOfUid 事件时设置。如果启用了视频录制功能,视频录制服务会做为一个哑客户端加入频道,因此其他客户端也会收到它的 didJoinedOfUid 事件,App 不应给它绑定视图(因为它不会发送视频流),如果 App 不能识别哑客户端,可以在 firstRemoteVideoDecodedOfUid 事件时再绑定视图。解除某个用户的绑定视图可以把 view 设置为空。退出频道后,SDK 会把远端用户的绑定关系清除掉。
**Note**
如果你希望在通话中更新远端用户视图的渲染或镜像模式,请使用 setRemoteRenderMode 方法。
- 该参数默认值为空字符 ""。如果用户是通过 ARtcEngineKit 类的 joinChannelByToken 方法加入频道的,则将参数设为默认值,表示该用户在频道内的渲染视图。
- 如果用户是通过 ARtcChannel 类的 joinChannelByToken 方法加入频道的,则将该参数设为该 ARtcChannel 类对应的 channelId,表示该用户在该 channelId 对应频道内的渲染视图。
 @param remote 通过 ARtcVideoCanvas 设置远端视频显示属性:
 * view 视频显示视窗
 * renderMode: 视频显示模式:
    - ARVideoRenderModeHidden (1):优先保证视窗被填满。因视频尺寸与显示视窗尺寸不一致而多出的视频将被截掉。
    - ARVideoRenderModeFit (2):优先保证视频内容全部显示。因视频尺寸与显示视窗尺寸不一致造成的视窗未被填满的区域填充黑色。
 * uid: 用户 ID,指定要显示视窗的远端用户。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setupRemoteVideo:(ARtcVideoCanvas *_Nonnull)remote;
/** 更新本地视图显示模式
初始化本地用户视图后,你可以调用该方法更新本地用户视图的渲染和镜像模式。该方法只影响本地用户看到的视频画面,不影响本地发布视频。
**Note**
 * 如果你使用前置摄像头,默认启动本地用户视图镜像模式;如果你使用后置摄像头,默认关闭本地视图镜像模式。
 * 请在调用 setupLocalVideo 方法初始化本地视图后,调用该方法。
 * 你可以在通话中多次调用该方法,多次更新本地用户视图的显示模式。
@param renderMode   本地视图的渲染模式,详见 ARVideoRenderMode;
@param mirrorMode   本地视图的镜像模式,详见 ARVideoMirrorMode。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setLocalRenderMode:(ARVideoRenderMode)renderMode mirrorMode:(ARVideoMirrorMode)mirrorMode;
/** 更新远端视图显示模式
初始化远端用户视图后,你可以调用该方法更新远端用户视图在本地显示时的渲染和镜像模式。该方法只影响本地用户看到的视频画面。
**Note**
 * 请在调用 setupRemoteVideo 方法初始化远端视图后,调用该方法。
 * 你可以在通话中多次调用该方法,多次更新远端用户视图的显示模式。
@param uid   用户 ID
@param renderMode   远端用户视图的渲染模式,详见 ARVideoRenderMode ;
@param mirrorMode   远端用户视图的镜像模式,详见 ARVideoMirrorMode,SDK 默认关闭远端用户视图的镜像模式 。
@return 0方法调用成功,<0方法调用失败
*/
- (int)setRemoteRenderMode:(NSString *_Nonnull)uid renderMode:(ARVideoRenderMode)renderMode mirrorMode:(ARVideoMirrorMode)mirrorMode;
/** 开启视频预览
该方法用于在进入频道前启动本地视频预览。本地预览默认开启镜像功能。
调用该 API 前,请调用:
 * 调用 setupLocalVideo 设置预览窗口及属性
 * 调用 enableVideo 开启视频功能
**Note**
启用了本地视频预览后,如果调用 leaveChannel退出频道,本地预览依然处于启动状态,如需要关闭本地预览,需要调用 stopPreview 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startPreview;
/** 停止本地视频预览
@return 0方法调用成功,<0方法调用失败
*/
- (int)stopPreview;
/** 开关本地视频采集
 该方法禁用或重新启用本地视频采集,不影响接收远端视频。
 调用 enableVideo 后,本地视频即默认开启。你可以调用 enableLocalVideo(NO) 关闭本地视频采集。关闭后如果想要重新开启,则可调用 enableLocalVideo(YES)。
 成功禁用或启用本地视频采集后,远端会触发 didLocalVideoEnabled 回调。
**Note**
 该方法设置的是内部引擎为启用/禁用状态,在 leaveChannel 后仍然有效。
 @param enabled 是否启用本地视频:
 * YES: 开启本地视频采集和渲染(默认)
 * NO: 关闭使用本地摄像头设备。关闭后远端用户会接收不到本地用户的视频流;但本地用户依然可以接收远端用户的视频流。设置为 NO 时,该方法不需要本地有摄像头。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableLocalVideo:(BOOL)enabled;
/** 开关本地视频发送
成功调用该方法后,远端会触发 didVideoMuted 回调。你也可以使用 remoteVideoStateChangedOfUid 回调的:
 ARVideoRemoteStateStopped(0) 和 ARVideoRemoteStateReasonRemoteMuted(5)。
 ARVideoRemoteStateDecoding(2) 和 ARVideoRemoteStateReasonRemoteUnmuted(6)。
**Note**
 * 相比于调用 enableLocalVideo 控制本地视频流发送,调用该方法响应速度更快。
 * 该方法不影响视频采集状态,因为没有禁用摄像头。
 * 该方法在加入频道前后都能调用。如果你在该方法后调用 setChannelProfile 方法,SDK 会根据你设置的频道场景以及用户角色,重新设置是否取消发布本地视频。因此我们建议在 setChannelProfile 后调用该方法。
 @param mute 是否发送本地视频流
 * YES: 不发送本地视频流
 * NO: 发送本地视频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteLocalVideoStream:(BOOL)mute;
/** 停止/恢复接收所有视频流
 @param mute 禁止/允许接收所有人的视频流
 * YES: 停止接收所有视频流
 * NO: 允许接收所有视频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteAllRemoteVideoStreams:(BOOL)mute;
/** 停止/恢复接收指定视频流
**Note**
 如果之前有调用过 muteAllRemoteVideoStreams(YES) 暂停接收所有远端视频,在调用本 API 之前请确保你已调用 muteAllRemoteVideoStreams(NO)。 muteAllRemoteVideoStreams 是全局控制,muteRemoteVideoStream 是精细控制。
 @param uid  远端用户ID
 @param mute 停止/恢复接收指定视频流:
 * YES: 停止接收指定用户的视频流
 * NO: 允许接收指定用户的视频流(默认)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)muteRemoteVideoStream:(NSString *_Nonnull)uid mute:(BOOL)mute;
/** 设置是否默认接收视频流
  该方法在加入频道前后都可调用。如果在加入频道后调用setDefaultMuteAllRemoteVideoStreams(YES),会接收不到设置后加入频道的用户的视频流。
  **Note**
 停止接收视频流后,如果想要恢复接收,请调用 muteRemoteVideoStream (NO),并指定你想要接收的远端用户 uid;如果想恢复接收多个用户的视频流,则需要多次调用 muteRemoteVideoStream。setDefaultMuteAllRemoteVideoStreams (NO) 只能恢复接收后面加入频道的用户的视频流。
 @param mute 是否默认接收视频流
 * YES: 不接收
 * NO: 接收
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDefaultMuteAllRemoteVideoStreams:(BOOL)mute;
//MARK: - 视频前处理及后处理
//MARK: - 音频播放路由
/**-----------------------------------------------------------------------------
* @name 音频播放路由
* -----------------------------------------------------------------------------
*/
#if TARGET_OS_IPHONE
/** 设置默认的语音路由
该方法设置接收到的语音从听筒或扬声器出声。如果用户不调用本方法,语音默认从听筒出声。
**Note**
 * 该方法仅使用于通信场景。
 * 该方法只在纯音频模式下工作,在有视频的模式下不工作。
 各频道场景下默认的语音路由:
 * 通信:听筒。
 * 直播:扬声器。
 @param defaultToSpeaker 默认的语音路由:
 * YES: 默认从外放(扬声器)出声。如果设备连接了耳机或蓝牙,则无法切换到外放。
 * NO: (默认)默认从听筒出声。如果设备连接了耳机,则语音路由走耳机。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDefaultAudioRouteToSpeakerphone:(BOOL)defaultToSpeaker;
/** 启用/关闭扬声器播放
该方法设置是否将语音路由到扬声器(外放)。调用该方法后,SDK 将返回 didAudioRouteChanged 回调提示状态已更改。
**Note**
 * 请确保在调用此方法前已调用过 joinChannelByToken 方法。
 * SDK 会调用 setCategory(AVAudioSessionCategoryPlayAndRecord) 并配置耳麦或者外放,所以调用该方法后所有声音的路由都会按照该方法设置。
 @param enableSpeaker 启用/关闭扬声器播放:
 * YES: 切换到外放。如果设备连接了耳机或蓝牙,则无法切换到外放。
 * NO: 切换到听筒。如果设备连接了耳机,则语音路由走耳机。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setEnableSpeakerphone:(BOOL)enableSpeaker;
/** 查询扬声器启用状态
 @return 扬声器状态:
 * YES: 扬声器已开启,语音会输出到扬声器
 * NO: 扬声器未开启,语音会输出到非扬声器(听筒、耳机等)
 */
- (BOOL)isSpeakerphoneEnabled;
#endif
#if TARGET_OS_IPHONE
//MARK: - 耳返设置
/**-----------------------------------------------------------------------------
* @name 耳返设置
* -----------------------------------------------------------------------------
*/
/** 开启耳返功能
**Note**
 用户必须使用有线耳机才能听到耳返效果
 @param enabled 开启或关闭耳返功能:
 * YES: 开启耳返功能
 * NO: 关闭耳返功能(默认)
 @return 0方法调用成功,<0方法调用失败
  */
- (int)enableInEarMonitoring:(BOOL)enabled;
/** 设置耳返音量
 @param volume 设置耳返音量,取值范围在 [0,100]。默认值为 100
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setInEarMonitoringVolume:(NSInteger)volume;
#endif
//MARK: - 语音音效设置
/**-----------------------------------------------------------------------------
 * @name 美声与音效
 * -----------------------------------------------------------------------------
 */
/** 设置本地语音音调
 该方法改变本地说话人声音的音调。该方法在加入频道前后都能调用。
 @param pitch  语音频率。可以在 [0.5,2.0] 范围内设置。取值越小,则音调越低。默认值为 1.0,表示不需要修改音调。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setLocalVoicePitch:(double)pitch;
/** 设置本地语音音效均衡
 @param bandFrequency 频谱子带索引,取值范围是 [0,9],分别代表 10 个 频带,对应的中心频率是 [31,62,125,250,500,1k,2k,4k,8k,16k] Hz,详见 ARAudioEqualizationBandFrequency 。
 @param gain  每个 band 的增益,单位是 dB,每一个值的范围是 [-15,15],默认值为 0。
 @return 0方法调用成功,<0方法调用失败
*/
-(int)setLocalVoiceEqualizationOfBandFrequency:(ARAudioEqualizationBandFrequency)bandFrequency withGain:(NSInteger)gain;
/** 设置本地音效混响
 提供一个使用更为简便的接口 setLocalVoiceReverbPreset,通过一系列内置参数的调整,直接实现流行、R&B、摇滚、嘻哈等预置的混响效果。
 该方法在加入频道前后都能调用。
 @param reverbType 混响音效类型,详见 ARAudioReverbType
 @param value     设置混响音效的效果数值,各混响音效对应的取值范围请参考 ARAudioReverbType
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setLocalVoiceReverbOfType:(ARAudioReverbType)reverbType withValue:(NSInteger)value;
/** 设置本地语音混响(含虚拟立体声效果)。
**Note:**
 当使用以 ARAudioReverbPresetFx 为前缀的枚举值时,请确保在调用该方法前将 setAudioProfile 的 profile 参数设置为 ARAudioProfileMusicHighQuality(4) 或 ARAudioProfileMusicHighQualityStereo(5),否则该方法设置无效。
 当使用 ARAudioReverbPresetVirtualStereo 时,AR 推荐在调用该方法前将 setAudioProfile 的 profile 参数设置为 ARAudioProfileMusicHighQualityStereo(5)。
 该方法对人声的处理效果最佳,AR 不推荐调用该方法处理含人声和音乐的音频数据。
 该方法不能与 setLocalVoiceChanger 方法一同使用,否则先调的方法会不生效。更多注意事项,详见《变声与混响》。
 @param reverbPreset 本地语音混响选项,默认值为 ARAudioReverbPresetOff,即原声。详见 ARAudioReverbPreset。
 @return 0: 方法调用成功。< 0: 方法调用失败。请检查输入的枚举值是否正确。
 */
- (int)setLocalVoiceReverbPreset:(ARAudioReverbPreset)reverbPreset;
//MARK: - 音乐文件播放及混音设置
/**-----------------------------------------------------------------------------
* @name 音乐文件播放及混音设置
* -----------------------------------------------------------------------------
*/
/** 开始播放音乐文件
 指定本地或在线音频文件来和麦克风采集的音频流进行混音或替换。替换是指用指定的音频文件替换麦克风采集到的音频流。该方法可以选择是否让对方听到本地播放的音频,并指定循环播放的次数。
 成功调用该方法后,本地会触发 localAudioMixingStateDidChanged(ARAudioMixingStatePlaying) 回调。播放结束后,会收到 localAudioMixingStateDidChanged(ARAudioMixingStateStopped) 回调。
**Note**
 * 使用本方法前请确保你的 iOS 设备版本不低于 9.0。
 * 请在频道内调用该方法,如果在频道外调用该方法可能会出现问题。
 * 如果播放的是在线音乐文件,请确保重复调用该 API 的间隔超过 100 ms,否则 SDK 会返回 AudioFileOpenTooFrequent(702)警告码,表示音乐文件打开过于频繁。
 * 如果本地音乐文件不存在、文件格式不支持、无法访问在线音乐文件 URL 都会返回警告码 ARWarningCodeAudioMixingOpenError = 701。
 @param filePath 指定需要混音的音频文件名和文件路径名,例如: /var/mobile/Containers/Data/audio.mp4。建议填写文件后缀名。若无法确定文件后缀名,可不填。支持以下音频格式: mp3,aac,m4a,3gp,wav
 @param loopback 设置哪些用户可以听到音频混合:
 * YES: 只有本地可以听到混音或替换后的音频流
 * NO: 本地和对方都可以听到混音或替换后的音频流
 @param replace 设置混音麦克风内容:
 * YES: 只推送设置的本地音频文件或者线上音频文件,不传输麦克风收录的音频。
 * NO: 音频文件内容将会和麦克风采集的音频流进行混音
 @param cycle 指定音频文件循环播放的次数:
 * 正整数: 循环的次数
 * -1:无限循环
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startAudioMixing:(NSString *  _Nonnull)filePath
               loopback:(BOOL)loopback
                replace:(BOOL)replace
                  cycle:(NSInteger)cycle;
/** 停止播放音乐文件
 请在频道内调用该方法。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopAudioMixing;
/** 暂停播放音乐文件
 请在频道内调用该方法。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)pauseAudioMixing;
/** 恢复播放音乐文件
 请在频道内调用该方法。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)resumeAudioMixing;
/** 调节音乐文件的播放音量
**Note**
 该方法调节混音的音乐文件在本地和远端播放的音量大小。请在频道内调用该方法。
 @param volume 音乐文件播放音量范围为 0~100。默认 100 为原始文件音量
 @return 0方法调用成功,<0方法调用失败
 */
- (int)adjustAudioMixingVolume:(NSInteger)volume;
/** 调节音乐文件在本地播放的音量
**Note**
该方法调节混音的音乐文件在本地播放的音量大小。请在频道内调用该方法。
@param volume 音乐文件播放音量范围为 0~100。默认 100 为原始文件音量
@return 0方法调用成功,<0方法调用失败
*/
- (int)adjustAudioMixingPlayoutVolume:(NSInteger)volume;
/** 调节音乐文件在远端播放的音量
音乐文件播放音量范围为 0~100。默认 100 为原始文件音量
@param volume 该方法调节混音的音乐文件在远端播放的音量大小。请在频道内调用该方法。
@return 0方法调用成功,<0方法调用失败
*/
- (int)adjustAudioMixingPublishVolume:(NSInteger)volume;
/** 获取音乐文件的本地播放音量
该方法获取混音的音乐文件本地播放音量,方便排查音量相关问题。
 @return 方法调用成功则返回音量值,范围为 [0,100]。<0:方法调用失败
*/
- (int)getAudioMixingPlayoutVolume;
/** 获取音乐文件的远端播放音量
该方法获取混音的音乐文件远端播放音量,方便排查音量相关问题。
 @return 方法调用成功则返回音量值,范围为 [0,100]。<0:方法调用失败
*/
- (int)getAudioMixingPublishVolume;
//MARK: - 音效文件播放管理
/**-----------------------------------------------------------------------------
* @name 音效文件播放管理
* -----------------------------------------------------------------------------
*/
/** 获取音效文件播放音量
@return 方法调用成功返回音效的音量值,范围为 [0.0,100.0],< 0: 方法调用失败
 */
- (double)getEffectsVolume;
/** 设置音效文件播放音量
 @param volume 取值范围为 [0.0,100.0]。 100.0 为默认值
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setEffectsVolume:(double)volume;
/** 实时调整音效文件播放音量
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @param volume 取值范围为 [0.0,100.0]。100.0 为默认值
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setVolumeOfEffect:(int)soundId
              withVolume:(double)volume;
/** 播放指定音效文件
该方法可以播放指定的本地或在线音效文件来给应用增加音效,比如游戏中特定操作的音效。
你可以在该方法中设置音效文件的播放次数、音调、音效的空间位置和增益,以及远端用户是否能听到该音效。你可以多次调用该方法,通过传入不同的音效文件的 soundID 和 filePath,同时播放多个音效文件,实现音效叠加。为获得最佳用户体验,我们建议同时播放的音效文件不要超过 3 个。
调用该方法播放音效结束后,会触发 rtcEngineDidAudioEffectFinish 回调。
**Note**
 macOS 上不支持同时播放多个在线音效文件。
 @param soundId 自行设定的音效 ID,需保证唯一性。 如果你已通过 preloadEffect 将音效加载至内存,确保这里设置的 soundId 与 preloadEffect 设置的 soundId 相同。
 @param filePath 指定音效文件的绝对路径或 URL 地址(包含文件后缀名),例如:/var/mobile/Containers/Data/audio.mp4。支持以下音频格式: mp3、mp4、aac、m4a、3gp、wav。
 @param loopCount 设置音效文件循环播放的次数:
 * 0: 播放音效文件一次
 * 1: 循环播放音效文件两次
 * -1: 无限循环播放音效文件,直至调用 stopEffect 或 stopAllEffects 后停止
 @param pitch 设置音效的音调 取值范围为 [0.5,2]。默认值为 1.0,表示不需要修改音调。取值越小,则音调越低
 @param pan 设置音效的空间位置。取值范围为 [-1.0,1.0]:
 * 0.0: 音效出现在正前方
 * 1.0: 音效出现在右边
 * -1.0: 音效出现在左边
 @param gain 设置音效的音量。取值范围为 [0.0,100.0]。默认值为 100.0。取值越小,则音效的音量越低。
 @param publish 设置是否将音效传到远端
 * YES: 音效文件在本地播放的同时,会发布到 ar云平台 云上,因此远端用户也能听到该音效
 * NO: 音效文件不会发布到ar云平台云上,因此只能在本地听到该音效
 @return 0方法调用成功,<0方法调用失败
 */
- (int)playEffect:(int)soundId
         filePath:(NSString * _Nullable)filePath
        loopCount:(int)loopCount
            pitch:(double)pitch
              pan:(double)pan
             gain:(double)gain
          publish:(BOOL)publish;
/** 停止播放指定音效文件
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopEffect:(int)soundId;
/** 停止播放所有音效文件
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopAllEffects;
/** 将指定音效文件预加载至内存
 为保证通信畅通,请注意控制预加载音效文件的大小,并在 joinChannelByToken 前就使用该方法完成音效预加载。
 音效文件支持以下音频格式: mp3,aac,m4a,3gp,wav
**Note**
 该方法不支持在线音效文件。
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @param filePath 音效文件的绝对路径
 @return 0方法调用成功,<0方法调用失败
 */
- (int)preloadEffect:(int)soundId
            filePath:(NSString * _Nullable)filePath;
/** 从内存释放某个预加载的音效文件
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)unloadEffect:(int)soundId;
/** 暂停音效文件播放
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)pauseEffect:(int)soundId;
/** 暂停所有音效文件播放
 @return 0方法调用成功,<0方法调用失败
 */
- (int)pauseAllEffects;
/** 恢复播放指定音效文件
 @param soundId 自行设定的音效 ID,需保证唯一性。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)resumeEffect:(int)soundId;
/** 恢复播放所有音效文件
 @return 0方法调用成功,<0方法调用失败
 */
- (int)resumeAllEffects;
//MARK: - 音频录制
/**-----------------------------------------------------------------------------
 * @name 音频录制
 * -----------------------------------------------------------------------------
 */
/** 开始客户端录音
SDK 支持通话过程中在客户端进行录音。调用该方法后,你可以录制频道内所有用户的音频,并得到一个包含所有用户声音的录音文件。录音文件格式可以为:
 - .wav: 文件大,音质保真度较高。
 - .aac: 文件小,音质保真度较低。
**Note**
 - 请确保你在该方法中指定的路径存在并且可写。
 - 该接口需在 joinChannelByToken 之后调用。如果调用 leaveChannel 时还在录音,录音会自动停止。
 - 为保证录音效果,当 sampleRate 设为 44100 Hz 或 48000 Hz 时,建议将 quality 设为 ARAudioRecordingQualityMedium 或 ARAudioRecordingQualityHigh 。
 @param filePath 录音文件在本地保存的绝对路径,由用户自行指定,需精确到文件名及格式,例如:/var/mobile/Containers/Data/audio.aac。
 @param sampleRate 录音采样率(Hz),可以设为以下值:
 - 16000
 - (Default) 32000
 - 44100
 - 48000
 @param quality 录音音质。详见 ARAudioRecordingQuality 。
  @return 0方法调用成功,<0方法调用失败
 */
- (int)startAudioRecording:(NSString * _Nonnull)filePath
                   sampleRate:(NSInteger)sampleRate
                   quality:(ARAudioRecordingQuality)quality;
/** 停止客户端录音
**Note:**
 该接口需要在 leaveChannel 之前调用,不然会在调用 leaveChannel 时自动停止。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopAudioRecording;
//MARK: - 开启声卡采集
//MARK: - 音频其他方法
//MARK: - 网络相关测试
/**-----------------------------------------------------------------------------
 * @name 网络相关测试
 * -----------------------------------------------------------------------------
 */
/** 开始语音通话回路测试
 该方法启动语音通话测试,目的是测试系统的音频设备(耳麦、扬声器等)和网络连接是否正常。在测试过程中,用户先说一段话,声音会在设置的时间间隔后回放出来。如果用户能正常听到自己刚才说的话,就表示系统音频设备和网络连接都是正常的。
**Note:**
- 请在加入频道前调用该方法。
- 调用该方法后必须调用 stopEchoTest 以结束测试,否则不能进行下一次回声测试,也无法加入频道。
- 直播场景下,该方法仅能由用户角色为主播的用户调用。
@param interval 返回语音通话回路测试结果的时间间隔,取值范围为 [2,10],单位为秒,默认值为 10 秒。
@param successBlock 成功开始语音通话测试回调。
@return 0方法调用成功,<0方法调用失败
*/
- (int)startEchoTestWithInterval:(NSInteger)interval successBlock:(void(^ _Nullable)(NSString * _Nonnull channel, NSString * _Nonnull uid, NSInteger elapsed))successBlock;
/** 停止语音通话回路测试
 @return 0方法调用成功,<0方法调用失败,如 ERR_REFUSED (-5):不能停止测试,可能语音通话测试没有成功启动。
 */
- (int)stopEchoTest;
/** 启动网络测试
 该方法启用网络连接质量测试,用于检测用户网络接入质量。默认该功能为关闭状态。
 该方法主要用于以下场景:
 - 用户加入频道前,可以调用该方法判断和预测目前的上行网络质量是否足够好。
 - 直播场景下,当用户角色想由观众切换为主播时,可以调用该方法判断和预测目前的上行网络质量是否足够好。
 启用该方法会消耗一定的网络流量,影响通话质量,因此我们建议不要和 startLastmileProbeTest 同时使用。
 在收到 lastmileQuality 回调后须调用 disableLastmileTest 停止测试,再加入频道或切换用户角色。
**Note:**
 - 调用该方法后,在收到 lastmileQuality 回调之前请不要调用其他方法,否则可能会由于 API 操作过于频繁导致此回调无法执行。
 - 直播场景下,主播在加入频道后请勿调用该方法。
 - 加入频道前调用该方法检测网络质量后,SDK 会占用一路视频的带宽,码率与 setVideoEncoderConfiguration 中设置的码率相同。加入频道后,无论是否调用了 disableLastmileTest,SDK 均会自动停止带宽占用。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableLastmileTest;
/** 关闭网络测试
 @return 0方法调用成功,<0方法调用失败
 */
- (int)disableLastmileTest;
/** 开始通话前网络质量探测
 开始通话前网络质量探测,向用户反馈上下行网络的带宽、丢包、网络抖动和往返时延数据。
 启用该方法后,SDK 会依次返回如下 2 个回调:
 lastmileQuality,视网络情况约 2 秒内返回。该回调通过打分反馈上下行网络质量,更贴近用户的主观感受。
 lastmileProbeResult,视网络情况约 30 秒内返回。该回调通过具体数据反馈上下行网络质量,更加客观。
 该方法主要用于以下两种场景:
 - 用户加入频道前,可以调用该方法判断和预测目前的上行网络质量是否足够好。
 - 直播场景下,当用户角色想由观众切换为主播时,可以调用该方法判断和预测目前的上行网络质量是否足够好。
**Note:**
 - 该方法会消耗一定的网络流量,影响通话质量,因此我们建议不要和 enableLastmileTest 同时使用。
 - 调用该方法后,在收到 lastmileQuality 和 lastmileProbeResult 回调之前请不要调用其他方法,否则可能会由于 API 操作过于频繁导致此方法无法执行。
 - 直播场景下,如果本地用户为主播,请勿在加入频道后调用该方法。
@param config Last mile 网络探测配置,详见 ARLastmileProbeConfig
@return 0方法调用成功,<0方法调用失败
*/
- (int)startLastmileProbeTest:(ARLastmileProbeConfig *_Nullable)config;
/** 停止通话前网络质量探测
@return 0方法调用成功,<0方法调用失败
*/
- (int)stopLastmileProbeTest;
//MARK: - 自定义视频模块
/**-----------------------------------------------------------------------------
 * @name 自定义视频模块
 * -----------------------------------------------------------------------------
*/
/** 设置自定义视频源
该方法设置视频源。实时通讯过程中,ar云平台 SDK 通常会启动默认的视频输入设备,即内置的摄像头,进行视频推流。当需要自定义视频设备时,App 可以先通过 ARVideoSourceProtocol 自定义视频源,然后调用该方法将自定义的视频源加入到 SDK 中。
 @param videoSource 自定义的视频源,详见 ARVideoSourceProtocol
 */
- (void)setVideoSource:(id<ARVideoSourceProtocol> _Nullable)videoSource;
/** 本地自定义视频渲染器
 该方法设置本地视频渲染器。实时通讯过程中, SDK 通常会启动默认的视频渲染器进行视频渲染。当需要自定义视频渲染设备时,App 可以先通过 ARVideoSinkProtocol 自定义渲染器,然后调用该方法将视频渲染器加入到 SDK 中。
 该方法在加入频道前后都能调用。
 @param videoRenderer 自定义的视频渲染器,详见 ARVideoSinkProtocol
 */
- (void)setLocalVideoRenderer:(id<ARVideoSinkProtocol> _Nullable)videoRenderer;
/** 远端自定义视频渲染器
 实时音视频互动过程中,SDK 通常会启动默认的视频渲染器进行视频渲染。当需要自定义视频渲染设备时,App 可以先通过 ARVideoSinkProtocol 自定义渲染器,然后调用该方法将视频渲染器加入到 SDK 中。
 该方法在加入频道前后都能调用。如果在加入频道前调用,需要自行维护远端用户的 uid。
 @param videoRenderer 自定义的视频渲染器,详见 ARVideoSinkProtocol
 @param uid 远端用户的 uid
 */
- (void)setRemoteVideoRenderer:(id<ARVideoSinkProtocol> _Nullable)videoRenderer forUserId:(NSString * _Nonnull)uid;
/** 获取当前视频源
  @return 当前视频源,详见ARVideoSourceProtocol.
 */
- (id<ARVideoSourceProtocol> _Nullable)videoSource;
/** 获取本地视频渲染器
 @return 本地视频渲染器。 详见ARVideoSinkProtocol.
 */
- (id<ARVideoSinkProtocol> _Nullable)localVideoRenderer;
/** 获取远端视频渲染器
 @param uid 远端用户的 uid
 @return 远端视频渲染器。 详见 ARVideoSinkProtocol.
 */
- (id<ARVideoSinkProtocol> _Nullable)remoteVideoRendererOfUserId:(NSString * _Nonnull)uid;
//MARK: - 音频自渲染
//MARK: - 音频自采集 (仅适用于 push 模式)
/**-----------------------------------------------------------------------------
 * @name 音频自采集 (仅适用于 push 模式)
 * -----------------------------------------------------------------------------
 */
/** 开启外部音频采集
 该方法必须在加入频道前调用
 @param sampleRate       外部音频源的采样率 (Hz),可设置为 8000,16000,32000,44100 或 48000
 @param channelsPerFrame 外部音频源的通道数,可设置为 1 或 2:
 * 1: 单声道
 * 2: 双声道
**Note:**
该方法必须在 joinChannelByToken 和 startPreview 前调用
 */
- (void)enableExternalAudioSourceWithSampleRate:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame;
/** 关闭外部音频采集
*/
- (void)disableExternalAudioSource;
/** 推送外部音频帧
 @param data     外部音频数据
 @param samples   音频帧的样本数量
 @param timestamp 外部音频帧的时间戳。该参数为必填。你可以使用该时间戳还原音频帧顺序;在有视频的场景中(包含使用外部视频源的场景),该参数可以帮助实现音视频同步。
 @return YES方法调用成功,NO方法调用失败
 */
- (BOOL)pushExternalAudioFrameRawData:(void *_Nonnull)data samples:(NSUInteger)samples timestamp:(NSTimeInterval)timestamp;
/** 推送外部 CMSampleBuffer 音频帧
 @param sampleBuffer 采样缓冲区
 @return YES方法调用成功,NO方法调用失败
 */
- (BOOL)pushExternalAudioFrameSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer type:(ARAudioType)type;
//MARK: - 视频自采集 (仅适用于 push 模式)
/**-----------------------------------------------------------------------------
 * @name 视频自采集 (仅适用于 push 模式)
 * -----------------------------------------------------------------------------
 */
/** 配置外部视频源
 如果使用了外部视频源,请在调用 enableVideo 或 startPreview 之前调用此 API。
 @param enable 是否使用外部视频源:
 * YES: 使用外部视频源
 * NO: 不使用外部视频源(默认)
 @param useTexture 是否使用 Texture 作为输入:
 * YES: 使用 Texture 作为输入
 * NO: 不使用 Texture 作为输入
 @param pushMode 是否外部视频源需要调用 pushExternalVideoFrame 将视频帧主动推送给 ar云平台SDK:
 * YES: 使用推送 (push) 模式
 * NO: 使用拉 (pull) 模式(暂不支持)
 **Note:**
 该方法需要在加入频道前调用。
 */
- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture pushMode:(BOOL)pushMode;
/** 推送外部视频帧
该方法主动将视频帧数据用 ARVideoFrame 类封装后传递给 SDK。请确保在你调用本方法前已调用 setExternalVideoSource,并将参数 pushMode 设为 YES,不然调用本方法后会一直报错。
 @param frame 该视频帧包含待 ar云平台SDK 编码的视频数据,详见 ARVideoFrame
 @return YES: 该帧推送成功 NO: 该帧推送不成功
 */
- (BOOL)pushExternalVideoFrame:(ARVideoFrame * _Nonnull)frame;
//MARK: - 原始音频数据处理
//MARK: - 直播视频水印
//MARK: - 直播音视频流回退
/**-----------------------------------------------------------------------------
 * @name 直播音视频流回退
 * -----------------------------------------------------------------------------
 */
/** 设置弱网条件下订阅的音视频流回退选项
 网络不理想的环境下,订阅音视频的质量都会下降。使用该接口开启订阅音视频流的回退选项后,SDK 会在下行弱网且音视频质量严重受影响时,将视频流切换为小流,或关断视频流,从而保证或提高通信质量。同时 SDK 会持续监控网络质量,并在网络质量改善时恢复音视频流。当远端订阅流回退为音频流时,或由音频流恢复为音视频流时,SDK 会触发远端订阅流已回退为音频流回调。
 @param option 订阅音视频流的回退选项,默认为弱网时回退到视频小流,详见 ARStreamFallbackOptions
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setRemoteSubscribeFallbackOption:(ARStreamFallbackOptions)option;
//MARK: - 视频双流模式
/**-----------------------------------------------------------------------------
* @name 视频双流模式
* -----------------------------------------------------------------------------
*/
/** 开关视频双流模式
@param enabled   YES双流模式,NO单流模式,默认单流模式
@return 0方法调用成功,<0方法调用失败
*/
- (int)enableDualStreamMode:(BOOL)enabled;
/** 设置订阅的视频流类型
 如果发送端选择发送视频双流(大流或小流),接收端可以选择接收大流还是小流。其中大流可以理解为高分辨率高码率的视频流,小流则是低分辨率低码率的视频流。该方法可以根据视频窗口的大小动态调整对应视频流的大小,以节约带宽和计算资源。
@param uid   用户 ID
@param streamType   设置视频流大小,详见ARVideoStreamType
@return 0方法调用成功,<0方法调用失败
*/
- (int)setRemoteVideoStream:(NSString *_Nonnull)uid type:(ARVideoStreamType)streamType;
/** 设置默认订阅的视频流类型
 @param streamType 设置默认接收的视频流类型,详见 ARVideoStreamType 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setRemoteDefaultVideoStreamType:(ARVideoStreamType)streamType;
//MARK: - 加密
/**-----------------------------------------------------------------------------
 * @name 加密
 * -----------------------------------------------------------------------------
 */
/** Enables/Disables the built-in encryption.
 在安全要求较高的场景下,建议你在加入频道前,调用 enableEncryption 方法开启内置加密。
 同一频道内所有用户必须使用相同的加密模式和密钥。一旦所有用户都离开频道,该频道的加密密钥会自动清除。
 **Note**
 - 如果开启了内置加密,则不能使用 RTMP/RTMPS 推流功能。
 - anyRTC 支持 4 种加密模式。除 SM4_128_ECB 模式外,其他加密模式都需要在集成 iOS SDK 时,额外添加加密库文件。详见《媒体流加密》。
 @param enabled 是否开启内置加密:
 - YES: 开启
 - NO: 关闭
 @param config 配置内置加密模式和密钥。详见 AREncryptionConfig 。
 @return 0方法调用成功,<0方法调用失败
 -2 (ARErrorCodeInvalidArgument): 调用了无效的参数。需重新指定参数。
 -7 (ARErrorCodeNotInitialized): SDK 尚未初始化。需在调用 API 之前已创建 ARRtcEngineKit 对象并完成初始化。
 -4 (ARErrorCodeNotSupported): 设置的加密模式不正确或加载外部加密库失败。需检查枚举值是否正确或重新加载外部加密库。
 */
- (int)enableEncryption:(bool)enabled encryptionConfig:(AREncryptionConfig *)config;
//MARK: - 直播输入在线媒体流
/**-----------------------------------------------------------------------------
 * @name 直播输入在线媒体流
 * -----------------------------------------------------------------------------
 */
/** 输入在线媒体流 URL
 该方法通过在服务端拉取视频流并发送到频道中,将正在播放的视频输入到正在进行的直播中。可主要应用于赛事直播、多人看视频互动等直播场景。
 调用该方法后,SDK 会在本地触发 streamInjectedStatusOfUrl 回调,报告输入在线媒体流的状态。
 成功输入媒体流后,该音视频流会出现在频道中,频道内所有用户都会收到 didJoinedOfUid 回调,其中 uid 为 "share666"。
**Note:**
 - 频道内同一时间只允许输入一个在线媒体流。
 - 请确保已开通旁路推流的功能,详见前提条件。
 @param url    添加到直播中的视频流 URL 地址, 支持 RTMP, HLS, HTTP-FLV 协议传输。
 - 支持的音频编码格式:AAC。
 - 支持的视频编码格式:H264 (AVC)。
 @param config 输入的视频流设置,详见 ARLiveInjectStreamConfig 。
@return 0方法调用成功,<0方法调用失败
    - ARErrorCodeInvalidArgument(-2):输入的 URL 为空。请重新调用该方法,并确认输入的媒体流的 URL 是有效的。
    - ARErrorCodeNotInitialized(-7):引擎没有初始化。请确认调用该方法前已创建 RtcEngine 对象并完成初始化。
    - ARErrorCodeNotSupported(-4):频道非直播场景。请调用 setChannelProfile 并将频道设置为直播场景再调用该方法。
    - ARErrorCodeNotReady(-3):用户没有加入频道。
*/
- (int)addInjectStreamUrl:(NSString * _Nonnull)url config:(ARLiveInjectStreamConfig * _Nonnull)config;
/** 删除输入的在线媒体流
 成功删除后会触发 didOfflineOfUid 回调,UID 为  "share666"。
 @param url 已输入、待删除的在线媒体流 URL 地址
 @return 0方法调用成功,<0方法调用失败
 */
- (int)removeInjectStreamUrl:(NSString * _Nonnull)url;
//MARK: - CDN 旁路推流
/**-----------------------------------------------------------------------------
 * @name CDN 旁路推流
 * -----------------------------------------------------------------------------
 */
/** 增加旁路推流地址
 该方法用于添加旁路推流地址,调用该方法后,SDK 会在本地触发 rtmpStreamingChangedToState 回调,报告增加旁路推流地址的状态。
 **Note:**
 - 该方法仅适用于直播场景。
 - 请确保在成功加入频道后再调用该接口。
 - 请确保已开通旁路推流的功能
 - 该方法每次只能增加一路旁路推流地址。若需推送多路流,则需多次调用该方法
 @param url CDN 推流地址,格式为 RTMP。该字符串长度不能超过 1024 字节。URL 不支持中文等特殊字符。
 @param transcodingEnabled 是否转码:
 - YES: 转码(转码是指在旁路推流时对音视频流做一些转码处理后再推送到其他 RTMP 服务器,常见的适用场景是对多主播进行混流、合图)。如果设为 YES,需先调用 setLiveTranscoding 方法。
 - NO: 不转码。
 @return 0方法调用成功,<0方法调用失败
  - ARErrorCodeInvalidArgument(-2):参数无效,一般是 URL 为空或是长度为 0 的的字符串
  - ARErrorCodeNotInitialized(-7):推流时未初始化引擎
 */
- (int)addPublishStreamUrl:(NSString * _Nonnull)url transcodingEnabled:(BOOL)transcodingEnabled;
/** 删除旁路推流地址
 该方法用于删除旁路推流过程中已经设置的 RTMP 推流地址。调用该方法后,SDK 会在本地触发 rtmpStreamingChangedToState 回调,报告删除旁路推流地址的状态。
**Note:**
 * 该方法仅适用于直播场景。
 * 该方法每次只能删除一路旁路推流地址。若需删除多路流,则需多次调用该方法。
 * URL 不支持中文等特殊字符。
 @param url 待删除的推流地址,格式为 RTMP。该字符串长度不能超过 1024 字节
 @return 0方法调用成功,<0方法调用失败
 */
- (int)removePublishStreamUrl:(NSString * _Nonnull)url;
/** 设置直播转码
 该方法用于旁路推流的视图布局及音频设置等。调用该方法更新转码设置后本地会触发 rtcEngineTranscodingUpdated 回调。
 **Note**
 - 该方法仅适用于直播场景。
 - 请确保已开通 CDN 旁路推流的功能
 - 首次调用该方法更新转码设置时,不会触发 rtcEngineTranscodingUpdated 回调。
 @param transcoding 一个 ARLiveTranscoding 的对象,详细设置见 ARLiveTranscoding 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setLiveTranscoding:(ARLiveTranscoding *_Nullable)transcoding;
//MARK: - 数据流
/**-----------------------------------------------------------------------------
 * @name 数据流
 * -----------------------------------------------------------------------------
 */
/** 创建数据流
 该方法用于创建数据流。ARtcEngineKit 生命周期内,每个用户最多只能创建 5 个数据流。频道内数据通道最多允许数据延迟 5 秒,若超过 5 秒接收方尚未收到数据流,则数据通道会向 App 报错。 目前Native SDK 支持 99% 可靠和 100% 有序的数据传输。
**Note:**
 请将 reliable 和 ordered 同时设置为 YES 或 NO,暂不支持交叉设置。
 @param streamId 数据流 ID
 @param reliable 设置是否保证接收方在5秒内接收到发送方的数据流:
 - YES: 接收方 5 秒内会收到发送方所发送的数据,否则会收到 didOccurStreamMessageError 回调获得相应报错信息。
 - NO: 接收方不保证收到,就算数据丢失也不会报错。
 @param ordered  设置接收方是否收到发送顺序中的数据流:
 - YES: 接收方 5 秒内会按照发送方发送的顺序收到数据包。
 - NO: 接收方不保证按照发送方发送的顺序收到数据包
 @return 0方法调用成功,<0方法调用失败
*/
- (int)createDataStream:(NSInteger * _Nonnull)streamId reliable:(BOOL)reliable ordered:(BOOL)ordered;
/** 发送数据流
 该方法发送数据流消息到频道内所有用户。SDK 对该方法的实现进行了如下限制:频道内每秒最多能发送 30 个包,且每个包最大为 1 KB。 每个客户端每秒最多能发送 6 KB 数据。频道内每人最多能同时有 5 个数据通道。
 成功调用该方法后,远端会触发 receiveStreamMessageFromUid 回调,远端用户可以在该回调中获取接收到的流消息;若调用失败,远端会触发 didOccurStreamMessageErrorFromUid 回调。
 **Note:**
 - 该方法仅适用于通信场景以及直播场景下的主播用户,如果直播场景下的观众调用此方法可能会造成观众变主播。
 - 请确保在调用该方法前,已调用 createDataStream 创建了数据通道。
 @param streamId 数据流 ID,createDataStream 的返回值。
 @param data   需要发送的消息
 @return 0方法调用成功,<0方法调用失败
*/
- (int)sendStreamMessage:(NSInteger)streamId data:(NSData * _Nonnull)data;
//MARK: - 其他视频控制
/**-----------------------------------------------------------------------------
* @name 其他视频控制
* -----------------------------------------------------------------------------
*/
/** 设置摄像头采集偏好
一般的视频通话或直播中,默认由 SDK 自动控制摄像头的输出参数。在如下特殊场景中,默认的参数通常无法满足需求,或可能引起设备性能问题,我们推荐调用该方法设置摄像头的采集偏好:
* 使用原始音视频数据自采集接口时,如果 SDK 输出的分辨率和帧率高于 setVideoEncoderConfiguration 中指定的参数,在后续处理视频帧的时候,比如美颜功能时,会需要更高的 CPU 及内存,容易导致性能问题。在这种情况下,我们推荐将摄像头采集偏好设置为 ARCameraCaptureOutputPreferencePerformance(1),避免性能问题。
* 如果没有本地预览功能或者对预览质量没有要求,我们推荐将采集偏好设置为 ARCameraCaptureOutputPreferencePerformance(1),以优化 CPU 和内存的资源分配。
* 如果用户希望本地预览视频比实际编码发送的视频清晰,可以将采集偏好设置为 ARCameraCaptureOutputPreferencePreview(2)。
**Note**
请在启动摄像头之前调用该方法,如 joinChannelByToken,enableVideo 或者 enableLocalVideo 之前。
@param configuration 摄像头采集偏好,详见 ARCameraCapturerConfiguration
@return 0方法调用成功,<0方法调用失败
 */
- (int)setCameraCapturerConfiguration:(ARCameraCapturerConfiguration * _Nullable)configuration;
/** 开启/关闭本地人脸检测
 开启本地人脸检测后,SDK 会触发 facePositionDidChangeWidth 回调向你报告人脸检测的信息::
 - 摄像头采集的画面大小
 - 人脸在画面中的位置
 - 人脸距设备屏幕的距离
 @param enable 是否开启人脸检测:
 - YES: 开启人脸检测
 - NO: (默认)关闭人脸检测
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableFaceDetection:(BOOL)enable;
#if TARGET_OS_IPHONE
//MARK: - 摄像头控制
/**-----------------------------------------------------------------------------
* @name 摄像头控制
* -----------------------------------------------------------------------------
*/
/** 切换前置/后置摄像头
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。
@return 0方法调用成功,<0方法调用失败
*/
- (int)switchCamera;
/** 检测设备是否支持摄像头缩放功能
@return YES: 设备支持摄像头缩放功能; NO: 设备不支持摄像头缩放功能。
*/
- (BOOL)isCameraZoomSupported;
/** 检测设备是否支持闪光灯常开
**Note**
 * 本方法仅适用于 iOS 平台,不适用于 macOS。
 * 一般情况下,App 默认开启前置摄像头,因此如果你的前置摄像头不支持闪光灯常开,直接使用该方法会返回 NO。如果需要检查后置摄像头是否支持闪光灯常开,需要先使用 switchCamera 切换摄像头,再使用该方法。
@return YES: 设备支持闪光灯常开; NO:设备不支持闪光灯常开。
*/
- (BOOL)isCameraTorchSupported;
/** 检测设备是否支持手动对焦功能
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。
@return YES: 设备支持手动对焦功能;NO: 设备不支持手动对焦功能。
*/
- (BOOL)isCameraFocusPositionInPreviewSupported;
/** 检测设备是否支持手动曝光功能
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。
@return YES: 设备支持手动曝光功能;NO: 设备不支持手动曝光功能。
*/
- (BOOL)isCameraExposurePositionSupported;
/** 检测设备是否支持人脸对焦功能
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。
@return YES: 设备支持人脸对焦功能;NO: 设备不支持人脸对焦功能。
*/
- (BOOL)isCameraAutoFocusFaceModeSupported;
/** 设置摄像头缩放比例
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。
@param zoomFactor   摄像头缩放比例,有效范围是 1.0 到设备支持的最大缩放比例。
@return 设置成功返回设置的 factor 值,设置失败返回 < 0
*/
- (CGFloat)setCameraZoomFactor:(CGFloat)zoomFactor;
/** 设置手动对焦位置,并触发对焦
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。成功调用该方法后,本地会触发 cameraFocusDidChangedToRect 回调。
@param position 触摸点相对于视图的坐标
@return YES方法调用成功,NO方法调用失败
*/
- (BOOL)setCameraFocusPositionInPreview:(CGPoint)position;
/** 设置摄像头曝光位置
**Note**
本方法仅适用于 iOS 平台,不适用于 macOS。成功调用该方法后,本地会触发 cameraExposureDidChangedToRect 回调。
@param positionInView 触摸点相对于视图的横坐标和纵坐标
@return YES方法调用成功,NO方法调用失败
*/
- (BOOL)setCameraExposurePosition:(CGPoint)positionInView;
/** 设置是否打开闪光灯
@param isOn YES打开,NO关闭
@return YES方法调用成功,NO方法调用失败
*/
- (BOOL)setCameraTorchOn:(BOOL)isOn;
/** 设置是否开启人脸对焦功能
@param enable YES开启,NO关闭,默认关闭
@return YES方法调用成功,NO方法调用失败
*/
- (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable;
#endif
#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
//MARK: - 屏幕共享
/**-----------------------------------------------------------------------------
 * @name 屏幕共享
 * -----------------------------------------------------------------------------
 */
/** 通过屏幕 ID 共享屏幕(仅支持 macOS )
共享一个屏幕或该屏幕的部分区域。你需要在该方法中指定想要共享的屏幕 ID。
**Note**: 该方法需要在加入频道后调用。
@param displayId 待共享的屏幕 ID。通过该参数指定你要共享的那个屏幕。
@param rectangle (可选)待共享区域相对于整个屏幕的位置。如不填,则表示共享整个屏幕。由如下参数组成:
- x:左上角的横向偏移
- y:左上角的纵向偏移
- width:待共享区域的宽
- height:待共享区域的高
 如果设置的共享区域超出了屏幕的边界,则只共享屏幕内的内容;如果宽或高设为 0,则共享整个屏幕。
@param captureParams 屏幕共享的编码参数配置。默认的分辨率为 1920 x 1080,即 2073600 像素。该像素值为计费标准。 详见 ARScreenCaptureParameters 中的说明。
@return 0方法调用成功,<0方法调用失败
 */
- (int)startScreenCaptureByDisplayId:(NSUInteger)displayId
                           rectangle:(CGRect)rectangle
                          parameters:(ARScreenCaptureParameters * _Nonnull)captureParams;
/** 通过窗口 ID 共享窗口(仅支持 macOS )
共享一个窗口或该窗口的部分区域。你需要在该方法中指定想要共享的窗口 ID。
**Note**: 该方法需要在加入频道后调用。
@param windowId 待共享的窗口 ID。通过该参数指定你要共享的那个窗口
@param rectangle (可选)待共享区域相对于整个窗口的位置。如不填,则表示共享整个窗口。由如下参数组成:
 - x:左上角的横向偏移
 - y:左上角的纵向偏移
 - width:待共享区域的宽
 - height:待共享区域的高
 如果设置的共享区域超出了窗口的边界,则只共享窗口内的内容;如果宽或高设为 0,则共享整个窗口。
@param captureParams 屏幕共享的编码参数配置。默认的分辨率为 1920 x 1080,即 2073600 像素。该像素值为计费标准。 详见 ARScreenCaptureParameters 中的说明。
@return 0方法调用成功,<0方法调用失败
 */
- (int)startScreenCaptureByWindowId:(NSUInteger)windowId
                          rectangle:(CGRect)rectangle
                         parameters:(ARScreenCaptureParameters * _Nonnull)captureParams;
/** 更新屏幕共享的参数配置(仅支持 macOS )
@param captureParams 屏幕共享的编码参数配置。默认的分辨率为 1920 x 1080,即 2073600 像素。该像素值为计费标准。
@return 0方法调用成功,<0方法调用失败
 */
- (int)updateScreenCaptureParameters:(ARScreenCaptureParameters * _Nonnull)captureParams;
/** 更新屏幕共享区域 (仅支持 macOS )
 @param rect 待共享区域相对于整个屏幕或窗口的位置。如不填,则表示共享整个屏幕或窗口。由如下参数组成:
 - x:左上角的横向偏移
 - y:左上角的纵向偏移
 - width:待共享区域的宽
 - height:待共享区域的高
 如果设置的共享区域超出了屏幕或窗口的边界,则只共享屏幕或窗口内的内容;如果宽或高设为 0,则共享整个屏幕或窗口。
@return 0方法调用成功,<0方法调用失败
*/
- (int)updateScreenCaptureRegion:(CGRect)rect;
/** 停止屏幕共享(仅支持 macOS )
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopScreenCapture;
#endif
#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC))
//MARK: - 音视频设备管理 (macOS)
/**-----------------------------------------------------------------------------
 * @name 音视频设备管理 (仅支持 macOS)
 * -----------------------------------------------------------------------------
 */
/** 监控设备改变 (仅支持 macOS)
 该方法用来启动设备插拔检测,这里设备指的是音视频外接设备,比如外接摄像头等。开启后,会触发设备状态改变回调。
 @param enabled - YES: 开启监控
 - NO: 关闭监控
 */
- (void)monitorDeviceChange:(BOOL)enabled;
/** 获取系统中所有的音视频设备 (仅支持 macOS)
**Note:**
 不要在主线程调用该方法。
 该方法返回一个 NSArray 对象,包含系统中所有的音视频设备。应用程序可以通过 ARtcDeviceInfo array 对象枚举设备。
 @param type 要枚举的设备类型,详见 ARMediaDeviceType
 @return 调用成功时,返回 ARtcDeviceInfo NSArray 对象,包含所有的音视频设备。
 */
- (NSArray<ARtcDeviceInfo *> * _Nullable)enumerateDevices:(ARMediaDeviceType)type;
/** 指定设备 (仅支持 macOS)
 @param type  设备的类型,包括音、视频采集或播放设备,详见 ARMediaDeviceType
 @param deviceId 设备的 Device ID,可通过 enumerateDevices获取。插拔设备不会影响 deviceId 。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDevice:(ARMediaDeviceType)type deviceId:(NSString * _Nonnull)deviceId;
/** 获取设备音量 (仅支持 macOS)
 @param type 设备的类型,包括音、视频采集或播放设备,详见 ARMediaDeviceType
 @return 该方法获取当前设备的音量。
 */
- (int)getDeviceVolume:(ARMediaDeviceType)type;
/** 设置设备音量 (仅支持 macOS)
 @param type   设备的类型,包括音、视频采集或播放设备,详见 ARMediaDeviceType
 @param volume 设置的音量(0 ~ 100)
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setDeviceVolume:(ARMediaDeviceType)type volume:(int)volume;
/** 启动音频采集设备测试 (仅支持 macOS)
 该方法测试音频采集设备是否能正常工作。
 调用该方法后,SDK 会按设置的时间间隔触发 reportAudioVolumeIndicationOfSpeakers 回调,报告 uid = "0"及采集设备的音量信息。
 @param indicationInterval SDK 返回 reportAudioVolumeIndicationOfSpeakers 回调的时间间隔,单位为毫秒。建议设置到大于 200 毫秒。 不得少于 10 毫秒,否则会收不到 reportAudioVolumeIndicationOfSpeakers 回调。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startRecordingDeviceTest:(int)indicationInterval;
/** 停止麦克风测试 (仅支持 macOS)
 该方法停止麦克风测试。调用 startRecordingDeviceTest 后,必须调用该方法停止测试。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopRecordingDeviceTest;
 /** 启动音频播放设备测试 (仅支持 macOS)
  该方法测试音频播放设备是否能正常工作。启动测试后,SDK 播放指定的音频文件,测试者如果能听到声音,说明播放设备能正常工作。
  调用该方法后,SDK 会每隔 100 ms 触发一次 reportAudioVolumeIndicationOfSpeakers 回调,报告 uid = "1" 及播放设备的音量信息。
**Note:** 该方法需要在加入频道前调用。
 @param audioFileName 指定音频文件的绝对路径,路径字符串使用UTF-8编码格式:
  - 支持的文件格式: wav,mp3,m4a,aac
  - 支持的文件采样率: 8000,16000,32000,44100,48000
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startPlaybackDeviceTest:(NSString * _Nonnull)audioFileName;
/** 停止播放设备测试 (仅支持 macOS)
 该方法停止播放设备测试。调用 startPlaybackDeviceTest 后,必须调用该方法停止测试。
**Note:** 该方法需要在加入频道前调用。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopPlaybackDeviceTest;
/** 启动视频采集设备测试 (仅支持 macOS)
 用于测试当前视频采集设备是否工作正常,使用前需保证已调用过 enableVideo ,且传入参数的 view 窗口有效。
**Note:** 该方法需要在加入频道前调用。
 @param view 输入参数,用于显示图像的窗口
 @return 0方法调用成功,<0方法调用失败
 */
- (int)startCaptureDeviceTest:(NSView * _Nonnull)view;
/** 停止视频采集设备测试 (仅支持 macOS)
 停止视频采集设备测试,如果之前调用了 startCaptureDeviceTest,必须通过该方法停止测试。
**Note:** 该方法需要在加入频道前调用。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)stopCaptureDeviceTest;
/** 开始音频设备回路测试 (仅支持 macOS)
 该方法测试音频采集和播放设备是否能正常工作。一旦测试开始,音频采集设备会采集本地音频,然后使用音频播放设备播放出来。SDK 会按设置的时间间隔触发 两个 reportAudioVolumeIndicationOfSpeakers 回调,分别报告音频采集设备(uid = 0)和音频播放设备(uid = 1)的音量信息。
**Note:**
 - 该方法仅在本地进行音频设备测试,不涉及网络连接。
 - 该方法需要在加入频道前调用。
@param indicationInterval SDK 返回 reportAudioVolumeIndicationOfSpeakers 回调的时间间隔,单位为毫秒。建议设置为大于 200 毫秒。 不得少于 10 毫秒,否则会收不到 reportAudioVolumeIndicationOfSpeakers 回调。
@return 0方法调用成功,<0方法调用失败
*/
-(int)startAudioDeviceLoopbackTest:(int)indicationInterval;
/** 停止音频设备回路测试 (仅支持 macOS)
 在调用 startAudioDeviceLoopbackTest 后,必须调用该方法停止音频设备回路测试。
**Note:** 该方法需要在加入频道前调用。
@return 0方法调用成功,<0方法调用失败
*/
-(int)stopAudioDeviceLoopbackTest;
#endif
//MARK: - 媒体附属信息
//MARK: - 其它方法
/**-----------------------------------------------------------------------------
* @name 其它方法
* -----------------------------------------------------------------------------
*/
/** 获取通话 ID
 客户端在每次 joinChannelByToken 后会生成一个对应的 CallId,标识该客户端的此次通话。有些方法如 rate,complain需要在通话结束后调用,向 SDK 提交反馈,这些方法必须指定 CallId 参数。使用这些反馈方法,需要在通话过程中调用 getCallId 方法获取 CallId,在通话结束后在反馈方法中作为参数传入。
 @return 当前通话 ID
 */
- (NSString * _Nullable)getCallId;
/** 分发/不分发回调至主队列
 如果不分发回调方法到主队列, App 应将 UI 操作分发到主队列。
 @param enabled 设置是否将委托方法分发到主队列:
 * YES: 分发回调方法到主队列
 * NO: 不分发回调方法到主队列
 @return 0方法调用成功,<0方法调用失败
 */
- (int)enableMainQueueDispatch:(BOOL)enabled;
/** 查询 SDK 版本号
 @return 当前的 SDK 版本号,格式为字符串,如 4.0.0
 */
+ (NSString * _Nonnull)getSdkVersion;
/** 获取警告或错误描述。
 @param code didOccurWarning 或 didOccurError 提供的警告码或错误码。
 @return 警告或错误描述
 */
+ (NSString * _Nullable)getErrorDescription:(NSInteger)code;
/** 设置日志文件路径
设置 SDK 的输出 log 文件。SDK 运行时产生的所有 log 将写入该文件。 App 必须保证指定的目录存在而且可写。
**Note**
 - 日志文件的默认地址如下:
   - iOS: `App Sandbox/Library/caches/ar_sdk.log`
   - macOS
     - 开启沙盒: `App Sandbox/Library/Logs/ar_sdk.log`, 例如 `/Users/<username>/Library/Containers/<App Bundle Identifier>/Data/Library/Logs/ar_sdk.log`.
     - 关闭沙盒: `~/Library/Logs/ar_sdk.log`.
 - 如需调用本方法,请在调用 sharedEngineWithAppId 方法初始化 ARtcEngineKit 对象后立即调用,否则可能造成输出日志不完整。
 @param filePath 日志文件的完整路径。该日志文件为 UTF-8 编码。
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setLogFile:(NSString * _Nonnull)filePath;
/** 设置日志文件大小
设置 SDK 输出的日志文件大小,单位为 KB。
SDK 设有 2 个日志文件,每个文件大小为 512 KB。如果你将 fileSizeInKByte 设置为 1024 KB, SDK 会最多输出 2 MB 的日志文件。如果日志文件大小超出设置值,新的日志会覆盖之前的日志。
 @param fileSizeInKBytes 指定 SDK 输出日志文件的内存大小,单位为 KB。
 @return 0方法调用成功,<0方法调用失败,有可能是因为传入的参数无效
 */
- (int)setLogFileSize:(NSUInteger)fileSizeInKBytes;
/** 设置日志输出等级
@param filter 日志输出等级
@return 0方法调用成功,<0方法调用失败
*/
- (int)setLogFilter:(ARLogFilter)filter;
/** 获取 Native SDK Engine 句柄
该方法获取 native SDK engine 的 C++ handle,用于包括注册音视频帧观测器在内的特殊场景。
*/
- (void *_Nullable)getNativeHandle;
/** 设置/获取 ARtcEngineDelegate
 ar云平台 Native SDK 通过指定的 delegate 通知 App 引擎运行时的事件。Delegate 中定义的所有方法都是可选实现的。
 */
@property (nonatomic, weak) id<ARtcEngineDelegate> _Nullable delegate;
//MARK: - 定制方法
/**-----------------------------------------------------------------------------
* @name 定制方法
* -----------------------------------------------------------------------------
*/
/** 通过 JSON 配置 SDK 提供技术预览或特别定制功能
**Note**
 JSON 选项默认不公开。
 @param options JSON 格式的 SDK 选项
 @return 0方法调用成功,<0方法调用失败
 */
- (int)setParameters:(NSString * _Nonnull)options;
/** 获取 ar云平台 SDK 可供自定义的参数
**Note**
 该方法未公开,请联系ar云平台支持 hi@dync.cc 获取详情。
 @param parameter 定制参数
 @param args 参数
 @return json字符串
 */
- (NSString * _Nullable)getParameter:(NSString * _Nonnull)parameter args:(NSString * _Nullable)args;
@end
NS_ASSUME_NONNULL_END
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ARtcKit.h
New file
@@ -0,0 +1,29 @@
//
//  ARtcKit.h
//  ARtcKit
//
//  Created by zjq on 2020/3/18.
//  Copyright © 2020 zjq. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for ARtcKit.
FOUNDATION_EXPORT double ARtcKitVersionNumber;
//! Project version string for ARtcKit.
FOUNDATION_EXPORT const unsigned char ARtcKitVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <ARtcKit/PublicHeader.h>
#import <ARtcKit/ARObjects.h>
#import <ARtcKit/ARtcEngineDelegate.h>
#import <ARtcKit/AREnumerates.h>
#import <ARtcKit/ARtcEngineKit.h>
#import <ARtcKit/ARtcChannel.h>
#import <ARtcKit/ARtcChannelDelegate.h>
#import <ARtcKit/ARMediaPlayerKit.h>
#import <ARtcKit/ARStreamingKit.h>
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ArBase.h
New file
@@ -0,0 +1,826 @@
//  AR Engine SDK
//
//  Copyright (c) 2019 AR.io. All rights reserved.
//
#ifndef __AR_BASE_H__
#define __AR_BASE_H__
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define AR_CALL __cdecl
#if defined(ARRTC_EXPORT)
#define AR_API extern "C" __declspec(dllexport)
#else
#define AR_API extern "C" __declspec(dllimport)
#endif
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#define AR_API __attribute__((visibility("default"))) extern "C"
#define AR_CALL
#elif defined(__ANDROID__) || defined(__linux__)
#define AR_API extern "C" __attribute__((visibility("default")))
#define AR_CALL
#else
#define AR_API extern "C"
#define AR_CPP_API
#define AR_CALL
#endif
namespace ar {
namespace util {
template<class T>
class AutoPtr {
    typedef T value_type;
    typedef T* pointer_type;
public:
    AutoPtr(pointer_type p=0)
        :ptr_(p)
    {}
    ~AutoPtr() {
        if (ptr_)
            ptr_->release();
    }
    operator bool() const { return ptr_ != (pointer_type)0; }
    value_type& operator*() const {
        return *get();
    }
    pointer_type operator->() const {
        return get();
    }
    pointer_type get() const {
        return ptr_;
    }
    pointer_type release() {
        pointer_type tmp = ptr_;
        ptr_ = 0;
        return tmp;
    }
    void reset(pointer_type ptr = 0) {
        if (ptr != ptr_ && ptr_)
            ptr_->release();
        ptr_ = ptr;
    }
    template<class C1, class C2>
    bool queryInterface(C1* c, C2 iid) {
        pointer_type p = NULL;
        if (c && !c->queryInterface(iid, (void**)&p))
        {
            reset(p);
        }
        return p != NULL;
    }
private:
    AutoPtr(const AutoPtr&);
    AutoPtr& operator=(const AutoPtr&);
private:
    pointer_type ptr_;
};
class IString {
protected:
    virtual ~IString(){}
public:
    virtual bool empty() const = 0;
    virtual const char* c_str() = 0;
    virtual const char* data() = 0;
    virtual size_t length() = 0;
    virtual void release() = 0;
};
typedef AutoPtr<IString> AString;
}//namespace util
enum INTERFACE_ID_TYPE
{
    AR_IID_AUDIO_DEVICE_MANAGER = 1,
    AR_IID_VIDEO_DEVICE_MANAGER = 2,
    AR_IID_RTC_ENGINE_PARAMETER = 3,
    AR_IID_MEDIA_ENGINE = 4,
    AR_IID_SIGNALING_ENGINE = 8,
};
    /** Warning code.
     */
enum WARN_CODE_TYPE
{
  /** 8: The specified view is invalid. Specify a view when using the video call function.
  */
    WARN_INVALID_VIEW = 8,
    /** 16: Failed to initialize the video function, possibly caused by a lack of resources. The users cannot see the video while the voice communication is not affected.
    */
    WARN_INIT_VIDEO = 16,
    /** 20: The request is pending, usually due to some module not being ready, and the SDK postponed processing the request.
    */
    WARN_PENDING = 20,
    /** 103: No channel resources are available. Maybe because the server cannot allocate any channel resource.
    */
    WARN_NO_AVAILABLE_CHANNEL = 103,
    /** 104: A timeout occurs when looking up the channel. When joining a channel, the SDK looks up the specified channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
    */
    WARN_LOOKUP_CHANNEL_TIMEOUT = 104,
    /** **DEPRECATED** 105: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal.
     Deprecated as of v2.4.1. Use CONNECTION_CHANGED_REJECTED_BY_SERVER(10) in the \ref ar::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
    */
    WARN_LOOKUP_CHANNEL_REJECTED = 105,
    /** 106: A timeout occurs when opening the channel. Once the specific channel is found, the SDK opens the channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
    */
    WARN_OPEN_CHANNEL_TIMEOUT = 106,
    /** 107: The server rejects the request to open the channel. The server cannot process this request or the request is illegal.
    */
    WARN_OPEN_CHANNEL_REJECTED = 107,
    // sdk: 100~1000
    /** 111: A timeout occurs when switching to the live video.
    */
    WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111,
    /** 118: A timeout occurs when setting the client role in the live interactive streaming profile.
    */
    WARN_SET_CLIENT_ROLE_TIMEOUT = 118,
    /** 121: The ticket to open the channel is invalid.
    */
    WARN_OPEN_CHANNEL_INVALID_TICKET = 121,
    /** 122: Try connecting to another server.
    */
    WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122,
    /** 131: The channel connection cannot be recovered.
     */
    WARN_CHANNEL_CONNECTION_UNRECOVERABLE = 131,
    /** 132: The IP address has changed.
     */
    WARN_CHANNEL_CONNECTION_IP_CHANGED = 132,
    /** 133: The port has changed.
     */
    WARN_CHANNEL_CONNECTION_PORT_CHANGED = 133,
    /** 134: The socket error occurs, try to rejoin channel.
     */
    WARN_CHANNEL_SOCKET_ERROR = 134,
    /** 701: An error occurs in opening the audio mixing file.
    */
    WARN_AUDIO_MIXING_OPEN_ERROR = 701,
    /** 1014: Audio Device Module: A warning occurs in the playback device.
    */
    WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014,
    /** 1016: Audio Device Module: a warning occurs in the recording device.
    */
    WARN_ADM_RUNTIME_RECORDING_WARNING = 1016,
    /** 1019: Audio Device Module: no valid audio data is recorded.
    */
    WARN_ADM_RECORD_AUDIO_SILENCE = 1019,
    /** 1020: Audio device module: The audio playback frequency is abnormal, which may cause audio freezes. This abnormality is caused by high CPU usage. AR recommends stopping other apps.
    */
    WARN_ADM_PLAYOUT_MALFUNCTION = 1020,
    /** 1021: Audio device module: the audio recording frequency is abnormal, which may cause audio freezes. This abnormality is caused by high CPU usage. AR recommends stopping other apps.
    */
    WARN_ADM_RECORD_MALFUNCTION = 1021,
    /** 1025: The audio playback or recording is interrupted by system events (such as a phone call).
    */
    WARN_ADM_CALL_INTERRUPTION = 1025,
    /** 1029: During a call, the audio session category should be set to
     * AVAudioSessionCategoryPlayAndRecord, and RtcEngine monitors this value.
     * If the audio session category is set to other values, this warning code
     * is triggered and RtcEngine will forcefully set it back to
     * AVAudioSessionCategoryPlayAndRecord.
    */
    WARN_ADM_IOS_CATEGORY_NOT_PLAYANDRECORD = 1029,
    /** 1031: Audio Device Module: The recorded audio voice is too low.
    */
    WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031,
    /** 1032: Audio Device Module: the playback audio voice is too low.
    */
    WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL = 1032,
    /** 1033: Audio device module: The audio recording device is occupied.
     */
    WARN_ADM_RECORD_AUDIO_IS_ACTIVE = 1033,
    /** 1040: Audio device module: An exception occurs with the audio drive.
     * Solutions:
     * - Disable or re-enable the audio device.
     * - Re-enable your device.
     * - Update the sound card drive.
     */
    WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040,
    /** 1042: Audio device module: The audio recording device is different from the audio playback device,
     * which may cause echoes problem. AR recommends using the same audio device to record and playback
     * audio.
     */
    WARN_ADM_INCONSISTENT_AUDIO_DEVICE = 1042,
    /** 1051: (Communication profile only) Audio processing module: A howling sound is detected when recording the audio data.
    */
    WARN_APM_HOWLING = 1051,
    /** 1052: Audio Device Module: The device is in the glitch state.
    */
    WARN_ADM_GLITCH_STATE = 1052,
    /** 1053: Audio Processing Module: A residual echo is detected, which may be caused by the belated scheduling of system threads or the signal overflow.
    */
    WARN_APM_RESIDUAL_ECHO = 1053,
    /// @cond
    WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322,
    /// @endcond
    /** 1323: Audio device module: No available playback device.
     * Solution: Plug in the audio device.
    */
    WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323,
    /** Audio device module: The capture device is released improperly.
     * Solutions:
     * - Disable or re-enable the audio device.
     * - Re-enable your device.
     * - Update the sound card drive.
     */
    WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324,
    /** 1610: The origin resolution of the remote video is beyond the range where the super-resolution algorithm can be applied.
    */
    WARN_SUPER_RESOLUTION_STREAM_OVER_LIMITATION = 1610,
    /** 1611: Another user is already using the super-resolution algorithm.
    */
    WARN_SUPER_RESOLUTION_USER_COUNT_OVER_LIMITATION = 1611,
    /** 1612: The device does not support the super-resolution algorithm.
    */
    WARN_SUPER_RESOLUTION_DEVICE_NOT_SUPPORTED = 1612,
    /// @cond
    WARN_RTM_LOGIN_TIMEOUT = 2005,
    WARN_RTM_KEEP_ALIVE_TIMEOUT = 2009
    /// @endcond
};
/** Error code.
*/
enum ERROR_CODE_TYPE
{
  /** 0: No error occurs.
  */
    ERR_OK = 0,
    //1~1000
    /** 1: A general error occurs (no specified reason).
    */
    ERR_FAILED = 1,
    /** 2: An invalid parameter is used. For example, the specific channel name includes illegal characters.
    */
    ERR_INVALID_ARGUMENT = 2,
    /** 3: The SDK module is not ready. Possible solutions:
     - Check the audio device.
     - Check the completeness of the application.
     - Re-initialize the RTC engine.
     */
    ERR_NOT_READY = 3,
    /** 4: The SDK does not support this function.
     */
    ERR_NOT_SUPPORTED = 4,
    /** 5: The request is rejected.
     */
    ERR_REFUSED = 5,
    /** 6: The buffer size is not big enough to store the returned data.
     */
    ERR_BUFFER_TOO_SMALL = 6,
    /** 7: The SDK is not initialized before calling this method.
     */
    ERR_NOT_INITIALIZED = 7,
    /** 9: No permission exists. Check if the user has granted access to the audio or video device.
     */
    ERR_NO_PERMISSION = 9,
    /** 10: An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (more than 10 seconds) for the SDK to process.
     */
    ERR_TIMEDOUT = 10,
    /** 11: The request is canceled. This is for internal SDK use only, and it does not return to the application through any method or callback.
     */
    ERR_CANCELED = 11,
    /** 12: The method is called too often. This is for internal SDK use only, and it does not return to the application through any method or callback.
     */
    ERR_TOO_OFTEN = 12,
    /** 13: The SDK fails to bind to the network socket. This is for internal SDK use only, and it does not return to the application through any method or callback.
     */
    ERR_BIND_SOCKET = 13,
    /** 14: The network is unavailable. This is for internal SDK use only, and it does not return to the application through any method or callback.
     */
    ERR_NET_DOWN = 14,
    /** 15: No network buffers are available. This is for internal SDK internal use only, and it does not return to the application through any method or callback.
     */
    ERR_NET_NOBUFS = 15,
    /** 17: The request to join the channel is rejected.
     *
     * - This error usually occurs when the user is already in the channel, and still calls the method to join the channel, for example, \ref ar::rtc::IRtcEngine::joinChannel "joinChannel".
     * - This error usually occurs when the user tries to join a channel during a call test (\ref ar::rtc::IRtcEngine::startEchoTest "startEchoTest"). Once you call \ref ar::rtc::IRtcEngine::startEchoTest "startEchoTest", you need to call \ref ar::rtc::IRtcEngine::stopEchoTest "stopEchoTest" before joining a channel.
     */
    ERR_JOIN_CHANNEL_REJECTED = 17,
    /** 18: The request to leave the channel is rejected.
     This error usually occurs:
     - When the user has left the channel and still calls \ref ar::rtc::IRtcEngine::leaveChannel "leaveChannel" to leave the channel. In this case, stop calling \ref ar::rtc::IRtcEngine::leaveChannel "leaveChannel".
     - When the user has not joined the channel and still calls \ref ar::rtc::IRtcEngine::leaveChannel "leaveChannel" to leave the channel. In this case, no extra operation is needed.
     */
    ERR_LEAVE_CHANNEL_REJECTED = 18,
    /** 19: Resources are occupied and cannot be reused.
     */
    ERR_ALREADY_IN_USE = 19,
    /** 20: The SDK gives up the request due to too many requests.
     */
    ERR_ABORTED = 20,
    /** 21: In Windows, specific firewall settings can cause the SDK to fail to initialize and crash.
     */
    ERR_INIT_NET_ENGINE = 21,
    /** 22: The application uses too much of the system resources and the SDK fails to allocate the resources.
     */
    ERR_RESOURCE_LIMITED = 22,
    /** 101: The specified App ID is invalid. Please try to rejoin the channel with a valid App ID.
     */
    ERR_INVALID_APP_ID = 101,
    /** 102: The specified channel name is invalid. Please try to rejoin the channel with a valid channel name.
     */
    ERR_INVALID_CHANNEL_NAME = 102,
    /** 103: Fails to get server resources in the specified region. Please try to specify another region when calling \ref ar::rtc::IRtcEngine::initialize "initialize".
     */
    ERR_NO_SERVER_RESOURCES = 103,
    /** **DEPRECATED** 109: Deprecated as of v2.4.1. Use CONNECTION_CHANGED_TOKEN_EXPIRED(9) in the \ref ar::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
     The token expired due to one of the following reasons:
     - Authorized Timestamp expired: The timestamp is represented by the number of seconds elapsed since 1/1/1970. The user can use the Token to access the AR service within five minutes after the Token is generated. If the user does not access the AR service after five minutes, this Token is no longer valid.
     - Call Expiration Timestamp expired: The timestamp is the exact time when a user can no longer use the AR service (for example, when a user is forced to leave an ongoing call). When a value is set for the Call Expiration Timestamp, it does not mean that the token will expire, but that the user will be banned from the channel.
     */
    ERR_TOKEN_EXPIRED = 109,
    /** **DEPRECATED** 110: Deprecated as of v2.4.1. Use CONNECTION_CHANGED_INVALID_TOKEN(8) in the \ref ar::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
     The token is invalid due to one of the following reasons:
     - The App Certificate for the project is enabled in Console, but the user is still using the App ID. Once the App Certificate is enabled, the user must use a token.
     - The uid is mandatory, and users must set the same uid as the one set in the \ref ar::rtc::IRtcEngine::joinChannel "joinChannel" method.
     */
    ERR_INVALID_TOKEN = 110,
    /** 111: The internet connection is interrupted. This applies to the AR Web SDK only.
     */
    ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk
    /** 112: The internet connection is lost. This applies to the AR Web SDK only.
     */
    ERR_CONNECTION_LOST = 112, // only used in web sdk
    /** 113: The user is not in the channel when calling the \ref ar::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" or \ref ar::rtc::IRtcEngine::getUserInfoByUserAccount "getUserInfoByUserAccount" method.
     */
    ERR_NOT_IN_CHANNEL = 113,
    /** 114: The size of the sent data is over 1024 bytes when the user calls the \ref ar::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
     */
    ERR_SIZE_TOO_LARGE = 114,
    /** 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the user calls the \ref ar::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method.
     */
    ERR_BITRATE_LIMIT = 115,
    /** 116: Too many data streams (over 5 streams) are created when the user calls the \ref ar::rtc::IRtcEngine::createDataStream "createDataStream" method.
     */
    ERR_TOO_MANY_DATA_STREAMS = 116,
    /** 117: The data stream transmission timed out.
     */
    ERR_STREAM_MESSAGE_TIMEOUT = 117,
    /** 119: Switching roles fail. Please try to rejoin the channel.
     */
    ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119,
    /** 120: Decryption fails. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel.
     */
    ERR_DECRYPTION_FAILED = 120,
    /** 123: The client is banned by the server.
     */
    ERR_CLIENT_IS_BANNED_BY_SERVER = 123,
    /** 124: Incorrect watermark file parameter.
     */
    ERR_WATERMARK_PARAM = 124,
    /** 125: Incorrect watermark file path.
     */
    ERR_WATERMARK_PATH = 125,
    /** 126: Incorrect watermark file format.
     */
    ERR_WATERMARK_PNG = 126,
    /** 127: Incorrect watermark file information.
     */
    ERR_WATERMARKR_INFO = 127,
    /** 128: Incorrect watermark file data format.
     */
    ERR_WATERMARK_ARGB = 128,
    /** 129: An error occurs in reading the watermark file.
     */
    ERR_WATERMARK_READ = 129,
    /** 130: Encryption is enabled when the user calls the \ref ar::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" method (CDN live streaming does not support encrypted streams).
     */
    ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH = 130,
    /** 134: The user account is invalid. */
    ERR_INVALID_USER_ACCOUNT = 134,
    /** 151: CDN related errors. Remove the original URL address and add a new one by calling the \ref ar::rtc::IRtcEngine::removePublishStreamUrl "removePublishStreamUrl" and \ref ar::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl" methods.
     */
    ERR_PUBLISH_STREAM_CDN_ERROR = 151,
    /** 152: The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones.
     */
    ERR_PUBLISH_STREAM_NUM_REACH_LIMIT = 152,
    /** 153: The host manipulates other hosts' URLs. Check your app logic.
     */
    ERR_PUBLISH_STREAM_NOT_AUTHORIZED = 153,
    /** 154: An error occurs in AR's streaming server. Call the addPublishStreamUrl method to publish the streaming again.
     */
    ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR = 154,
    /** 155: The server fails to find the stream.
     */
    ERR_PUBLISH_STREAM_NOT_FOUND = 155,
    /** 156: The format of the RTMP stream URL is not supported. Check whether the URL format is correct.
     */
    ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED = 156,
    //signaling: 400~600
    /**
    */
    ERR_LOGOUT_OTHER = 400,  //
    /** 401: The user logged out.
     */
    ERR_LOGOUT_USER = 401,  // logout by user
    /** 402: Network failure.
     */
    ERR_LOGOUT_NET = 402,  // network failure
    /** 403: Logged in another device.
     */
    ERR_LOGOUT_KICKED = 403,  // login in other device
    /**
     */
    ERR_LOGOUT_PACKET = 404,  //
    /** 405: The token expired.
     */
    ERR_LOGOUT_TOKEN_EXPIRED = 405,  // token expired
    /**
     */
    ERR_LOGOUT_OLDVERSION = 406,  //
    /**
     */
    ERR_LOGOUT_TOKEN_WRONG = 407,
    /**
    */
    ERR_LOGOUT_ALREADY_LOGOUT = 408,
    /**
     */
    ERR_LOGIN_OTHER = 420,
    /**
    */
    ERR_LOGIN_NET = 421,
    /**
     */
    ERR_LOGIN_FAILED = 422,
    /**
     */
    ERR_LOGIN_CANCELED = 423,
    /**
     */
    ERR_LOGIN_TOKEN_EXPIRED = 424,
    /**
     */
    ERR_LOGIN_OLD_VERSION = 425,
    /**
     */
    ERR_LOGIN_TOKEN_WRONG = 426,
    /**
     */
    ERR_LOGIN_TOKEN_KICKED = 427,
    /**
     */
    ERR_LOGIN_ALREADY_LOGIN = 428,
    /**
    */
    ERR_JOIN_CHANNEL_OTHER = 440,
    /**
     */
    ERR_SEND_MESSAGE_OTHER = 440,
    /**
     */
    ERR_SEND_MESSAGE_TIMEOUT = 441,
    /**
     */
    ERR_QUERY_USERNUM_OTHER = 450,
    /**
     */
    ERR_QUERY_USERNUM_TIMEOUT = 451,
    /**
     */
    ERR_QUERY_USERNUM_BYUSER = 452,
    /**
     */
    ERR_LEAVE_CHANNEL_OTHER = 460,
    /**
     */
    ERR_LEAVE_CHANNEL_KICKED = 461,
    /**
     */
    ERR_LEAVE_CHANNEL_BYUSER = 462,
    /**
     */
    ERR_LEAVE_CHANNEL_LOGOUT = 463,
    /**
     */
    ERR_LEAVE_CHANNEL_DISCONNECTED = 464,
    /**
     */
    ERR_INVITE_OTHER = 470,
    /**
     */
    ERR_INVITE_REINVITE = 471,
    /**
     */
    ERR_INVITE_NET = 472,
    /**
     */
    ERR_INVITE_PEER_OFFLINE = 473,
    ERR_INVITE_TIMEOUT = 474,
    ERR_INVITE_CANT_RECV = 475,
    //1001~2000
    /** 1001: Fails to load the media engine.
     */
    ERR_LOAD_MEDIA_ENGINE = 1001,
    /** 1002: Fails to start the call after enabling the media engine.
     */
    ERR_START_CALL = 1002,
    /** **DEPRECATED** 1003: Fails to start the camera.
    Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE(4) in the \ref ar::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
     */
    ERR_START_CAMERA = 1003,
    /** 1004: Fails to start the video rendering module.
     */
    ERR_START_VIDEO_RENDER = 1004,
    /** 1005: A general error occurs in the Audio Device Module (no specified reason). Check if the audio device is used by another application, or try rejoining the channel.
     */
    ERR_ADM_GENERAL_ERROR = 1005,
    /** 1006: Audio Device Module: An error occurs in using the Java resources.
     */
    ERR_ADM_JAVA_RESOURCE = 1006,
    /** 1007: Audio Device Module: An error occurs in setting the sampling frequency.
     */
    ERR_ADM_SAMPLE_RATE = 1007,
    /** 1008: Audio Device Module: An error occurs in initializing the playback device.
     */
    ERR_ADM_INIT_PLAYOUT = 1008,
    /** 1009: Audio Device Module: An error occurs in starting the playback device.
     */
    ERR_ADM_START_PLAYOUT = 1009,
    /** 1010: Audio Device Module: An error occurs in stopping the playback device.
     */
    ERR_ADM_STOP_PLAYOUT = 1010,
    /** 1011: Audio Device Module: An error occurs in initializing the recording device.
     */
    ERR_ADM_INIT_RECORDING = 1011,
    /** 1012: Audio Device Module: An error occurs in starting the recording device.
     */
    ERR_ADM_START_RECORDING = 1012,
    /** 1013: Audio Device Module: An error occurs in stopping the recording device.
     */
    ERR_ADM_STOP_RECORDING = 1013,
    /** 1015: Audio Device Module: A playback error occurs. Check your playback device and try rejoining the channel.
     */
    ERR_ADM_RUNTIME_PLAYOUT_ERROR = 1015,
    /** 1017: Audio Device Module: A recording error occurs.
     */
    ERR_ADM_RUNTIME_RECORDING_ERROR = 1017,
    /** 1018: Audio Device Module: Fails to record.
     */
    ERR_ADM_RECORD_AUDIO_FAILED = 1018,
    /** 1022: Audio Device Module: An error occurs in initializing the
     * loopback device.
     */
    ERR_ADM_INIT_LOOPBACK = 1022,
    /** 1023: Audio Device Module: An error occurs in starting the loopback
     * device.
     */
    ERR_ADM_START_LOOPBACK = 1023,
    /** 1027: Audio Device Module: No recording permission exists. Check if the
     *  recording permission is granted.
     */
    ERR_ADM_NO_PERMISSION = 1027,
    /** 1033: Audio device module: The device is occupied.
    */
    ERR_ADM_RECORD_AUDIO_IS_ACTIVE = 1033,
    /** 1101: Audio device module: A fatal exception occurs.
    */
    ERR_ADM_ANDROID_JNI_JAVA_RESOURCE = 1101,
    /** 1108: Audio device module: The recording frequency is lower than 50.
     * 0 indicates that the recording is not yet started. We recommend
     * checking your recording permission.
    */
    ERR_ADM_ANDROID_JNI_NO_RECORD_FREQUENCY = 1108,
    /** 1109: The playback frequency is lower than 50. 0 indicates that the
     * playback is not yet started. We recommend checking if you have created
     * too many AudioTrack instances.
    */
    ERR_ADM_ANDROID_JNI_NO_PLAYBACK_FREQUENCY = 1109,
    /** 1111: Audio device module: AudioRecord fails to start up. A ROM system
     * error occurs. We recommend the following options to debug:
     * - Restart your App.
     * - Restart your cellphone.
     * - Check your recording permission.
     */
    ERR_ADM_ANDROID_JNI_JAVA_START_RECORD = 1111,
    /** 1112: Audio device module: AudioTrack fails to start up. A ROM system
     * error occurs. We recommend the following options to debug:
     * - Restart your App.
     * - Restart your cellphone.
     * - Check your playback permission.
    */
    ERR_ADM_ANDROID_JNI_JAVA_START_PLAYBACK = 1112,
    /** 1115: Audio device module: AudioRecord returns error. The SDK will
     * automatically restart AudioRecord. */
    ERR_ADM_ANDROID_JNI_JAVA_RECORD_ERROR = 1115,
    /** **DEPRECATED** */
    ERR_ADM_ANDROID_OPENSL_CREATE_ENGINE = 1151,
    /** **DEPRECATED** */
    ERR_ADM_ANDROID_OPENSL_CREATE_AUDIO_RECORDER = 1153,
    /** **DEPRECATED** */
    ERR_ADM_ANDROID_OPENSL_START_RECORDER_THREAD = 1156,
    /** **DEPRECATED** */
    ERR_ADM_ANDROID_OPENSL_CREATE_AUDIO_PLAYER = 1157,
    /** **DEPRECATED** */
    ERR_ADM_ANDROID_OPENSL_START_PLAYER_THREAD = 1160,
    /** 1201: Audio device module: The current device does not support audio
     * input, possibly because you have mistakenly configured the audio session
     *  category, or because some other app is occupying the input device. We
     * recommend terminating all background apps and re-joining the channel. */
    ERR_ADM_IOS_INPUT_NOT_AVAILABLE = 1201,
    /** 1206: Audio device module: Cannot activate the Audio Session.*/
    ERR_ADM_IOS_ACTIVATE_SESSION_FAIL = 1206,
    /** 1210: Audio device module: Fails to initialize the audio device,
     * normally because the audio device parameters are wrongly set.*/
    ERR_ADM_IOS_VPIO_INIT_FAIL = 1210,
    /** 1213: Audio device module: Fails to re-initialize the audio device,
     * normally because the audio device parameters are wrongly set.*/
    ERR_ADM_IOS_VPIO_REINIT_FAIL = 1213,
    /** 1214: Fails to re-start up the Audio Unit, possibly because the audio
     * session category is not compatible with the settings of the Audio Unit.
    */
    ERR_ADM_IOS_VPIO_RESTART_FAIL = 1214,
    ERR_ADM_IOS_SET_RENDER_CALLBACK_FAIL = 1219,
    /** **DEPRECATED** */
    ERR_ADM_IOS_SESSION_SAMPLERATR_ZERO = 1221,
    /** 1301: Audio device module: An audio driver abnomality or a
     * compatibility issue occurs. Solutions: Disable and restart the audio
     * device, or reboot the system.*/
    ERR_ADM_WIN_CORE_INIT = 1301,
    /** 1303: Audio device module: A recording driver abnomality or a
     * compatibility issue occurs. Solutions: Disable and restart the audio
     * device, or reboot the system. */
    ERR_ADM_WIN_CORE_INIT_RECORDING = 1303,
    /** 1306: Audio device module: A playout driver abnomality or a
     * compatibility issue occurs. Solutions: Disable and restart the audio
     * device, or reboot the system. */
    ERR_ADM_WIN_CORE_INIT_PLAYOUT = 1306,
    /** 1307: Audio device module: No audio device is available. Solutions:
     * Plug in a proper audio device. */
    ERR_ADM_WIN_CORE_INIT_PLAYOUT_NULL = 1307,
    /** 1309: Audio device module: An audio driver abnomality or a
     * compatibility issue occurs. Solutions: Disable and restart the audio
     * device, or reboot the system. */
    ERR_ADM_WIN_CORE_START_RECORDING = 1309,
    /** 1311: Audio device module: Insufficient system memory or poor device
     * performance. Solutions: Reboot the system or replace the device.
    */
    ERR_ADM_WIN_CORE_CREATE_REC_THREAD = 1311,
    /** 1314: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver.*/
    ERR_ADM_WIN_CORE_CAPTURE_NOT_STARTUP = 1314,
    /** 1319: Audio device module: Insufficient system memory or poor device
     * performance. Solutions: Reboot the system or replace the device. */
    ERR_ADM_WIN_CORE_CREATE_RENDER_THREAD = 1319,
    /** 1320: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Replace the device. */
    ERR_ADM_WIN_CORE_RENDER_NOT_STARTUP = 1320,
    /** 1322: Audio device module: No audio sampling device is available.
     * Solutions: Plug in a proper recording device. */
    ERR_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322,
    /** 1323: Audio device module: No audio playout device is available.
     * Solutions: Plug in a proper playback device.*/
    ERR_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323,
    /** 1351: Audio device module: An audio driver abnormality or a
     * compatibility issue occurs. Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_INIT = 1351,
    /** 1353: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_INIT_RECORDING = 1353,
    /** 1354: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_INIT_MICROPHONE = 1354,
    /** 1355: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_INIT_PLAYOUT = 1355,
    /** 1356: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_INIT_SPEAKER = 1356,
    /** 1357: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver. */
    ERR_ADM_WIN_WAVE_START_RECORDING = 1357,
    /** 1358: Audio device module: An audio driver abnormality occurs.
     * Solutions:
     * - Disable and then re-enable the audio device.
     * - Reboot the system.
     * - Upgrade your audio card driver.*/
    ERR_ADM_WIN_WAVE_START_PLAYOUT = 1358,
    /** 1359: Audio Device Module: No recording device exists.
     */
    ERR_ADM_NO_RECORDING_DEVICE = 1359,
    /** 1360: Audio Device Module: No playback device exists.
     */
    ERR_ADM_NO_PLAYOUT_DEVICE = 1360,
    // VDM error code starts from 1500
    /** 1501: Video Device Module: The camera is unauthorized.
     */
    ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501,
    // VDM error code starts from 1500
    /** **DEPRECATED** 1502: Video Device Module: The camera in use.
     Deprecated as of v2.4.1. Use LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY(3) in the \ref ar::rtc::IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" callback instead.
     */
    ERR_VDM_WIN_DEVICE_IN_USE = 1502,
    // VCM error code starts from 1600
    /** 1600: Video Device Module: An unknown error occurs.
     */
    ERR_VCM_UNKNOWN_ERROR = 1600,
    /** 1601: Video Device Module: An error occurs in initializing the video encoder.
    */
    ERR_VCM_ENCODER_INIT_ERROR = 1601,
    /** 1602: Video Device Module: An error occurs in encoding.
     */
    ERR_VCM_ENCODER_ENCODE_ERROR = 1602,
    /** 1603: Video Device Module: An error occurs in setting the video encoder.
     */
    ERR_VCM_ENCODER_SET_ERROR = 1603,
};
    /** Output log filter level. */
enum LOG_FILTER_TYPE
{
/** 0: Do not output any log information. */
    LOG_FILTER_OFF = 0,
     /** 0x080f: Output all log information.
      Set your log filter as debug if you want to get the most complete log file.      */
    LOG_FILTER_DEBUG = 0x080f,
     /** 0x000f: Output CRITICAL, ERROR, WARNING, and INFO level log information.
      We recommend setting your log filter as this level.
      */
    LOG_FILTER_INFO = 0x000f,
     /** 0x000e: Outputs CRITICAL, ERROR, and WARNING level log information.
      */
    LOG_FILTER_WARN = 0x000e,
     /** 0x000c: Outputs CRITICAL and ERROR level log information. */
    LOG_FILTER_ERROR = 0x000c,
     /** 0x0008: Outputs CRITICAL level log information. */
    LOG_FILTER_CRITICAL = 0x0008,
    LOG_FILTER_MASK = 0x80f,
};
/** The output log level of the SDK.
 *
 * @since v3.3.0
 */
enum class LOG_LEVEL {
  /** 0: Do not output any log. */
  LOG_LEVEL_NONE = 0x0000,
  /** 0x0001: (Default) Output logs of the FATAL, ERROR, WARN and INFO level. We recommend setting your log filter as this level.
   */
  LOG_LEVEL_INFO = 0x0001,
  /** 0x0002: Output logs of the FATAL, ERROR and WARN level.
   */
  LOG_LEVEL_WARN = 0x0002,
  /** 0x0004: Output logs of the FATAL and ERROR level.  */
  LOG_LEVEL_ERROR = 0x0004,
  /** 0x0008: Output logs of the FATAL level.  */
  LOG_LEVEL_FATAL = 0x0008,
};
} // namespace ar
#endif
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/ArMediaBase.h
New file
@@ -0,0 +1,400 @@
//
//  anyrtc Engine SDK
//
//  Created by Sting Feng in 2017-11.
//  Copyright (c) 2017 anyrtc.io. All rights reserved.
#ifndef __AR_MEDIA_BASE_H__  // NOLINT(build/header_guard)
#define __AR_MEDIA_BASE_H__
#include <stdint.h>
#include <stddef.h>
namespace ar {
namespace media {
namespace base {
typedef void* view_t;
typedef const char* user_id_t;
/** The video pixel format.
 */
enum VIDEO_PIXEL_FORMAT {
  /** 0: The video pixel format is unknown.
   */
  VIDEO_PIXEL_UNKNOWN = 0,
  /** 1: The video pixel format is I420.
   */
  VIDEO_PIXEL_I420 = 1,
  /** 2: The video pixel format is BGRA.
   */
  VIDEO_PIXEL_BGRA = 2,
  /** 3: Planar YUV 4:2:2 format.
   */
  VIDEO_PIXEL_I422 = 3,
  /** 2: The video pixel format is RGBA.
   */
  VIDEO_PIXEL_RGBA = 4,
  /** 8: The video pixel format is NV12.
   */
  VIDEO_PIXEL_NV12 = 8,
};
/**
 * The video display mode.
 */
enum RENDER_MODE_TYPE {
  /**
   * 1: Uniformly scale the video until it fills the visible boundaries
   * (cropped). One dimension of the video may have clipped contents.
   */
  RENDER_MODE_HIDDEN = 1,
  /**
   * 2: Uniformly scale the video until one of its dimension fits the boundary
   * (zoomed to fit). Areas that are not filled due to the disparity in the
   * aspect ratio will be filled with black.
   */
  RENDER_MODE_FIT = 2,
  /**
   * @deprecated
   * 3: This mode is deprecated.
   */
  RENDER_MODE_ADAPTIVE = 3,
};
/** Definition of VideoFrame.
The video data format is in YUV420. The buffer provides a pointer to a pointer. However, the
interface cannot modify the pointer of the buffer, but can only modify the content of the buffer.
*/
struct VideoFrame {
  VIDEO_PIXEL_FORMAT type;
  /** Video pixel width.
   */
  int width;  // width of video frame
  /** Video pixel height.
   */
  int height;  // height of video frame
  /** Line span of Y buffer in YUV data.
   */
  int yStride;  // stride of Y data buffer
  /** Line span of U buffer in YUV data.
   */
  int uStride;  // stride of U data buffer
  /** Line span of V buffer in YUV data.
   */
  int vStride;  // stride of V data buffer
  /** Pointer to the Y buffer pointer in the YUV data.
   */
  uint8_t* yBuffer;  // Y data buffer
  /** Pointer to the U buffer pointer in the YUV data.
   */
  uint8_t* uBuffer;  // U data buffer
  /** Pointer to the V buffer pointer in the YUV data
   */
  uint8_t* vBuffer;  // V data buffer
  /** Set the rotation of this frame before rendering the video, and it supports 0, 90, 180, 270
   * degrees clockwise.
   */
  int rotation;  // rotation of this frame (0, 90, 180, 270)
  /** Timestamp to render the video stream. It instructs the users to use this timestamp to
  synchronize the video stream render while rendering the video streams.
  Note: This timestamp is for rendering the video stream, not for capturing the video stream.
  */
  int64_t renderTimeMs;
  int avsync_type;
};
/**
 * The struct of AudioPcmFrame.
 */
struct AudioPcmFrame {
  /**
   * The buffer size of the PCM audio frame.
   */
  enum : size_t {
    // Stereo, 32 kHz, 60 ms (2 * 32 * 60)
    kMaxDataSizeSamples = 3840,
    kMaxDataSizeBytes = kMaxDataSizeSamples * sizeof(int16_t),
  };
  AudioPcmFrame() {}
  uint32_t capture_timestamp = 0;
  size_t samples_per_channel_ = 0;
  int sample_rate_hz_ = 0;
  size_t num_channels_ = 0;
  size_t bytes_per_sample = 0;
  int16_t data_[kMaxDataSizeSamples] = {0};
  AudioPcmFrame(const AudioPcmFrame& frame) = delete;
  void operator=(const AudioPcmFrame& frame) = delete;
};
class IVideoFrameObserver {
 public:
  virtual void onFrame(const VideoFrame* frame) = 0;
  virtual ~IVideoFrameObserver() {}
};
class IAudioFrameObserver {
 public:
  virtual void onFrame(const AudioPcmFrame* frame) = 0;
  virtual ~IAudioFrameObserver() {}
};
}  // namespace base
}  // namespace media
}  // namespace ar
namespace ar {
namespace media {
/**
 * @brief Player state
 *
 */
enum MEDIA_PLAYER_STATE {
  /** Default state
   */
  PLAYER_STATE_IDLE = 0,
  /** Opening media file
   */
  PLAYER_STATE_OPENING = 1,
  /** Media file opened successfully
   *
   */
  PLAYER_STATE_OPEN_COMPLETED = 2,
  /** Player playing
   */
  PLAYER_STATE_PLAYING = 3,
  /** Player paused
   */
  PLAYER_STATE_PAUSED = 4,
  /** Player playback complete
   */
  PLAYER_STATE_PLAYBACK_COMPLETED = 5,
  /** Player stopped
   */
  PLAYER_STATE_STOPPED = 6,
  /** Player failed
   */
  PLAYER_STATE_FAILED = 100,
};
/**
 * @brief Player error code
 *
 */
enum MEDIA_PLAYER_ERROR {
  /** No error
   */
  PLAYER_ERROR_NONE = 0,
  /** The parameter is incorrect
   */
  PLAYER_ERROR_INVALID_ARGUMENTS = -1,
  /** Internel error
   */
  PLAYER_ERROR_INTERNAL = -2,
  /** No resource error
   */
  PLAYER_ERROR_NO_RESOURCE = -3,
  /** Media source is invalid
   */
  PLAYER_ERROR_INVALID_MEDIA_SOURCE = -4,
  /** Unknown stream type
   */
  PLAYER_ERROR_UNKNOWN_STREAM_TYPE = -5,
  /** Object is not initialized
   */
  PLAYER_ERROR_OBJ_NOT_INITIALIZED = -6,
  /** Decoder codec not supported
   */
  PLAYER_ERROR_CODEC_NOT_SUPPORTED = -7,
  /** Video renderer is invalid
   */
  PLAYER_ERROR_VIDEO_RENDER_FAILED = -8,
  /** Internal state error
   */
  PLAYER_ERROR_INVALID_STATE = -9,
  /** Url not found
   */
  PLAYER_ERROR_URL_NOT_FOUND = -10,
  /** Invalid connection state
   */
  PLAYER_ERROR_INVALID_CONNECTION_STATE = -11,
  /** Insufficient buffer data
   */
  PLAY_ERROR_SRC_BUFFER_UNDERFLOW = -12,
};
/**
 * @brief Media stream type
 *
 */
enum MEDIA_STREAM_TYPE {
  /** Unknown stream type
   */
  STREAM_TYPE_UNKNOWN = 0,
  /** Video stream
   */
  STREAM_TYPE_VIDEO = 1,
  /** Audio stream
   */
  STREAM_TYPE_AUDIO = 2,
  /** Subtitle stream
   */
  STREAM_TYPE_SUBTITLE = 3,
};
/**
 * @brief Playback speed type
 *
 */
enum MEDIA_PLAYER_PLAY_SPEED {
  /** origin playback speed
   */
  ORIGIN_PLAYBACK_SPEED = 100,
  /** playback speed slow down to 0.75
   */
  PLAYBACK_SPEED_75_PERCENT = 75,
  /** playback speed slow down to 0.5
   */
  PLAYBACK_SPEED_50_PERCENT = 50,
  /** playback speed speed up to 1.25
   */
  PLAYBACK_SPEED_125_PERCENT = 125,
  /** playback speed speed up to 1.5
   */
  PLAYBACK_SPEED_150_PERCENT = 150,
    /** playback speed speed up to 2.0
   */
  PLAYBACK_SPEED_200_PERCENT = 200,
};
/**
 * @brief Player event
 *
 */
enum MEDIA_PLAYER_EVENT {
  /** seek complete
   */
  PLAYER_EVENT_SEEK_BEGIN = 0,
  /** seek complete
   */
  PLAYER_EVENT_SEEK_COMPLETE = 1,
  /** seek failed
   */
  PLAYER_EVENT_SEEK_ERROR = 2,
  /** player video published
   */
  PLAYER_EVENT_VIDEO_PUBLISHED = 3,
  /** player audio published
   */
  PLAYER_EVENT_AUDIO_PUBLISHED = 4,
  /** player audio track changed
   */
  PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5,
};
/**
 * @brief Media stream object
 *
 */
static const uint8_t kMaxCodecNameLength = 50;
struct MediaStreamInfo { /* the index of the stream in the media file */
  int streamIndex;
  /* stream type */
  MEDIA_STREAM_TYPE streamType;
  /* stream encoding name */
  char codecName[kMaxCodecNameLength];
  /* streaming language */
  char language[kMaxCodecNameLength];
  /* If it is a video stream, video frames rate */
  int videoFrameRate;
  /* If it is a video stream, video bit rate */
  int videoBitRate;
  /* If it is a video stream, video width */
  int videoWidth;
  /* If it is a video stream, video height */
  int videoHeight;
  /* If it is a video stream, video rotation */
  int videoRotation;
  /* If it is an audio stream, audio bit rate */
  int audioSampleRate;
  /* If it is an audio stream, the number of audio channels */
  int audioChannels;
  /* stream duration in second */
  int64_t duration;};
/**
 * @brief Player Metadata type
 *
 */
enum MEDIA_PLAYER_METADATA_TYPE {
  /** data type unknown
   */
  PLAYER_METADATA_TYPE_UNKNOWN = 0,
  /** sei data
   */
  PLAYER_METADATA_TYPE_SEI = 1,
};
}  // namespace media
namespace rtc {
/**
 * The audio route.
 */
enum AudioRoute
{
  /**
   * -1: The default audio route.
   */
  ROUTE_DEFAULT = -1,
  /**
   * The headset.
   */
  ROUTE_HEADSET,
  /**
   * The earpiece.
   */
  ROUTE_EARPIECE,
  /**
   * The headset with no microphone.
   */
  ROUTE_HEADSETNOMIC,
  /**
   * The speakerphone.
   */
  ROUTE_SPEAKERPHONE,
  /**
   * The loudspeaker.
   */
  ROUTE_LOUDSPEAKER,
  /**
   * The Bluetooth headset.
   */
  ROUTE_HEADSETBLUETOOTH
};
} // namespace rtc
}  // namespace ar
#endif // __AR_MEDIA_BASE_H__
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArMediaEngine.h
New file
@@ -0,0 +1,770 @@
#ifndef __I_AR_MEDIA_ENGINE_H__
#define __I_AR_MEDIA_ENGINE_H__
#include <stdint.h>
#define AM ar::media
namespace ar {
namespace media {
/** **DEPRECATED** Type of audio device.
 */
enum MEDIA_SOURCE_TYPE {
  /** Audio playback device.
   */
  AUDIO_PLAYOUT_SOURCE = 0,
  /** Microphone.
   */
  AUDIO_RECORDING_SOURCE = 1,
};
/**
 * The IAudioFrameObserver class.
 */
class IAudioFrameObserver {
 public:
  /** The frame type. */
  enum AUDIO_FRAME_TYPE {
    /** 0: PCM16. */
    FRAME_TYPE_PCM16 = 0,  // PCM 16bit little endian
  };
  /** Definition of AudioFrame */
  struct AudioFrame {
    /** The type of the audio frame. See #AUDIO_FRAME_TYPE
     */
    AUDIO_FRAME_TYPE type;
    /** The number of samples per channel in the audio frame.
    */
    int samples;  //number of samples for each channel in this frame
    /**The number of bytes per audio sample, which is usually 16-bit (2-byte).
     */
    int bytesPerSample;  //number of bytes per sample: 2 for PCM16
    /** The number of audio channels.
     - 1: Mono
     - 2: Stereo (the data is interleaved)
     */
    int channels;  //number of channels (data are interleaved if stereo)
    /** The sample rate.
     */
    int samplesPerSec;  //sampling rate
    /** The data buffer of the audio frame. When the audio frame uses a stereo channel, the data buffer is interleaved.
     The size of the data buffer is as follows: `buffer` = `samples` × `channels` × `bytesPerSample`.
     */
    void* buffer;  //data buffer
      /** The timestamp (ms) of the external audio frame. You can use this parameter for the following purposes:
       - Restore the order of the captured audio frame.
       - Synchronize audio and video frames in video-related scenarios, including where external video sources are used.
       */
    int64_t renderTimeMs;
    /** Reserved parameter.
    */
    int avsync_type;
  };
 public:
  /** Retrieves the recorded audio frame.
  The SDK triggers this callback once every 10 ms.
   @param audioFrame Pointer to AudioFrame.
   @return
   - true: Valid buffer in AudioFrame, and the recorded audio frame is sent out.
   - false: Invalid buffer in AudioFrame, and the recorded audio frame is discarded.
   */
  virtual bool onRecordAudioFrame(AudioFrame& audioFrame) = 0;
  /** Retrieves the audio playback frame every 10 ms for getting the audio.
   @param audioFrame Pointer to AudioFrame.
   @return
   - true: Valid buffer in AudioFrame, and the audio playback frame is sent out.
   - false: Invalid buffer in AudioFrame, and the audio playback frame is discarded.
   */
  virtual bool onPlaybackAudioFrame(AudioFrame& audioFrame) = 0;
  /** Retrieves the mixed recorded and playback audio frame.
   @note This callback only returns the single-channel data.
   @param audioFrame Pointer to AudioFrame.
   @return
   - true: Valid buffer in AudioFrame and the mixed recorded and playback audio frame is sent out.
   - false: Invalid buffer in AudioFrame and the mixed recorded and playback audio frame is discarded.
   */
  virtual bool onMixedAudioFrame(AudioFrame& audioFrame) = 0;
  /** Retrieves the audio frame of a specified user before mixing.
  The SDK triggers this callback if isMultipleChannelFrameWanted returns false.
  @param uid The user ID
  @param audioFrame Pointer to AudioFrame.
  @return
  - true: Valid buffer in AudioFrame, and the mixed recorded and playback audio frame is sent out.
  - false: Invalid buffer in AudioFrame, and the mixed recorded and playback audio frame is discarded.
  */
  virtual bool onPlaybackAudioFrameBeforeMixing(const char* uid,
      AudioFrame& audioFrame) = 0;
  /** Determines whether to receive audio data from multiple channels.
   @since v3.0.1
   After you register the audio frame observer, the SDK triggers this callback every time it captures an audio frame.
   In the multi-channel scenario, if you want to get audio data from multiple channels,
   set the return value of this callback as true. After that, the SDK triggers the
   \ref IAudioFrameObserver::onPlaybackAudioFrameBeforeMixingEx "onPlaybackAudioFrameBeforeMixingEx" callback to send you the before-mixing
   audio data from various channels. You can also get the channel ID of each audio frame.
   @note
   - Once you set the return value of this callback as true, the SDK triggers
   only the \ref IAudioFrameObserver::onPlaybackAudioFrameBeforeMixingEx "onPlaybackAudioFrameBeforeMixingEx" callback
   to send the before-mixing audio frame. \ref IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing "onPlaybackAudioFrameBeforeMixing" is not triggered.
   In the multi-channel scenario, AR recommends setting the return value as true.
   - If you set the return value of this callback as false, the SDK triggers only the `onPlaybackAudioFrameBeforeMixing` callback to send the audio data.
   @return
   - `true`: Receive audio data from multiple channels.
   - `false`: Do not receive audio data from multiple channels.
   */
  virtual bool isMultipleChannelFrameWanted() { return false; }
  /** Gets the before-mixing playback audio frame from multiple channels.
  After you successfully register the audio frame observer, if you set the return
  value of \ref IAudioFrameObserver::isMultipleChannelFrameWanted "isMultipleChannelFrameWanted" as true, the SDK triggers this callback each
  time it receives a before-mixing audio frame from any of the channel.
  @param channelId The channel ID of this audio frame.
  @param uid The ID of the user sending this audio frame.
  @param audioFrame The pointer to AudioFrame.
  @return
  - `true`: The data in AudioFrame is valid, and send this audio frame.
  - `false`: The data in AudioFrame in invalid, and do not send this audio frame.
  */
  virtual bool onPlaybackAudioFrameBeforeMixingEx(const char *channelId,
      const char* uid, AudioFrame& audioFrame) { return true; }
};
/**
 * The IVideoFrameObserver class.
 */
class IVideoFrameObserver {
 public:
 /** The video frame type. */
  enum VIDEO_FRAME_TYPE {
    /**
     * 0: YUV420
     */
    FRAME_TYPE_YUV420 = 0,  // YUV 420 format
    /**
     * 1: YUV422
     */
    FRAME_TYPE_YUV422 = 1,  // YUV 422 format
    /**
     * 2: RGBA
     */
    FRAME_TYPE_RGBA = 2,    // RGBA format
  };
  /**
   * The frame position of the video observer.
   */
  enum VIDEO_OBSERVER_POSITION {
    /**
     * 1: The post-capturer position, which corresponds to the video data in the onCaptureVideoFrame callback.
     */
    POSITION_POST_CAPTURER = 1 << 0,
    /**
     * 2: The pre-renderer position, which corresponds to the video data in the onRenderVideoFrame callback.
     */
    POSITION_PRE_RENDERER = 1 << 1,
    /**
     * 4: The pre-encoder position, which corresponds to the video data in the onPreEncodeVideoFrame callback.
     */
    POSITION_PRE_ENCODER = 1 << 2,
  };
  /** Video frame information. The video data format is YUV420. The buffer provides a pointer to a pointer. The interface cannot modify the pointer of the buffer, but can modify the content of the buffer only.
   */
  struct VideoFrame {
    VIDEO_FRAME_TYPE type;
    /** Video pixel width.
     */
    int width;  //width of video frame
    /** Video pixel height.
     */
    int height;  //height of video frame
    /** Line span of the Y buffer within the YUV data.
     */
    int yStride;  //stride of Y data buffer
    /** Line span of the U buffer within the YUV data.
     */
    int uStride;  //stride of U data buffer
    /** Line span of the V buffer within the YUV data.
     */
    int vStride;  //stride of V data buffer
    /** Pointer to the Y buffer pointer within the YUV data.
     */
    void* yBuffer;  //Y data buffer
    /** Pointer to the U buffer pointer within the YUV data.
     */
    void* uBuffer;  //U data buffer
    /** Pointer to the V buffer pointer within the YUV data.
     */
    void* vBuffer;  //V data buffer
    /** Set the rotation of this frame before rendering the video. Supports 0, 90, 180, 270 degrees clockwise.
     */
    int rotation; // rotation of this frame (0, 90, 180, 270)
      /** The timestamp of the external audio frame. It is mandatory. You can use this parameter for the following purposes:
       - Restore the order of the captured audio frame.
       - Synchronize audio and video frames in video-related scenarios, including scenarios where external video sources are used.
     @note This timestamp is for rendering the video stream, and not for capturing the video stream.
     */
    int64_t renderTimeMs;
    int avsync_type;
  };
 public:
  /** Occurs each time the SDK receives a video frame captured by the local camera.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback,
   * you can get the video data captured by the local camera. You can then pre-process the data according to your scenarios.
   *
   * After pre-processing, you can send the processed video data back to the SDK by setting the `videoFrame` parameter in this callback.
   *
   * @note
   * This callback does not support sending processed RGBA video data back to the SDK.
   *
   * @param videoFrame Pointer to VideoFrame.
   * @return Whether or not to ignore the current video frame if the pre-processing fails:
   * - true: Do not ignore.
   * - false: Ignore the current video frame, and do not send it back to the SDK.
   */
  virtual bool onCaptureVideoFrame(VideoFrame& videoFrame) = 0;
  /** Occurs each time the SDK receives a video frame before encoding.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time when it receives a video frame. In this callback, you can get the video data before encoding. You can then process the data according to your particular scenarios.
   *
   * After processing, you can send the processed video data back to the SDK by setting the `VideoFrame` parameter in this callback.
   *
   * @note
   * - The video data that this callback gets has been pre-processed, with its content cropped, rotated, and the image enhanced.
   * - This callback does not support sending processed RGBA video data back to the SDK.
   *
   * @param videoFrame A pointer to VideoFrame
   * @return Whether to ignore the current video frame if the processing fails:
   * - true: Do not ignore the current video frame.
   * - false: Ignore the current video frame, and do not send it back to the SDK.
   */
  virtual bool onPreEncodeVideoFrame(VideoFrame& videoFrame) { return true; }
  /** Occurs each time the SDK receives a video encoded data after encoding.
  *
  * After you successfully register the video frame observer, the SDK triggers this callback each time when it receives a video frame. In this callback, you can get the video enccoded data after encoding. You can then process the data according to your particular scenarios.
  */
  virtual bool onEncodeVideoData(bool keyFrame, const char*vidData, int vidLen) { return true; }
  /** Occurs each time the SDK receives a video frame sent by the remote user.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback,
   * you can get the video data sent by the remote user. You can then post-process the data according to your scenarios.
   *
   * After post-processing, you can send the processed data back to the SDK by setting the `videoFrame` parameter in this callback.
   *
   * @note
   * This callback does not support sending processed RGBA video data back to the SDK.
   *
   * @param uid ID of the remote user who sends the current video frame.
   * @param videoFrame Pointer to VideoFrame.
   * @return Whether or not to ignore the current video frame if the post-processing fails:
   * - true: Do not ignore.
   * - false: Ignore the current video frame, and do not send it back to the SDK.
   */
  virtual bool onRenderVideoFrame(const char* uid, VideoFrame& videoFrame) = 0;
  /** Occurs each time the SDK receives a video frame and prompts you to set the video format.
   *
   * YUV420 is the default video format. If you want to receive other video formats, register this callback in the IVideoFrameObserver class.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame.
   * You need to set your preferred video data in the return value of this callback.
   *
   * @return Sets the video format: #VIDEO_FRAME_TYPE
   * - #FRAME_TYPE_YUV420 (0): (Default) YUV420.
   * - #FRAME_TYPE_RGBA (2): RGBA
   */
  virtual VIDEO_FRAME_TYPE getVideoFormatPreference() { return FRAME_TYPE_YUV420; }
  /** Occurs each time the SDK receives a video frame and prompts you whether or not to rotate the captured video according to the rotation member in the VideoFrame class.
   *
   * The SDK does not rotate the captured video by default. If you want to rotate the captured video according to the rotation member in the VideoFrame class, register this callback in the IVideoFrameObserver class.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. You need to set whether or not to rotate the video frame in the return value of this callback.
   *
   * @note
   * This callback applies to RGBA video data only.
   *
   * @return Sets whether or not to rotate the captured video:
   * - true: Rotate.
   * - false: (Default) Do not rotate.
   */
  virtual bool getRotationApplied() { return false; }
  /** Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video.
   *
   * The SDK does not mirror the captured video by default. Register this callback in the IVideoFrameObserver class if you want to mirror the captured video.
   *
   * After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received.
   * You need to set whether or not to mirror the captured video in the return value of this callback.
   *
   * @note
   * This callback applies to RGBA video data only.
   *
   * @return Sets whether or not to mirror the captured video:
   * - true: Mirror.
   * - false: (Default) Do not mirror.
   */
  virtual bool getMirrorApplied() { return false; }
  /** @since v3.0.0
   Sets whether to output the acquired video frame smoothly.
   If you want the video frames acquired from \ref IVideoFrameObserver::onRenderVideoFrame "onRenderVideoFrame" to be more evenly spaced, you can register the `getSmoothRenderingEnabled` callback in the `IVideoFrameObserver` class and set its return value as `true`.
   @note
   - Register this callback before joining a channel.
   - This callback applies to scenarios where the acquired video frame is self-rendered after being processed, not to scenarios where the video frame is sent back to the SDK after being processed.
   @return Set whether or not to smooth the video frames:
   - true: Smooth the video frame.
   - false: (Default) Do not smooth.
   */
  virtual bool getSmoothRenderingEnabled(){ return false; }
  /**
   * Sets the frame position for the video observer.
   * @since v3.0.1
   *
   * After you successfully register the video observer, the SDK triggers this callback each time it receives a video frame. You can determine which position to observe by setting the return value.
   * The SDK provides 3 positions for observer. Each position corresponds to a callback function:
   * - `POSITION_POST_CAPTURER(1 << 0)`: The position after capturing the video data, which corresponds to the \ref onCaptureVideoFrame "onCaptureVideoFrame" callback.
   * - `POSITION_PRE_RENDERER(1 << 1)`: The position before receiving the remote video data, which corresponds to the \ref onRenderVideoFrame "onRenderVideoFrame" callback.
   * - `POSITION_PRE_ENCODER(1 << 2)`: The position before encoding the video data, which corresponds to the \ref onPreEncodeVideoFrame "onPreEncodeVideoFrame" callback.
   *
   * @note
   * - Use '|' (the OR operator) to observe multiple frame positions.
   * - This callback observes `POSITION_POST_CAPTURER(1 << 0)` and `POSITION_PRE_RENDERER(1 << 1)` by default.
   * - To conserve the system consumption, you can reduce the number of frame positions that you want to observe.
   *
   * @return A bit mask that controls the frame position of the video observer: #VIDEO_OBSERVER_POSITION.
   *
   */
  virtual uint32_t getObservedFramePosition() { return static_cast<uint32_t>(POSITION_POST_CAPTURER | POSITION_PRE_RENDERER); }
  /** Determines whether to receive video data from multiple channels.
   After you register the video frame observer, the SDK triggers this callback
   every time it captures a video frame.
   In the multi-channel scenario, if you want to get video data from multiple channels,
   set the return value of this callback as true. After that, the SDK triggers the
   onRenderVideoFrameEx callback to send you
   the video data from various channels. You can also get the channel ID of each video frame.
   @note
   - Once you set the return value of this callback as true, the SDK triggers only the `onRenderVideoFrameEx` callback to
   send the video frame. onRenderVideoFrame will not be triggered. In the multi-channel scenario, AR recommends setting the return value as true.
   - If you set the return value of this callback as false, the SDK triggers only the `onRenderVideoFrame` callback to send the video data.
   @return
   - `true`: Receive video data from multiple channels.
   - `false`: Do not receive video data from multiple channels.
   */
  virtual bool isMultipleChannelFrameWanted() { return false; }
  /** Gets the video frame from multiple channels.
   After you successfully register the video frame observer, if you set the return value of
   isMultipleChannelFrameWanted as true, the SDK triggers this callback each time it receives a video frame
   from any of the channel.
   You can process the video data retrieved from this callback according to your scenario, and send the
   processed data back to the SDK using the `videoFrame` parameter in this callback.
   @note This callback does not support sending RGBA video data back to the SDK.
   @param channelId The channel ID of this video frame.
   @param uid The ID of the user sending this video frame.
   @param videoFrame The pointer to VideoFrame.
   @return Whether to send this video frame to the SDK if post-processing fails:
   - `true`: Send this video frame.
   - `false`: Do not send this video frame.
   */
  virtual bool onRenderVideoFrameEx(const char *channelId, const char* uid, VideoFrame& videoFrame) { return true; }
};
class IVideoFrame {
 public:
  enum PLANE_TYPE {
    Y_PLANE = 0,
    U_PLANE = 1,
    V_PLANE = 2,
    NUM_OF_PLANES = 3
  };
  enum VIDEO_TYPE {
    VIDEO_TYPE_UNKNOWN = 0,
    VIDEO_TYPE_I420 = 1,
    VIDEO_TYPE_IYUV = 2,
    VIDEO_TYPE_RGB24 = 3,
    VIDEO_TYPE_ABGR = 4,
    VIDEO_TYPE_ARGB = 5,
    VIDEO_TYPE_ARGB4444 = 6,
    VIDEO_TYPE_RGB565 = 7,
    VIDEO_TYPE_ARGB1555 = 8,
    VIDEO_TYPE_YUY2 = 9,
    VIDEO_TYPE_YV12 = 10,
    VIDEO_TYPE_UYVY = 11,
    VIDEO_TYPE_MJPG = 12,
    VIDEO_TYPE_NV21 = 13,
    VIDEO_TYPE_NV12 = 14,
    VIDEO_TYPE_BGRA = 15,
    VIDEO_TYPE_RGBA = 16,
    VIDEO_TYPE_I422 = 17,
  };
  virtual void release() = 0;
  virtual const unsigned char* buffer(PLANE_TYPE type) const = 0;
  /** Copies the frame.
   If the required size is larger than the allocated size, new buffers of the adequate size will be allocated.
   @param dest_frame Address of the returned destination frame. See IVideoFrame.
   @return
   - 0: Success.
   - -1: Failure.
   */
  virtual int copyFrame(IVideoFrame** dest_frame) const = 0;
  /** Converts the frame.
   @note The source and destination frames have equal heights.
   @param dst_video_type Type of the output video.
   @param dst_sample_size Required only for the parsing of M-JPEG.
   @param dst_frame Pointer to a destination frame. See IVideoFrame.
   @return
   - 0: Success.
   - < 0: Failure.
   */
  virtual int convertFrame(VIDEO_TYPE dst_video_type, int dst_sample_size,
                           unsigned char* dst_frame) const = 0;
  /** Retrieves the specified component in the YUV space.
   @param type Component type: #PLANE_TYPE
   */
  virtual int allocated_size(PLANE_TYPE type) const = 0;
  /** Retrieves the stride of the specified component in the YUV space.
   @param type Component type: #PLANE_TYPE
   */
  virtual int stride(PLANE_TYPE type) const = 0;
  /** Retrieves the width of the frame.
   */
  virtual int width() const = 0;
  /** Retrieves the height of the frame.
   */
  virtual int height() const = 0;
  /** Retrieves the timestamp (90 ms) of the frame.
   */
  virtual unsigned int timestamp() const = 0;
  /** Retrieves the render time (ms).
   */
  virtual int64_t render_time_ms() const = 0;
  /** Checks if a plane is of zero size.
   @return
   - true: The plane is of zero size.
   - false: The plane is not of zero size.
   */
  virtual bool IsZeroSize() const = 0;
  virtual VIDEO_TYPE GetVideoType() const = 0;
};
/** **DEPRECATED** */
class IExternalVideoRenderCallback {
 public:
  /** Occurs when the video view size has changed.
  */
  virtual void onViewSizeChanged(int width, int height) = 0;
  /** Occurs when the video view is destroyed.
  */
  virtual void onViewDestroyed() = 0;
};
/** **DEPRECATED** */
struct ExternalVideoRenerContext {
  IExternalVideoRenderCallback* renderCallback;
  /** Video display window.
   */
  void* view;
  /** Video display mode: \ref ar::rtc::RENDER_MODE_TYPE "RENDER_MODE_TYPE" */
  int renderMode;
  /** The image layer location.
   - 0: (Default) The image is at the bottom of the stack
   - 100: The image is at the top of the stack.
   @note If the value is set to below 0 or above 100, the #ERR_INVALID_ARGUMENT error occurs.
   */
  int zOrder;
  /** Video layout distance from the left.
   */
  float left;
  /** Video layout distance from the top.
   */
  float top;
  /** Video layout distance from the right.
   */
  float right;
  /** Video layout distance from the bottom.
   */
  float bottom;
};
class IExternalVideoRender {
 public:
  virtual void release() = 0;
  virtual int initialize() = 0;
  virtual int deliverFrame(const IVideoFrame& videoFrame, int rotation,
                           bool mirrored) = 0;
};
class IExternalVideoRenderFactory {
 public:
  virtual IExternalVideoRender* createRenderInstance(
      const ExternalVideoRenerContext& context) = 0;
};
/** The external video frame.
 */
struct ExternalVideoFrame
{
    /** The video buffer type.
     */
    enum VIDEO_BUFFER_TYPE
    {
        /** 1: The video buffer in the format of raw data.
         */
        VIDEO_BUFFER_RAW_DATA = 1,
        /** 10: The video buffer in the format of h264 extra data.
        */
        VIDEO_BUFFER_H264_EXTRA_DATA = 10,
        /** 11: The video buffer in the format of h264 data.
        */
        VIDEO_BUFFER_H264_DATA = 11,
    };
    /** The video pixel format.
     */
    enum VIDEO_PIXEL_FORMAT
    {
        /** 0: The video pixel format is unknown.
         */
        VIDEO_PIXEL_UNKNOWN = 0,
        /** 1: The video pixel format is I420.
         */
        VIDEO_PIXEL_I420 = 1,
        /** 2: The video pixel format is BGRA.
         */
        VIDEO_PIXEL_BGRA = 2,
        /** 3: The video pixel format is NV21.
         */
        VIDEO_PIXEL_NV21 = 3,
        /** 4: The video pixel format is RGBA.
         */
        VIDEO_PIXEL_RGBA = 4,
        /** 5: The video pixel format is IMC2.
         */
        VIDEO_PIXEL_IMC2 = 5,
        /** 7: The video pixel format is ARGB.
         */
        VIDEO_PIXEL_ARGB = 7,
        /** 8: The video pixel format is NV12.
         */
        VIDEO_PIXEL_NV12 = 8,
        /** 16: The video pixel format is I422.
         */
        VIDEO_PIXEL_I422 = 16,
        /** 32: The video is key frame.
        */
        VIDEO_KEY_FRAME = 32,
        /** 64: The video is normal frame.
        */
        VIDEO_NOR_FRAME = 64,
    };
    /** The buffer type. See #VIDEO_BUFFER_TYPE
     */
    VIDEO_BUFFER_TYPE type;
    /** The pixel format. See #VIDEO_PIXEL_FORMAT
     */
    VIDEO_PIXEL_FORMAT format;
    /** The video buffer.
     */
    void* buffer;
    /** The length of video buffer.
     */
    int length;
    /** Line spacing of the incoming video frame, which must be in pixels instead of bytes. For textures, it is the width of the texture.
     */
    int stride;
    /** Width of the incoming video frame.
     */
    int width;
    /** Height of the incoming video frame.
     */
    int height;
    /** [Raw data related parameter] The number of pixels trimmed from the left. The default value is 0.
     */
    int cropLeft;
    /** [Raw data related parameter] The number of pixels trimmed from the top. The default value is 0.
     */
    int cropTop;
    /** [Raw data related parameter] The number of pixels trimmed from the right. The default value is 0.
     */
    int cropRight;
    /** [Raw data related parameter] The number of pixels trimmed from the bottom. The default value is 0.
     */
    int cropBottom;
    /** [Raw data related parameter] The clockwise rotation of the video frame. You can set the rotation angle as 0, 90, 180, or 270. The default value is 0.
     */
    int rotation;
    /** Timestamp of the incoming video frame (ms). An incorrect timestamp results in frame loss or unsynchronized audio and video.
     */
    long long timestamp;
    ExternalVideoFrame()
    :cropLeft(0)
    ,cropTop(0)
    ,cropRight(0)
    ,cropBottom(0)
    ,rotation(0)
    {}
};
class IMediaEngine {
 public:
  virtual void release() = 0;
  /** Registers an audio frame observer object.
   This method is used to register an audio frame observer object (register a callback). This method is required to register callbacks when the engine is required to provide an \ref IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" or \ref IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback.
   @param observer Audio frame observer object instance. If NULL is passed in, the registration is canceled.
   @return
   - 0: Success.
   - < 0: Failure.
   */
  virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0;
  /** Registers a video frame observer object.
   You need to implement the IVideoFrameObserver class in this method, and register callbacks according to your scenarios.
   After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.
   @note When handling the video data returned in the callbacks, pay attention to the changes in the `width` and `height` parameters,
   which may be adapted under the following circumstances:
   - When the network condition deteriorates, the video resolution decreases incrementally.
   - If the user adjusts the video profile, the resolution of the video returned in the callbacks also changes.
   @param observer Video frame observer object instance. If NULL is passed in, the registration is canceled.
   @return
   - 0: Success.
   - < 0: Failure.
   */
  virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0;
  /** **DEPRECATED** */
  virtual int registerVideoRenderFactory(IExternalVideoRenderFactory* factory) = 0;
  /** **DEPRECATED** Use \ref ar::media::IMediaEngine::pushAudioFrame(IAudioFrameObserver::AudioFrame* frame) "pushAudioFrame(IAudioFrameObserver::AudioFrame* frame)" instead.
   Pushes the external audio frame.
   @param type Type of audio capture device: #MEDIA_SOURCE_TYPE.
   @param frame Audio frame pointer: \ref IAudioFrameObserver::AudioFrame "AudioFrame".
   @param wrap Whether to use the placeholder. We recommend setting the default value.
   - true: Use.
   - false: (Default) Not use.
   @return
   - 0: Success.
   - < 0: Failure.
   */
  virtual int pushAudioFrame(MEDIA_SOURCE_TYPE type,
                             IAudioFrameObserver::AudioFrame* frame,
                             bool wrap) = 0;
  /** Pushes the external audio frame.
   @param frame Pointer to the audio frame: \ref IAudioFrameObserver::AudioFrame "AudioFrame".
   @return
   - 0: Success.
   - < 0: Failure.
   */
  virtual int pushAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0;
  /** Pulls the remote audio data.
   *
   * Before calling this method, call the
   * \ref ar::rtc::IRtcEngine::setExternalAudioSink
   * "setExternalAudioSink(enabled: true)" method to enable and set the
   * external audio sink.
   *
   * After a successful method call, the app pulls the decoded and mixed
   * audio data for playback.
   *
   * @note
   * - Once you call the \ref ar::media::IMediaEngine::pullAudioFrame
   * "pullAudioFrame" method successfully, the app will not retrieve any audio
   * data from the
   * \ref ar::media::IAudioFrameObserver::onPlaybackAudioFrame
   * "onPlaybackAudioFrame" callback.
   * - The difference between the
   * \ref ar::media::IAudioFrameObserver::onPlaybackAudioFrame
   * "onPlaybackAudioFrame" callback and the
   * \ref ar::media::IMediaEngine::pullAudioFrame "pullAudioFrame" method is as
   * follows:
   *  - `onPlaybackAudioFrame`: The SDK sends the audio data to the app once
   * every 10 ms. Any delay in processing the audio frames may result in audio
   * jitter.
   *  - `pullAudioFrame`: The app pulls the remote audio data. After setting the
   * audio data parameters, the SDK adjusts the frame buffer and avoids
   * problems caused by jitter in the external audio playback.
   *
   * @param frame Pointers to the audio frame.
   * See: \ref IAudioFrameObserver::AudioFrame "AudioFrame".
   *
   * @return
   * - 0: Success.
   * - < 0: Failure.
   */
  virtual int pullAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0;
    /** Configures the external video source.
    @param enable Sets whether to use the external video source:
    - true: Use the external video source.
    - false: (Default) Do not use the external video source.
    @param useTexture Sets whether to use texture as an input:
    - true: Use texture as an input.
    - false: (Default) Do not use texture as an input.
    @return
    - 0: Success.
    - < 0: Failure.
    */
    virtual int setExternalVideoSource(bool enable, bool useTexture) = 0;
    /** Pushes the video frame using the \ref ExternalVideoFrame "ExternalVideoFrame" and passes the video frame to the AR SDK.
     @param frame Video frame to be pushed. See \ref ExternalVideoFrame "ExternalVideoFrame".
     @note In the `COMMUNICATION` profile, this method does not support video frames in the Texture format.
     @return
     - 0: Success.
     - < 0: Failure.
     */
    virtual int pushVideoFrame(ExternalVideoFrame *frame) = 0;
    virtual void SetHeadset(bool bHead) = 0;
};
}  // namespace media
}  // namespace ar
#endif  // AR_MEDIA_ENGINE_H
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArMediaPlayer.h
New file
@@ -0,0 +1,378 @@
//
//  anyrtc Rtc Engine SDK
//
//  Copyright (c) 2019 anyrtc.io. All rights reserved.
//
#ifndef __I_AR_MEDIA_PLAYER_H__
#define __I_AR_MEDIA_PLAYER_H__
#include "ArMediaBase.h"
#ifndef AR
#define AR ar::rtc
#endif
// external key
/**
 * set analyze duration for real time stream
 * @example "setPlayerOption(KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION,1000000)"
 */
#define KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION    "analyzeduration"
/**
 * set the player disable to play audio
 * @example  "setPlayerOption(KEY_PLAYER_DISABLE_AUDIO,0)"
 */
#define KEY_PLAYER_DISABLE_AUDIO                  "audio_disable"
/**
 * set the player disable to play video
 * @example  "setPlayerOption(KEY_PLAYER_DISABLE_VIDEO,0)"
 */
#define KEY_PLAYER_DISABLE_VIDEO                  "video_disable"
namespace ar {
namespace rtc {
/** Definition of MediaPlayerContext.
 */
struct MediaPlayerContext {
  /** User Context, i.e., activity context in Android.
   */
  void* context;
  MediaPlayerContext()
      : context(nullptr) {}
};
class IMediaPlayerObserver;
/**
 * @brief Player interface
 *
 */
class IMediaPlayer {
 public:
  virtual int initialize(const MediaPlayerContext& context) = 0;
  /**
   * @brief Open media file
   *
   * @param src Media path, local path or network path
   * @param startPos Set the starting position for playback, in seconds
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int open(const char* src, int64_t startPos) = 0;
  /**
   * @brief Play
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int play() = 0;
  /**
   * @brief pause
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int pause() = 0;
  /**
   * @brief stop
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int stop() = 0;
  /**
   * @brief Play to a specified position
   *
   * @param pos The position to play, in seconds
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int seek(int64_t pos) = 0;
  /**
   * @brief Turn mute on or off
   *
   * @param mute Whether to mute on
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int mute(bool mute) = 0;
  /**
   * @brief Get mute state
   *
   * @param[out] mute Whether is mute on
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getMute(bool& mute) = 0;
  /**
   * @brief Adjust playback volume
   *
   * @param volume The volume value to be adjusted
   * The volume can be adjusted from 0 to 400:
   * 0: mute;
   * 100: original volume;
   * 400: Up to 4 times the original volume (with built-in overflow protection).
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int adjustPlayoutVolume(int volume) = 0;
  /**
   * @brief Get the current playback volume
   *
   * @param[out] volume
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getPlayoutVolume(int& volume) = 0;
  /**
   * @brief Get the current playback progress
   *
   * @param[out] pos Progress in seconds
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getPlayPosition(int64_t& pos) = 0;
  /**
   * @brief Get the current playback progress
   *
   * @param[out] pos Progress in millisecond
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getPlayPositionInMillisecond(int64_t& positionInMs) = 0;
  /**
   * @brief Get media duration
   *
   * @param[out] duration Duration in seconds
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getDuration(int64_t& duration) = 0;
  /**
   * @brief Get player state
   *
   * @return PLAYER_STATE
   */
  virtual ar::media::MEDIA_PLAYER_STATE getState() = 0;
  /**
   * @brief Get the streams info count in the media
   *
   * @param[out] count
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int getStreamCount(int& count) = 0;
  /**
   * @brief Get the streams info by index
   *
   * @param[in] index, index
   * @param[out] info, stream info for return
   */
  virtual int getStreamInfo(int index, ar::media::MediaStreamInfo* info) = 0;
  /**
   * @brief Set video rendering view
   *
   * @param view view object, windows platform is HWND
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int setView(ar::media::base::view_t view) = 0;
  /**
   * @brief Set video display mode
   *
   * @param renderMode Video display mode
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int setRenderMode(ar::media::base::RENDER_MODE_TYPE renderMode) = 0;
  /**
   * @brief Register the player observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int registerPlayerObserver(IMediaPlayerObserver* observer) = 0;
  /**
   * @brief Unregister the player observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int unregisterPlayerObserver(IMediaPlayerObserver* observer) = 0;
  /**
   * @brief Register the player video observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int registerVideoFrameObserver(ar::media::base::IVideoFrameObserver* observer) = 0;
  /**
   * @brief UnRegister the player video observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int unregisterVideoFrameObserver(ar::media::base::IVideoFrameObserver* observer) = 0;
  /**
   * @brief register the player audio observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int registerAudioFrameObserver(ar::media::base::IAudioFrameObserver* observer) = 0;
  /**
   * @brief Unregister the player audio observer
   *
   * @param observer observer object
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int unregisterAudioFrameObserver(ar::media::base::IAudioFrameObserver* observer) = 0;
  /**
   * @brief change log file position
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int setLogFile(const char* filePath) = 0;
  /**
   * Sets the output log level of the SDK.
   *
   * You can use one or a combination of the filters. The log level follows the
   * sequence of `OFF`, `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG`. Choose a level
   * and you will see logs preceding that level. For example, if you set the log level to
   * `WARNING`, you see the logs within levels `CRITICAL`, `ERROR`, and `WARNING`.
   *
   * @param filter Sets the log filter level:
   * - LOG_FILTER_DEBUG (0x80f): Output all API logs. Set your log filter as DEBUG
   * if you want to get the most complete log file.
   * - LOG_FILTER_INFO (0x0f): Output logs of the CRITICAL, ERROR, WARNING, and INFO
   * level. We recommend setting your log filter as this level.
   * - LOG_FILTER_WARNING (0x0e): Output logs of the CRITICAL, ERROR, and WARNING level.
   * - LOG_FILTER_ERROR (0x0c): Output logs of the CRITICAL and ERROR level.
   * - LOG_FILTER_CRITICAL (0x08): Output logs of the CRITICAL level.
   * - LOG_FILTER_OFF (0): Do not output any log.
   *
   * @return
   * - 0: Success.
   * - < 0: Failure.
   */
  virtual int setLogFilter(unsigned int filter) = 0;
   /**
   * @brief modify player option before play,
   * @param [in] key
   *        the option key name
   * @param [in] value
   *        the option value
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int setPlayerOption(const char *key ,int value) = 0;
  /**
   * @brief change playback speed
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int changePlaybackSpeed(const ar::media::MEDIA_PLAYER_PLAY_SPEED speed) = 0;
  /**
   * @brief change audio track
   *
   * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR
   */
  virtual int selectAudioTrack(int index) = 0;
  /**
   * @brief release IMediaPlayer object.
   *
   */
  virtual void release(bool sync = true) = 0;
  virtual ~IMediaPlayer() {}
};
class IMediaPlayerObserver {
 public:
  /**
   * @brief Triggered when the player state changes
   *
   * @param state New player state
   * @param ec Player error message
   */
  virtual void onPlayerStateChanged(ar::media::MEDIA_PLAYER_STATE state,
                                    ar::media::MEDIA_PLAYER_ERROR ec) = 0;
  /**
   * @brief Triggered when the player progress changes, once every 1 second
   *
   * @param position Current playback progress, in seconds
   */
  virtual void onPositionChanged(const int64_t position) = 0;
  /**
   * @brief Triggered when the player have some event
   *
   * @param event
   */
  virtual void onPlayerEvent(ar::media::MEDIA_PLAYER_EVENT event) = 0;
  /**
   * @brief Triggered when metadata is obtained
   *
   * @param type Metadata type
   * @param data data
   * @param length  data length
   */
  virtual void onMetadata(ar::media::MEDIA_PLAYER_METADATA_TYPE type, const uint8_t* data,
                                  uint32_t length) = 0;
  virtual ~IMediaPlayerObserver() {}
};
}  // namespace rtc
}  // namespace ar
#if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#define AR_PLAYER_API extern "C" __declspec(dllexport)
#define AR_PLAYER_CALL
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#define AR_PLAYER_API __attribute__((visibility("default"))) extern "C"
#define AR_PLAYER_CALL
#elif defined(__ANDROID__) || defined(__linux__)
#define AR_PLAYER_API extern "C" __attribute__((visibility("default")))
#define AR_PLAYER_CALL
#else
#define AR_PLAYER_API extern "C"
#define AR_PLAYER_CALL
#endif
/**
 * Creates an anyrtc media player object and returns the pointer.
 * @return
 * - The pointer to \ref ar::rtc::IMediaPlayer "IMediaPlayer", if the method call succeeds.
 * - The empty pointer NULL, if the method call fails.
 */
AR_PLAYER_API ar::rtc::IMediaPlayer* AR_PLAYER_CALL createArMediaPlayer();
#endif  // __I_AR_MEDIA_PLAYER_H__
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArRtcEngine.h
New file
Diff too large
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Headers/IArService.h
New file
@@ -0,0 +1,76 @@
//  AR SDK
//
//  Copyright (c) 2019 AR.io. All rights reserved.
//
#ifndef __I_AR_SERVICE_H__
#define __I_AR_SERVICE_H__
#include "ArBase.h"
namespace ar {
    namespace rtc {
        class IRtcEngine;
    }
    namespace rtm {
        class IRtmService;
    }
namespace base {
struct ARServiceContext
{
};
class IARService
{
protected:
    virtual ~IARService(){}
public:
    virtual void release() = 0;
    /** Initializes the engine.
    @param context RtcEngine context.
    @return
     - 0: Success.
     - < 0: Failure.
    */
    virtual int initialize(const ARServiceContext& context) = 0;
    /** Retrieves the SDK version number.
    * @param build Build number.
    * @return The current SDK version in the string format. For example, 2.4.0
    */
    virtual const char* getVersion(int* build) = 0;
    virtual rtm::IRtmService* createRtmService() = 0;
};
} //namespace base
} // namespace ar
/** Gets the SDK version number.
 @param build Build number of the AR SDK.
 @return
 - 0: Success.
 - < 0: Failure.
*/
AR_API const char* AR_CALL getARSdkVersion(int* build);
/**
* Creates the RtcEngine object and returns the pointer.
* @param err Error code
* @return returns Description of the error code
*/
AR_API const char* AR_CALL getARSdkErrorDescription(int err);
/**
* Creates the AR Service object and returns the pointer.
* @return returns Pointer of the AR Service object
*/
AR_API ar::base::IARService* AR_CALL createARService();
AR_API int AR_CALL setARSdkExternalSymbolLoader(void* (*func)(const char* symname));
#endif
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Info.plist
Binary files differ
nativePlugins/AR-RtcModule/ios/ARtcKit.framework/Modules/module.modulemap
New file
@@ -0,0 +1,6 @@
framework module ARtcKit {
  umbrella header "ARtcKit.h"
  export *
  module * { export * }
}
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/ArRtcUniPlugin
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/ARtcKit
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/Info.plist
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Frameworks/ARtcKit.framework/_CodeSignature/CodeResources
New file
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>files</key>
    <dict>
        <key>Info.plist</key>
        <data>
        ea52Cqx2Xud4WA0lw2WZ1aUYdyE=
        </data>
    </dict>
    <key>files2</key>
    <dict/>
    <key>rules</key>
    <dict>
        <key>^.*</key>
        <true/>
        <key>^.*\.lproj/</key>
        <dict>
            <key>optional</key>
            <true/>
            <key>weight</key>
            <real>1000</real>
        </dict>
        <key>^.*\.lproj/locversion.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>1100</real>
        </dict>
        <key>^Base\.lproj/</key>
        <dict>
            <key>weight</key>
            <real>1010</real>
        </dict>
        <key>^version.plist$</key>
        <true/>
    </dict>
    <key>rules2</key>
    <dict>
        <key>.*\.dSYM($|/)</key>
        <dict>
            <key>weight</key>
            <real>11</real>
        </dict>
        <key>^(.*/)?\.DS_Store$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>2000</real>
        </dict>
        <key>^.*</key>
        <true/>
        <key>^.*\.lproj/</key>
        <dict>
            <key>optional</key>
            <true/>
            <key>weight</key>
            <real>1000</real>
        </dict>
        <key>^.*\.lproj/locversion.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>1100</real>
        </dict>
        <key>^Base\.lproj/</key>
        <dict>
            <key>weight</key>
            <real>1010</real>
        </dict>
        <key>^Info\.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^PkgInfo$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^embedded\.provisionprofile$</key>
        <dict>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^version\.plist$</key>
        <dict>
            <key>weight</key>
            <real>20</real>
        </dict>
    </dict>
</dict>
</plist>
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/Info.plist
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeDirectory
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeRequirements
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeRequirements-1
Binary files differ
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeResources
New file
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>files</key>
    <dict>
        <key>Frameworks/ARtcKit.framework/ARtcKit</key>
        <data>
        zSTdfD26r2Z5oNp2BjEkOyIAJi8=
        </data>
        <key>Frameworks/ARtcKit.framework/Info.plist</key>
        <data>
        ea52Cqx2Xud4WA0lw2WZ1aUYdyE=
        </data>
        <key>Frameworks/ARtcKit.framework/_CodeSignature/CodeResources</key>
        <data>
        FNzX1qfO6b1WYfbM5ft9XvZjJDU=
        </data>
        <key>Info.plist</key>
        <data>
        FlAs63hum7QtW+kVR2M2RDY8570=
        </data>
    </dict>
    <key>files2</key>
    <dict>
        <key>Frameworks/ARtcKit.framework/ARtcKit</key>
        <dict>
            <key>hash</key>
            <data>
            zSTdfD26r2Z5oNp2BjEkOyIAJi8=
            </data>
            <key>hash2</key>
            <data>
            XN9KFvy17so6EVuc6EqPjdL0zJrNKkZZlNFXBYTzhpw=
            </data>
        </dict>
        <key>Frameworks/ARtcKit.framework/Info.plist</key>
        <dict>
            <key>hash</key>
            <data>
            ea52Cqx2Xud4WA0lw2WZ1aUYdyE=
            </data>
            <key>hash2</key>
            <data>
            lWoQu2XnhV26Xzkbh3xQFJN2WJO/s+w8+94MDmaJs+k=
            </data>
        </dict>
        <key>Frameworks/ARtcKit.framework/_CodeSignature/CodeResources</key>
        <dict>
            <key>hash</key>
            <data>
            FNzX1qfO6b1WYfbM5ft9XvZjJDU=
            </data>
            <key>hash2</key>
            <data>
            wujn+kDmAWCNHbxPR0cKrNpyI2fKLSE2hDVbFt8OqcQ=
            </data>
        </dict>
    </dict>
    <key>rules</key>
    <dict>
        <key>^.*</key>
        <true/>
        <key>^.*\.lproj/</key>
        <dict>
            <key>optional</key>
            <true/>
            <key>weight</key>
            <real>1000</real>
        </dict>
        <key>^.*\.lproj/locversion.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>1100</real>
        </dict>
        <key>^Base\.lproj/</key>
        <dict>
            <key>weight</key>
            <real>1010</real>
        </dict>
        <key>^version.plist$</key>
        <true/>
    </dict>
    <key>rules2</key>
    <dict>
        <key>.*\.dSYM($|/)</key>
        <dict>
            <key>weight</key>
            <real>11</real>
        </dict>
        <key>^(.*/)?\.DS_Store$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>2000</real>
        </dict>
        <key>^.*</key>
        <true/>
        <key>^.*\.lproj/</key>
        <dict>
            <key>optional</key>
            <true/>
            <key>weight</key>
            <real>1000</real>
        </dict>
        <key>^.*\.lproj/locversion.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>1100</real>
        </dict>
        <key>^Base\.lproj/</key>
        <dict>
            <key>weight</key>
            <real>1010</real>
        </dict>
        <key>^Info\.plist$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^PkgInfo$</key>
        <dict>
            <key>omit</key>
            <true/>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^embedded\.provisionprofile$</key>
        <dict>
            <key>weight</key>
            <real>20</real>
        </dict>
        <key>^version\.plist$</key>
        <dict>
            <key>weight</key>
            <real>20</real>
        </dict>
    </dict>
</dict>
</plist>
nativePlugins/AR-RtcModule/ios/ArRtcUniPlugin.framework/_CodeSignature/CodeSignature
Binary files differ
nativePlugins/AR-RtcModule/package.json
New file
@@ -0,0 +1,81 @@
{
    "name": "AR-RtcModule",
    "id": "AR-RtcModule",
    "version": "1.0.5",
    "description": "anyRTC音视频插件提供音视频功能,支持Android、iOS。",
    "_dp_type": "nativeplugin",
    "_dp_nativeplugin": {
        "android": {
            "plugins": [{
                    "type": "module",
                    "name": "AR-RtcModule",
                    "class": "org.ar.arsdk.RtcModule"
                },
                {
                    "type": "component",
                    "name": "AR-CanvasView",
                    "class": "org.ar.arsdk.RtcComponent"
                }
            ],
            "integrateType": "aar",
            "dependencies": [
                "com.github.bumptech.glide:glide:4.9.0",
                "com.alibaba:fastjson:1.1.46.android",
                "com.android.support:recyclerview-v7:26.1.0",
                "com.facebook.fresco:fresco:1.13.0",
                "com.facebook.fresco:animated-gif:1.13.0",
                "com.github.bumptech.glide:glide:4.9.0",
                "com.alibaba:fastjson:1.1.46.android"
            ],
            "compileOptions": {
                "sourceCompatibility": "1.8",
                "targetCompatibility": "1.8"
            },
            "abis": [
                "armeabi-v7a",
                "x86"
            ],
            "minSdkVersion": "19",
            "useAndroidX": false,
            "permissions": [
                "android.permission.INTERNET",
                "android.permission.RECORD_AUDIO",
                "android.permission.MODIFY_AUDIO_SETTINGS",
                "android.permission.ACCESS_NETWORK_STATE",
                "android.permission.READ_PHONE_STATE",
                "android.permission.CAMERA",
                "android.permission.WRITE_EXTERNAL_STORAGE",
                "android.permission.BLUETOOTH",
                "android.permission.WAKE_LOCK",
                "android.permission.READ_EXTERNAL_STORAGE"
            ]
        },
        "ios": {
            "plugins": [
                {
                "type": "module",
                "name": "AR-RtcModule",
                "class": "RtcModule"
                },
                {
                "type": "component",
                "name": "AR-CanvasView",
                "class": "RtcComponent"
                }
            ],
            "frameworks": [
                "ARtcKit.framework"
            ],
            "embedFrameworks": [
                "ARtcKit.framework"
            ],
            "integrateType": "framework",
            "deploymentTarget": "9.0",
            "privacies": [
                "NSCameraUsageDescription",
                "NSMicrophoneUsageDescription"
            ]
        }
    }
}
pages.json
@@ -3,6 +3,13 @@
        "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
    },
    "pages": [{
            "path": "pages/home/home",
            "style": {
                "navigationBarTitleText": "首页",
                "enablePullDownRefresh": false,
                "navigationStyle": "custom"
            }
        }, {
            "path": "pages/login/login-account",
            "style": {
                "navigationBarTitleText": "登录",
@@ -21,14 +28,16 @@
                //     "animationDuration": 300
                // }
            }
        }, {
            "path": "pages/home/home",
            "style": {
                "navigationBarTitleText": "首页",
                "enablePullDownRefresh": false,
                "navigationStyle": "custom"
            }
        }, {
        },
        // {
        //     "path": "pages/home/home",
        //     "style": {
        //         "navigationBarTitleText": "首页",
        //         "enablePullDownRefresh": false,
        //         "navigationStyle": "custom"
        //     }
        // },
        {
            "path": "pages/service/service",
            "style": {
                "navigationBarTitleText": "服务",
@@ -328,7 +337,16 @@
                "navigationStyle": "custom"
            }
        }
    ],
        ,{
            "path" : "pages/videoCall/videoCall",
            "style" :
            {
                "navigationBarTitleText": "视频通话",
                "enablePullDownRefresh": false
            }
        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "",
pages/home/home.vue
@@ -114,6 +114,8 @@
            </view>
            <!-- 新闻模块 end -->
        </view>
            <u-button class="ccbut" type="primary" @click="openVideo('Mains')">测试点视频通话:主播</u-button>
            <u-button class="ccbut" type="primary" @click="openVideo('Receiver')">测试点视频通话:第二个</u-button>
    </view>
</template>
@@ -179,6 +181,11 @@
            }, 2000);
        },
        methods: {
            openVideo(val){
                uni.navigateTo({
                    url: '../videoCall/videoCall?state=' + val
                });
            },
            changePicker(e) {
                console.log(this.pickerArr[e.detail.value].name);
                this.position = this.pickerArr[e.detail.value].name;
pages/securityStaff/information.vue
@@ -135,9 +135,7 @@
                },
                showi: false,
                showc: false,
                cylist: {
                }
                cylist: []
            }
        },
        methods: {
pages/videoCall/videoCall.vue
New file
@@ -0,0 +1,781 @@
<template>
    <view class="content">
        <!-- 加入频道 -->
        <view class="index" v-if="!videoShow">
            <!-- 输入频道 -->
            <!-- <view class="chanel">
                <input class="uni-input activetext" v-model="channel" focus placeholder="请输入频道号" />
            </view>
            <view class="setrole">
                <button type="default" :class="role == 1? 'active': 'button'" @click="setClientRole(1)"><text class="text button_text"
                     :class="role == 1? 'activetext': ''">我是主播</text></button>
                <button type="default" :class="role == 2? 'active': 'button'" @click="setClientRole(2)"><text class="text" :class="role == 2? 'activetext': ''">我是游客</text></button>
            </view>
            <view class="join">
                <button type="primary" class="button jion_bg" @click="join"><text class="activetext">加入频道</text></button>
            </view> -->
            <view class="Mains" v-if="isMain">
                <view class="title">
                    正在呼叫{{MainName}}
                    <u-loading size="36" mode="flower"></u-loading>
                </view>
                <!-- 挂断 -->
                <view class="open" @click="phoneFnMain">
                    <image class="video_bg_img" src="../../static/over.png" mode=""></image>
                    <text class="open_text">取消呼叫</text>
                </view>
            </view>
            <view class="Receiver" v-if="!isMain">
                <!-- <u-button class="ccbut" type="primary" @click="join('Receiver')">确认进入{{channel}}号房间</u-button> -->
                <!-- <u-button class="ccbut" type="primary" @click="comeBack">拒绝进入</u-button> -->
                <view class="open" @click="join('Receiver')">
                    <image class="video_bg_img" src="../../static/phone.png" mode=""></image>
                    <text class="open_text">接受</text>
                </view>
                <view class="open" @click="comeBack">
                    <image class="video_bg_img" src="../../static/over.png" mode=""></image>
                    <text class="open_text">挂断</text>
                </view>
            </view>
        </view>
        <!-- 视频 -->
        <view class="vedio vedioWatch" v-else>
            <view class="video_bg">
                <image class="video_bg_img" src="../../static/BG.png" mode=""></image>
                <!-- <text class="activetext" v-if="videoShowBg"></text> -->
                <!--     <view class="video_bg video_bg_text">
                    <text class="activetext">{{promptText}}</text>
                </view> -->
            </view>
            <view class="video_region" :class="PeerVideoUser.length > 1 ? 'video_region_padding' : ''">
                <!-- 渲染视频 -->
                <view v-for="peervideo in PeerVideoUser" :key="peervideo">
                    <view :class="PeerVideoUserStyle" v-if="peervideo == uid && role == 2 ? false : true">
                        <AR-CanvasView :ref="`popup${peervideo}`" style="flex: 1;"></AR-CanvasView>
                    </view>
                </view>
            </view>
            <!-- 转换摄像头 -->
            <view class="camera position" @click="cameraSwitchFn" v-if="role == 1">
                <image class="video_bg_img" src="../../static/camera.png" mode=""></image>
            </view>
            <!-- 音视频基本开关 -->
            <view class="videoshow_control position">
                <!-- 音频开关 -->
                <view class="open" @click="audioSwitchFn" v-if="role == 1">
                    <image class="video_bg_img" src="../../static/au_in.png" mode="" v-if="audioSwitch == 'open'">
                    </image>
                    <image class="video_bg_img" src="../../static/au_on.png" mode="" v-else></image>
                    <text class="open_text">音频</text>
                </view>
                <!-- 挂断 -->
                <view class="open" @click="phoneFn">
                    <image class="video_bg_img" src="../../static/over.png" mode=""></image>
                    <text class="open_text">挂断</text>
                </view>
                <!-- 视频开关 -->
                <view class="open" @click="vedioSwitchFn" v-if="role == 1">
                    <image class="video_bg_img" src="../../static/vi_on.png" mode="" v-if="vedioSwitch == 'open'">
                    </image>
                    <image class="video_bg_img" src="../../static/vi_in.png" mode="" v-else></image>
                    <text class="open_text">视频</text>
                </view>
                <!--     <scroll-view scroll-y="true" style="height: 500px;padding: 20px;">
                    <view v-for="(item,value) in closeArray" :key='item+value'>{{item}}</view>
                </scroll-view> -->
            </view>
            <!-- 提示文字 -->
            <view class="video_bg video_bg_text" v-if="promptText">
                <!-- <view class="video_bg video_bg_text"> -->
                <text class="activetext">{{promptText}}</text>
                <!-- </view> -->
            </view>
        </view>
        <uni-popup ref="popup" type="center">
            <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
        </uni-popup>
    </view>
</template>
<script>
    const RtcModule = uni.requireNativePlugin('AR-RtcModule');
    import uniPopup from '@/components/uni-popup/uni-popup.vue'
    import uniPopupMessage from '@/components/uni-popup-message/uni-popup-message.vue'
    import uniPopupDialog from '@/components/uni-popup-dialog/uni-popup-dialog.vue'
    import permision from "@/js_sdk/wa-permission/permission.js"
    export default {
        components: {
            uniPopup,
            uniPopupMessage,
            uniPopupDialog
        },
        data() {
            return {
                //anyRTC 为 App 开发者签发的 App ID。每个项目都应该有一个独一无二的 App ID。如果你的开发包里没有 App ID,请从anyRTC官网(https://www.anyrtc.io)申请一个新的 App ID
                appid: "d5a164cd8e0a8352ee108c561ba2e44e",
                channel: "",
                uid: "",
                role: 1, //角色 主播-游客
                videoShow: false, //视频展示
                // videoShowBg: true, //背景展示
                promptText: "loading...",
                PeerVideoUser: [{
                    a: 1
                }, {
                    a: 2
                }, {
                    a: 3
                }], //用户视频加入存储
                PeerVideoUserStyle: "video_local", //用户视频加入样式
                // 本地
                audioSwitch: "open", //音频开关
                vedioSwitch: "open", //视频开关
                videoWidth: 0,
                videoHeight: 0,
                //提示
                popupType: "",
                popupMessage: "",
                isMain: false,
                MainName: '222',
                userName: '111'
                // closeArray: []
            }
        },
        // 页面初始加载(仅执行一次)
        onReady() {
            // 初始化
            this.channel = 2554;
            this.init();
        },
        onLoad(option) {
            console.log(option.state);
            if (option.state == "Mains") {
                this.isMain = true;
                setTimeout(res => {
                    this.join();
                }, 2000)
            } else if (option.state == "Receiver") {
                this.isMain = false;
            }
        },
        watch: {
            PeerVideoUser: function(newName) {
                if (this.role == 2) {
                    newName = newName.filter((x) => x !== this.uid);
                }
                // video_local
                if (newName.length == 1) {
                    this.PeerVideoUserStyle = "video_local"
                } else if (newName.length > 1 && newName.length < 5) {
                    this.PeerVideoUserStyle = "video_local_1"
                } else if (newName.length > 4 && newName.length < 10) {
                    this.PeerVideoUserStyle = "video_local_2"
                } else if (newName.length > 9 && newName.length < 17) {
                    this.PeerVideoUserStyle = "video_local_3"
                } else if (newName.length == 0) {
                    this.role == 2 ? this.promptText = "暂无主播播放视频" : this.promptText = "loading..."
                }
            }
        },
        methods: {
            // 初始化
            async init() {
                // 查看权限
                if (uni.getSystemInfoSync().platform == 'ios') {
                    //查看相机权限
                    await this.requestAndroidPermission("camera", 'ios');
                    //查看录音权限
                    await this.requestAndroidPermission("record", 'ios');
                } else if (uni.getSystemInfoSync().platform === 'android') {
                    //查看相机权限
                    await this.requestAndroidPermission("android.permission.CAMERA", 'android');
                    //查看录音权限
                    await this.requestAndroidPermission("android.permission.RECORD_AUDIO", 'android');
                }
                // 初始化 setCallBack
                await this.callbackFn();
                // 初始化 create
                await RtcModule.create({
                    "appId": this.appid
                }, (res) => {
                });
                this.uid = this.randomFn(6);
            },
            //设置角色
            setClientRole(num) {
                this.role = num;
                //设置直播场景下的用户角色
                RtcModule.setClientRole({
                    "role": num
                }, (ret) => {});
            },
            //加入频道 跳转到视频
            async join(val) {
                var that = this;
                // if (val == "Mains") { //视频发起人进入
                console.log('视频发起人进入');
                uni.showLoading({
                    title: '加载中',
                    mask: true
                });
                //加入房间
                await RtcModule.joinChannel({
                    "token": "",
                    "channelId": this.channel,
                    "uid": this.uid
                }, (res) => {
                    console.log(res, 'join break');
                    console.log('成功进入房间:' + that.channel);
                })
                // } else if (val == 'Receiver') { //视频接收人进入
                //     console.log('视频接收人进入');
                //     uni.showLoading({
                //         title: '加载中',
                //         mask: true
                //     });
                //     //加入房间
                //     await RtcModule.joinChannel({
                //         "token": "",
                //         "channelId": this.channel,
                //         "uid": this.uid
                //     }, (res) => {
                //         console.log(res, 'join break');
                //         console.log('成功进入房间:' + that.channel);
                //     })
                // }
            },
            // 等待时候挂断
            phoneFnMain() {
                // RtcModule.leaveChannel((res) => {});
                console.log("等待时候挂断");
                uni.navigateBack();
            },
            //拒绝进入视频
            comeBack() {
                console.log("拒绝进入视频");
                uni.navigateBack();
            },
            // 挂断 离开
            phoneFn() {
                //离开频道
                RtcModule.leaveChannel((res) => {})
            },
            //添加本地视频到页面
            setupLocalVideoFn() {
                //视频
                RtcModule.enableVideo((res) => {});
                this.$refs[`popup${this.uid}`][0].setupLocalVideo({
                    "renderMode": 1,
                    "channelId": this.channel,
                    "uid": this.uid,
                    "mirrorMode": 0
                }, (res) => {});
                // 本地预览
                RtcModule.startPreview((res) => {});
            },
            // 视频
            vedioSwitchFn() {
                let open = true;
                if (this.vedioSwitch == "open") {
                    this.vedioSwitch = "colse";
                    open = false;
                } else {
                    this.vedioSwitch = "open";
                    open = true;
                }
                RtcModule.enableLocalVideo({
                    "enabled": open
                }, (res) => {
                    if (res.code == 0) {
                        open == false ? this.promptFn("warn", "关闭本地视频采集") : this.promptFn("info", "开启本地视频采集");
                    }
                });
            },
            // 音频
            audioSwitchFn() {
                let open = true;
                if (this.audioSwitch == "open") {
                    this.audioSwitch = "colse";
                    open = false;
                } else {
                    this.audioSwitch = "open";
                    open = true;
                }
                RtcModule.enableLocalAudio({
                    "enabled": open
                }, (res) => {
                    if (res.code == 0) {
                        open == false ? this.promptFn("warn", "关闭本地音频采集") : this.promptFn("info", "开启本地音频采集");
                    }
                });
            },
            //转化摄像头
            cameraSwitchFn() {
                RtcModule.switchCamera((res) => {
                    res.code == 0 ? this.promptFn("success", "切换摄像头成功") : this.promptFn("error", "切换摄像头失败");
                })
            },
            //callback 接收
            callbackFn() {
                RtcModule.setCallBack((res) => {
                    switch (res.engineEvent) {
                        case "onWarning":
                            this.promptFn("warn", res.warningCode);
                            break;
                        case "onError":
                            res.errorCode != 18 ? this.promptFn("error", res.errorCode) : '';
                            break;
                        case "onJoinChannelSuccess": //用户加入成功
                            uni.hideLoading();
                            this.role == 1 ? this.PeerVideoUser.push(res.uid) : "";
                            this.videoShow = true;
                            setTimeout(() => {
                                // this.videoShowBg = false;
                                this.promptText = ""
                                //扬声器
                                RtcModule.setEnableSpeakerphone({
                                    "enabled": true
                                }, (res) => {})
                                setTimeout(() => {
                                    // 启用视频模块。
                                    this.role == 1 ? this.setupLocalVideoFn() : RtcModule
                                        .enableVideo((res) => {});
                                }, 200)
                            }, 2000)
                            break;
                        case "onLeaveChannel": //离开频道回调
                            setTimeout(() => {
                                this.closeAll()
                            }, 500)
                            break;
                        case "onUserJoined": //远端用户加入当前频道回调。
                            // this.promptFn("info", "远端用户加入当前频道回调");
                            this.PeerVideoUser.push(res.uid);
                            break;
                        case "onUserOffline": //远端用户离开当前频道回调。
                            this.PeerVideoUser = this.PeerVideoUser.filter((x) => x !== res.uid);
                            break;
                        case "onFirstLocalAudioFrame": //已发送本地音频首帧的回调。(页面上添加音频)
                            break;
                        case "onFirstLocalVideoFrame": //已显示本地视频首帧的回调。(页面添加本地视频)
                            // this.promptFn("error", "已显示本地视频首帧的回调");
                            break;
                        case "onFirstRemoteVideoDecoded": //已完成远端视频首帧解码回调。(页面添加远端视频)
                            // this.promptFn("info", "已完成远端视频首帧解码回调");
                            this.promptText = "请稍等。。。"
                            let uid = []
                            uid.push(res.uid)
                            setTimeout(() => {
                                this.promptText = "";
                                // this.videoShowBg = false; //设置背景开关
                                setTimeout(() => {
                                    uid.map(item => {
                                        this.$refs[`popup${item}`][0].setupRemoteVideo({
                                            "renderMode": 1,
                                            "channelId": this.chanel,
                                            "uid": item,
                                            "mirrorMode": 0
                                        }, (res) => {})
                                        //预览
                                        RtcModule.startPreview((res) => {});
                                    })
                                }, 500)
                            }, 2000)
                            break;
                    }
                })
            },
            //提示
            promptFn(type, content) {
                this.popupType = type;
                this.popupMessage = content;
                this.$refs.popup.open()
            },
            //支持自定义字符长度和特征字符集合
            randomFn(len, charSet) {
                charSet = charSet || 'abcdefghijklmnopqrstuvwxyz0123456789';
                let randomString = '';
                for (let i = 0; i < len; i++) {
                    let randomPoz = Math.floor(Math.random() * charSet.length);
                    randomString += charSet.substring(randomPoz, randomPoz + 1);
                }
                return randomString;
            },
            // 离开清空
            async closeAll() {
                // 销毁实例
                await RtcModule.destroyRtc((res) => {});
                this.videoShow = false; //视频展示
                // this.videoShowBg = true; //背景展示
                this.promptText = "loading...";
                this.PeerVideoUser = []; //远端用户加入存储
                // 本地
                this.audioSwitch = "open"; //音频开关
                this.vedioSwitch = "open"; //视频开关
                // 重新创建实例
                await this.init();
                // 如果需要跳转其它页面请按下边步骤
                // await uni.redirectTo({
                //     url: '..',
                //     success: () => {
                //         RtcModule.destroyRtc((res) => {
                //             console.log("页面销毁", res.code);
                //         });
                //     }
                // });
            },
            //查看授权
            async requestAndroidPermission(permisionID, type) {
                let result = 0;
                let strStatus = "";
                type == 'ios' ? result = await permision.judgeIosPermission(permisionID) : result = await permision
                    .requestAndroidPermission(
                        permisionID);
                if (result == 1) {
                    strStatus = "已获得授权"
                } else if (result == 0) {
                    strStatus = "未获得授权"
                } else {
                    strStatus = "被永久拒绝权限"
                }
            },
        }
    }
</script>
<style lang="scss" scoped>
    .content {
        flex: 1;
    }
    /* 加入频道 */
    .index {
        flex: 1;
        background-color: #0A1621;
        height: 100vh;
    }
    /* 等待时候样式   Main */
    .ccbut {
        position: relative;
        top: 45vh;
    }
    .Mains {
        // position: absolute;
        // width: 100%;
        // height: 5rem;
        width: 100%;
        height: 100vh;
        box-sizing: border-box;
        // border: 1px solid #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        // bottom: 0;
        .title {
            color: #fff;
        }
        .open {
            // border: 1px solid #fff;
            position: fixed;
            bottom: 3rem;
            width: 100%;
            height: 4.3rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            .video_bg_img {
                width: 3rem;
                height: 2rem;
            }
            .open_text {
                padding: 5px 0 0;
                text-align: center;
                display: block;
                // border: 1px solid #fff;
                color: #fff;
            }
        }
    }
    .Receiver {
        // position: absolute;
        // width: 100%;
        // height: 5rem;
        width: 100%;
        height: 100vh;
        box-sizing: border-box;
        // border: 1px solid #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        // bottom: 0;
        .title {
            color: #fff;
        }
        .open {
            // border: 1px solid #fff;
            position: relative;
            top: 12rem;
            width: 100%;
            height: 4.3rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            .video_bg_img {
                width: 3rem;
                height: 2rem;
            }
            .open_text {
                padding: 5px 0 0;
                text-align: center;
                display: block;
                // border: 1px solid #fff;
                color: #fff;
            }
        }
    }
    .chanel {
        padding: 120px 20px 20px;
    }
    .uni-input {
        height: 120rpx;
        padding: 0 20px;
        background-color: #2F3041;
        border-radius: 6px;
    }
    .setrole {
        padding: 60px 20px;
        flex-direction: row;
        justify-content: space-between;
    }
    .button {
        padding: 10px 70rpx;
        background-color: #2F3041;
        border-radius: 6px;
        border-width: 2px;
        border-color: #2f3041;
    }
    .text {
        color: #B4B5BE;
    }
    .activetext {
        color: #fff;
    }
    .active {
        padding: 10px 70rpx;
        border-radius: 6px;
        border-width: 2px;
        border-color: #40a3fb;
        background-color: #0A1621;
    }
    .join {
        padding: 20px;
    }
    .jion_bg {
        background-color: #40A3FB;
        border-width: 0;
    }
    /* 视频 */
    .vedioWatch {
        flex: 1;
        position: relative;
        width: 100%;
        height: 100vh;
        background-color: #0A1621;
    }
    /* 初始背景 */
    .video_bg {
        flex: 1;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: transparent;
    }
    .video_bg_img {
        flex: 1;
        width: 100%;
    }
    .video_bg_text {
        justify-content: center;
        align-items: center;
    }
    /* 转换摄像头 */
    .camera {
        width: 44px;
        height: 37px;
        /* position: absolute; */
        left: 20px;
        top: 40px;
    }
    /* 视频区域 */
    .video_region {
        flex: 1;
        /* position: absolute; */
        flex-wrap: wrap;
        flex-direction: row;
        background-color: transparent;
    }
    /* 1个视频 */
    .video_local {
        width: 750rpx;
        height: 1334rpx;
        background-color: transparent;
    }
    .video_region_padding {
        margin-top: 20px;
        padding: 200rpx 0 260rpx;
        width: 750rpx;
        height: 840rpx;
    }
    /* 4个视频 */
    .video_local_1 {
        width: 375rpx;
        height: 420rpx;
    }
    /* 9个视频 */
    .video_local_2 {
        width: 250rpx;
        height: 280rpx;
    }
    /* 16个视频 */
    .video_local_3 {
        width: 187.5rpx;
        height: 210rpx;
    }
    /* 音视频基本开关 */
    .videoshow_control {
        position: absolute;
        bottom: 3rem;
        left: 0;
        width: 750rpx;
        /* background-color: #007AFF; */
        /* height: 250rpx; */
        padding: 20px;
        background-color: transparent;
        color: #fff;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        image {
            width: 3rem;
        }
        .open {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            height: 4.3rem;
        }
    }
    .camera {
        image {
            width: 2rem;
            height: 2rem;
        }
    }
    .open {
        height: 205rpx;
        width: 128rpx;
        justify-content: center;
    }
    .open_text {
        padding: 5px 0 0;
        text-align: center;
        color: #fff;
    }
    .position {
        position: absolute;
    }
</style>
static/BG.png
static/au_in.png
static/au_on.png
static/camera.png
static/logo.png
static/over.png
static/phone.png
static/vi_in.png
static/vi_on.png