Android 基于agora 视频会议开发_开源视频会议android-程序员宅基地

技术标签: android  Android  

一、概述

参照官方demo,基于agora开发,输入会议号(频道)和显示名称 参会,可设置参会选项。

支持用户注册和登录。

支持多人参会。

二、效果

三、代码

复制代码

package io.agora.openvcall.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Switch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.agora.openvcall.R;
import io.agora.openvcall.model.ConstantApp;
import io.agora.openvcall.ui.mycode.common;

public class MainActivity extends BaseActivity {

    private final static Logger log = LoggerFactory.getLogger(MainActivity.class);
    private String username;
    private String password;
    private String name;
    private int user_id;
    private String show_name;

    private boolean videomute;
    private boolean audiomute;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ActionBar ab = getSupportActionBar();
        if (ab != null) {
            ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
            ab.setCustomView(R.layout.ard_agora_actionbar);
        }
        initP();
    }

    private  void initP(){
        String show_name = common.getName();
        if(!TextUtils.isEmpty(show_name)){
            this.name=show_name;
            this.show_name=show_name;
            common.setName(show_name);
            EditText et = findViewById(R.id.user_name);
            et.setText(show_name);
        }
        String _username = common.getUsername();
        if(!TextUtils.isEmpty(_username)){
            username=_username;
        }

        String _password = common.getPassword();
        if(!TextUtils.isEmpty(_password)){
            password=_password;
        }

        user_id = common.getUser_id();

    }

    public void onBackPressed(View view) {
        onBackPressed();
    }

    @Override
    protected void initUIandEvent() {
        EditText v_channel = (EditText) findViewById(R.id.channel_name);

        v_channel.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
            }

        });

        String lastChannelName = vSettings().mChannelName;
        if (!TextUtils.isEmpty(lastChannelName)) {
            v_channel.setText(lastChannelName);
            v_channel.setSelection(lastChannelName.length());
        }

    }

    @Override
    protected void deInitUIandEvent() {
    }

    @Override
    public boolean onCreateOptionsMenu(final Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle presses on the action bar items
        switch (item.getItemId()) {
            case R.id.action_settings:
                forwardToSettings();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    public void onClickJoin(View view) {
        forwardToRoom();
    }

    public void forwardToRoom() {

        EditText v_channel = (EditText) findViewById(R.id.channel_name);
        String channel = v_channel.getText().toString();
        if(TextUtils.isEmpty(channel)){
            showLongToast("请输入会议号!");
            return;
        }
        vSettings().mChannelName = channel;

        Intent i = new Intent(MainActivity.this, CallActivity.class);
        i.putExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME, channel);
        //i.putExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY, encryption);
        i.putExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE, getResources().getStringArray(R.array.encryption_mode_values)[vSettings().mEncryptionModeIndex]);

        i.putExtra("username",username);
        i.putExtra("password",password);
        i.putExtra("name",name);
        i.putExtra("user_id",user_id);
        i.putExtra("videomute",videomute);
        i.putExtra("audiomute",audiomute);
        EditText show_name_E = (EditText) findViewById(R.id.user_name);
        String _show_name = show_name_E.getText().toString();
        i.putExtra("show_name",_show_name);
        startActivity(i);
        finish();
    }

    public void forwardToSettings() {
        Intent i = new Intent(this, io.agora.openvcall.ui.SettingsActivity.class);

        startActivity(i);
    }


    @Override
    public void permissionGranted() {

    }


    public void onSwitch_audio(View view) {
        boolean isChecked = ((Switch) view).isChecked();
        this.audiomute=!isChecked;
    }

    public void onSwitch_video(View view) {
        boolean isChecked = ((Switch) view).isChecked();
        this.videomute=!isChecked;
    }
}

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u014556081/article/details/113178268

智能推荐

微信小程序swiper小程序轮播图小圆点样式修改_"<swiper class=\"swiper-box\" indicator-dots=\"{{t-程序员宅基地

文章浏览阅读527次。<swiper class="swiper-box" indicator-dots="{{ indicatordots }}" autoplay="{{ autoplay }}"> <block wx:for="{{ swiperItem }}"> <swiper-item> <navigator url="{{ item.linkUrl }}"> <image class=_"

android 代码 截取屏幕,如何以编程方式在Android上截取屏幕截图?-程序员宅基地

