一、概述
参照官方demo,基于agora开发,输入会议号(频道)和显示名称 参会,可设置参会选项。
支持用户注册和登录。
支持多人参会。
二、效果
三、代码
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184package 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; } }
到此这篇关于Android 基于agora 开发视频会议的文章就介绍到这了,更多相关Android开发视频会议内容请搜索靠谱客以前的文章或继续浏览下面的相关文章希望大家以后多多支持靠谱客!
最后
以上就是时尚大象最近收集整理的关于Android 基于agora 开发视频会议的代码的全部内容,更多相关Android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复