文章浏览阅读346次。这是允许我的屏幕截图存储在SD卡上的代码,以后用于满足您的任何需求:首先,您需要添加适当的权限来保存文件:这是代码(在Activity中运行):privatevoidtakeScreenshot(){Datenow=newDate();android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss",now);try{//i..._屏幕部分截图android代码

注册表禁用计算机管理,Win7注册表编辑器被管理员禁用的解除方法-程序员宅基地

文章浏览阅读2.7k次。熟悉Win7系统的朋友都知道,注册表编辑器是更改Win7系统设置的好工具。在注册表中可以完成控制面板中不能修改的设置。但是有些用户打开注册表编辑器的时候却被提示,注册表编辑器已被管理员禁用,这是怎么回事呢?如何解除Win7对注册表编辑器的限制呢?一、Win7打开注册表的方法1 Win+R键打开Win7系统的运行,在运行数输入regedit点击确定。二、注册表被禁用解除方法Win7注册表编辑器被管理..._注册表编辑器禁用和解除原因

mysql innodb 源码_【InnoDB源码分析】Redo log-程序员宅基地

文章浏览阅读502次。【版本:mysql-8.0.12】1. Mini Transaction(mtr)InnoDB会将事务执行过程拆分为若干个Mini Transaction(mtr),每个mtr包含一系列如加锁,写数据,写redo,放锁等操作。举个例子:void btr_truncate(const dict_index_t *index) {... ...page_size_t page_size(space-&..._mysql innodb 源代码 解读

matlab背景设置_preferences: path: c:\users\administrator\appdata\-程序员宅基地

文章浏览阅读515次。打开C:\Users\Administrator\AppData\Roaming\MathWorks\MATLAB\R2015b\matlab.prf修改为#MATLAB Preferences#Sat Jul 11 15:54:49 CST 2020Editor.VariableHighlighting.Color=C-6931898EditorMRUSize=I8ReplaceSearchText19=SReplaceSearchText18=SReplaceSearchText17=S_preferences: path: c:\users\administrator\appdata\roaming\mathworks\matlab\c

谁说技术男不浪漫!90后程序员2天做出情绪...-程序员宅基地

文章浏览阅读75次。点击上方[全栈开发者社区]→右上角[...]→[设为星标]点击领取全栈资料:全栈资料9月1日,一则关于#程序员2天做出猫咪情绪识别软件#的话题登上微博热搜,参与阅读的人数达到了82..._程序员自研

随便推点

python3中的编码_encoded = binascii.b2a_base64(s, newline=false) ty-程序员宅基地

文章浏览阅读621次。python2字符串编码存在的问题:使用 ASCII 码作为默认编码方式,对中文处理不友好把字符串分为 unicode 和 str 两种类型,误导开发者将unicode作为唯一内码python3中默认编码方式修改为utf-8。在存储和显示上,python3使用文本字符和二进制数据进行区分,更加明确和清晰。文本字符使用str类型表示,str 能表示 Unicode 字符集中所有字符,..._encoded = binascii.b2a_base64(s, newline=false) typeerror: a bytes-like obje

计算机目录创建后只有sid号,重装Oracle时出现SID已存在问题的解决办法-程序员宅基地

文章浏览阅读294次。注意安装oracle服务器的环境,不稳定导致数据库出现问题,后果很严重!方法如下:1、开始->设置->控制面板->管理工具->服务 停止所有Oracle服务。2、 开始->程序->Oracle - OraHome81->Oracle Installation Products-> Universal Installer 卸装所有Oracle产品,但Universal Installer本身不能被删..._oracle 系统标识符sid 已经存在

aria2Linux开机启动,ubuntu aria2 安装、配置、开机启动-程序员宅基地

文章浏览阅读763次。转载安装sudo apt-get install aria2配置创建必要文件 (一般放在/etc下面,我的/usr/customer可写)sudo mkdir /usr/customer/aria2 #新建文件夹sudo touch /usr/customer/aria2/aria2.session #新建session文件sudo chmod 777 /usr/customer/ar..._linux aria2 启动命令

python:pyinstaller使用指南_python的pyinstaller用法-程序员宅基地

文章浏览阅读8.2k次,点赞6次,收藏47次。一、pyinstaller简介pyinstaller可以讲python项目在不同平台上打包为可执行文件pyinstaller打包流程:读取编写好的python项目–分析其中调用的模块和库,并收集其文件副本(包括python的解释器)–将副本和python项目文件封装在一个可执行文件中二、pyinstaller的使用1.pyInstaller在Windows/Linux/Mac环境下的使用:执行命令相同,只需要在不同环境下执行即可2.pyinstaller的安装pip install_python的pyinstaller用法

读取多波段的tif(利用GDAL)_gdal读取tif-程序员宅基地

文章浏览阅读2.5k次。bmp的格式是RGBRGB.....排列下来的,每个像素的三个分量靠在一起,描述完一个像素,接着描述下一个像素。tif的格式更多样。通常的格式也是BGRBGR.....(次序与bmp相反)排列下来的,但偶尔有一些tif文件采用RRRRRR.......GGGGG.........BBBBB.....的安排。还有的tif文件内容是压缩过的。。。。这里我们只考虑三个颜色分量靠在一起的情况。下面的例子是一个tif文件,宽896,高608,三个分量。这里先把其内容取出,并交换RB的位置,然后保存为.rgb文_gdal读取tif

JavaSE基础知识(十三)--Java的数组以及数组的初始化_int a1=a[rand.nextint(a.length)];-程序员宅基地

文章浏览阅读1.1k次。Java SE 是什么,包括哪些内容(十三)?本文内容参考自Java8标准数组是相同类型的,用一个标识符名称封装到一起的一个对象引用序列或基本数据类型序列,数组是通过方括号下标操作符[ ]来定义和使用的,要定义一个数组,只需要在类型后面加上一个[ ],并取一个合适的标识符名称即可。上面的内容总共体现在三个方面:⑴、数组内的数据类型必须是同一类型,也就是说在一个数组内不能同时存储不同数据类型..._int a1=a[rand.nextint(a.length)];