本文整理汇总了Java中io.agora.rtc.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于io.agora.rtc包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureRtcEngineReadyLock
import io.agora.rtc.Constants; //导入依赖的package包/类
private RtcEngine ensureRtcEngineReadyLock() {
if (mRtcEngine == null) {
String appId = mContext.getString(R.string.private_app_id);
if (TextUtils.isEmpty(appId)) {
throw new RuntimeException("NEED TO use your App ID, get your own ID at https://dashboard.agora.io/");
}
try {
mRtcEngine = RtcEngine.create(mContext, appId, mEngineEventHandler.mRtcEventHandler);
} catch (Exception e) {
log.error(Log.getStackTraceString(e));
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
}
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
mRtcEngine.enableAudioVolumeIndication(200, 3); // 200 ms
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
+ File.separator + mContext.getPackageName() + "/log/agora-rtc.log");
}
return mRtcEngine;
}
示例2: ensureRtcEngineReadyLock
import io.agora.rtc.Constants; //导入依赖的package包/类
private RtcEngine ensureRtcEngineReadyLock() {
if (mRtcEngine == null) {
String appId = mContext.getString(R.string.private_app_id);
if (TextUtils.isEmpty(appId)) {
throw new RuntimeException("NEED TO use your App ID, get your own ID at https://dashboard.agora.io/");
}
try {
mRtcEngine = RtcEngine.create(mContext, appId, mEngineEventHandler.mRtcEventHandler);
} catch (Exception e) {
log.error(Log.getStackTraceString(e));
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
}
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
mRtcEngine.enableVideo();
mRtcEngine.enableAudioVolumeIndication(200, 3); // 200 ms
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
+ File.separator + mContext.getPackageName() + "/log/agora-rtc.log");
}
return mRtcEngine;
}
示例3: ensureRtcEngineReadyLock
import io.agora.rtc.Constants; //导入依赖的package包/类
private RtcEngine ensureRtcEngineReadyLock() {
if (mRtcEngine == null) {
String appId = mContext.getString(R.string.private_app_id);
if (TextUtils.isEmpty(appId)) {
throw new RuntimeException("NEED TO use your App ID, get your own ID at https://dashboard.agora.io/");
}
try {
mRtcEngine = RtcEngine.create(mContext, appId, mEngineEventHandler.mRtcEventHandler);
} catch (Exception e) {
log.error(Log.getStackTraceString(e));
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
}
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
mRtcEngine.enableVideo();
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
+ File.separator + mContext.getPackageName() + "/log/agora-rtc.log");
mRtcEngine.enableDualStreamMode(true);
}
return mRtcEngine;
}
示例4: doSwitchToBroadcaster
import io.agora.rtc.Constants; //导入依赖的package包/类
private void doSwitchToBroadcaster(boolean broadcaster) {
final int currentHostCount = mUidsList.size();
final int uid = config().mUid;
log.debug("doSwitchToBroadcaster " + currentHostCount + " " + (uid & 0XFFFFFFFFL) + " " + broadcaster);
if (broadcaster) {
doConfigEngine(Constants.CLIENT_ROLE_BROADCASTER);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doRenderRemoteUi(uid);
ImageView button1 = (ImageView) findViewById(R.id.btn_1);
ImageView button2 = (ImageView) findViewById(R.id.btn_2);
ImageView button3 = (ImageView) findViewById(R.id.btn_3);
broadcasterUI(button1, button2, button3);
doShowButtons(false);
}
}, 1000); // wait for reconfig engine
} else {
stopInteraction(currentHostCount, uid);
}
}
示例5: stopInteraction
import io.agora.rtc.Constants; //导入依赖的package包/类
private void stopInteraction(final int currentHostCount, final int uid) {
doConfigEngine(Constants.CLIENT_ROLE_AUDIENCE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doRemoveRemoteUi(uid);
ImageView button1 = (ImageView) findViewById(R.id.btn_1);
ImageView button2 = (ImageView) findViewById(R.id.btn_2);
ImageView button3 = (ImageView) findViewById(R.id.btn_3);
audienceUI(button1, button2, button3);
doShowButtons(false);
}
}, 1000); // wait for reconfig engine
}
示例6: requestRemoteStreamType
import io.agora.rtc.Constants; //导入依赖的package包/类
private void requestRemoteStreamType(final int currentHostCount) {
log.debug("requestRemoteStreamType " + currentHostCount);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
HashMap.Entry<Integer, SurfaceView> highest = null;
for (HashMap.Entry<Integer, SurfaceView> pair : mUidsList.entrySet()) {
log.debug("requestRemoteStreamType " + currentHostCount + " local " + (config().mUid & 0xFFFFFFFFL) + " " + (pair.getKey() & 0xFFFFFFFFL) + " " + pair.getValue().getHeight() + " " + pair.getValue().getWidth());
if (pair.getKey() != config().mUid && (highest == null || highest.getValue().getHeight() < pair.getValue().getHeight())) {
if (highest != null) {
rtcEngine().setRemoteVideoStreamType(highest.getKey(), Constants.VIDEO_STREAM_LOW);
log.debug("setRemoteVideoStreamType switch highest VIDEO_STREAM_LOW " + currentHostCount + " " + (highest.getKey() & 0xFFFFFFFFL) + " " + highest.getValue().getWidth() + " " + highest.getValue().getHeight());
}
highest = pair;
} else if (pair.getKey() != config().mUid && (highest != null && highest.getValue().getHeight() >= pair.getValue().getHeight())) {
rtcEngine().setRemoteVideoStreamType(pair.getKey(), Constants.VIDEO_STREAM_LOW);
log.debug("setRemoteVideoStreamType VIDEO_STREAM_LOW " + currentHostCount + " " + (pair.getKey() & 0xFFFFFFFFL) + " " + pair.getValue().getWidth() + " " + pair.getValue().getHeight());
}
}
if (highest != null && highest.getKey() != 0) {
rtcEngine().setRemoteVideoStreamType(highest.getKey(), Constants.VIDEO_STREAM_HIGH);
log.debug("setRemoteVideoStreamType VIDEO_STREAM_HIGH " + currentHostCount + " " + (highest.getKey() & 0xFFFFFFFFL) + " " + highest.getValue().getWidth() + " " + highest.getValue().getHeight());
}
}
}, 500);
}
示例7: switchToDefaultVideoView
import io.agora.rtc.Constants; //导入依赖的package包/类
private void switchToDefaultVideoView() {
if (mSmallVideoViewDock != null)
mSmallVideoViewDock.setVisibility(View.GONE);
mGridVideoViewContainer.initViewContainer(getApplicationContext(), config().mUid, mUidsList);
mViewType = VIEW_TYPE_DEFAULT;
int sizeLimit = mUidsList.size();
if (sizeLimit > ConstantApp.MAX_PEER_COUNT + 1) {
sizeLimit = ConstantApp.MAX_PEER_COUNT + 1;
}
for (int i = 0; i < sizeLimit; i++) {
int uid = mGridVideoViewContainer.getItem(i).mUid;
if (config().mUid != uid) {
rtcEngine().setRemoteVideoStreamType(uid, Constants.VIDEO_STREAM_HIGH);
log.debug("setRemoteVideoStreamType VIDEO_STREAM_HIGH " + mUidsList.size() + " " + (uid & 0xFFFFFFFFL));
}
}
}
示例8: configEngineCon
import io.agora.rtc.Constants; //导入依赖的package包/类
public final void configEngineCon(int vProfile, String encryptionKey, String encryptionMode) {
isLive = false;
if (Thread.currentThread() != this) {
log.warn("configEngineCon() - worker thread asynchronously " + vProfile + " " + encryptionMode);
Message envelop = new Message();
envelop.what = ACTION_WORKER_CONFIG_ENGINE_CON;
envelop.obj = new Object[]{vProfile, encryptionKey, encryptionMode};
mWorkerHandler.sendMessage(envelop);
return;
}
ensureRtcEngineReadyLock();
mEngineConfig.mVideoProfile = vProfile;
if (!TextUtils.isEmpty(encryptionKey)) {
mRtcEngine.setEncryptionMode(encryptionMode);
mRtcEngine.setEncryptionSecret(encryptionKey);
}
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
mRtcEngine.setVideoProfile(mEngineConfig.mVideoProfile, false);
log.debug("configEngineCon " + mEngineConfig.mVideoProfile + " " + encryptionMode);
}
示例9: configEngineLive
import io.agora.rtc.Constants; //导入依赖的package包/类
public final void configEngineLive(int cRole, int vProfile) {
isLive = true;
if (Thread.currentThread() != this) {
log.warn("configEngineLive() - worker thread asynchronously " + cRole + " " + vProfile);
Message envelop = new Message();
envelop.what = ACTION_WORKER_CONFIG_ENGINE_LIVE;
envelop.obj = new Object[]{cRole, vProfile};
mWorkerHandler.sendMessage(envelop);
return;
}
ensureRtcEngineReadyLock();
mEngineConfig.mVideoProfile = vProfile;
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
mRtcEngine.setVideoProfile(mEngineConfig.mVideoProfile, true);
mEngineConfig.mClientRole = cRole;
mRtcEngine.setClientRole(cRole, "");
log.debug("configEngineLive " + cRole + " " + mEngineConfig.mVideoProfile);
}
示例10: ensureRtcEngineReadyLock
import io.agora.rtc.Constants; //导入依赖的package包/类
private RtcEngine ensureRtcEngineReadyLock() {
if (mRtcEngine == null) {
String appId = mContext.getString(R.string.private_app_id);
if (TextUtils.isEmpty(appId)) {
throw new RuntimeException("NEED TO use your App ID, get your own ID at https://dashboard.agora.io/");
}
mRtcEngine = RtcEngine.create(mContext, appId, mEngineEventHandler.mRtcEventHandler);
if (isLive) {
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
} else {
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
}
mRtcEngine.enableVideo();
mRtcEngine.enableAudioVolumeIndication(200, 3); // 200 ms
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
+ File.separator + mContext.getPackageName() + "/log/agora-rtc.log");
}
return mRtcEngine;
}
示例11: initializeAgoraEngine
import io.agora.rtc.Constants; //导入依赖的package包/类
private void initializeAgoraEngine() {
try {
mRtcEngine = RtcEngine.create(getBaseContext(), getString(R.string.agora_app_id), mRtcEventHandler);
} catch (Exception e) {
Log.e(LOG_TAG, Log.getStackTraceString(e));
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
}
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
}
示例12: setupVideoProfile
import io.agora.rtc.Constants; //导入依赖的package包/类
private void setupVideoProfile() {
mRtcEngine.enableVideo();
if (mRtcEngine.isTextureEncodeSupported()) {
mRtcEngine.setExternalVideoSource(true, true, true);
} else {
throw new RuntimeException("Can not work on device do not supporting texture" + mRtcEngine.isTextureEncodeSupported());
}
mRtcEngine.setVideoProfile(Constants.VIDEO_PROFILE_480P, true);
}
示例13: ensureRtcEngineReadyLock
import io.agora.rtc.Constants; //导入依赖的package包/类
private RtcEngine ensureRtcEngineReadyLock() {
if (mRtcEngine == null) {
String appId = mContext.getString(R.string.private_app_id);
if (TextUtils.isEmpty(appId)) {
throw new RuntimeException("NEED TO use your App ID, get your own ID at https://dashboard.agora.io/");
}
mRtcEngine = RtcEngine.create(mContext, appId, mEngineEventHandler.mRtcEventHandler);
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
mRtcEngine.enableAudioVolumeIndication(200, 3); // 200 ms
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
+ File.separator + mContext.getPackageName() + "/log/agora-rtc.log");
}
return mRtcEngine;
}
示例14: joinChannel
import io.agora.rtc.Constants; //导入依赖的package包/类
public void joinChannel(final String channelId, int uid) {
Log.d(TAG, "joinChannel " + channelId);
this.channelId = channelId;
rtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_COMMUNICATION);
//https://docs.agora.io/cn/1.9/user_guide/API/android_api_live.html?highlight=sethighqualityaudioparameters
//https://docs.agora.io/cn/1.9/user_guide/API/raw_data_api.html#setrecordingaudioframeparameters
//https://docs.agora.io/cn/1.9/user_guide/troubleshooting/error.html
rtcEngine.setRecordingAudioFrameParameters(localAudioBufferFormat.sampleRate, localAudioBufferFormat.channels, Constants.RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, localAudioBufferFormat.sampleRate / 10);
rtcEngine.setPlaybackAudioFrameParameters(remoteAudioBufferFormat.sampleRate, remoteAudioBufferFormat.channels, Constants.RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, remoteAudioBufferFormat.sampleRate / 10);
rtcEngine.setVideoProfile(videoProfile, swapWidth);
rtcEngine.setClientRole(ClientRole.CLIENT_ROLE_BROADCASTER, null);
rtcEngine.joinChannel(null, channelId, null, uid);
}
示例15: joinChannel
import io.agora.rtc.Constants; //导入依赖的package包/类
private void joinChannel() {
mRtcEngine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER, null);
mRtcEngine.joinChannel(null, "CustomizedVideoSourceChannel1", "Extra Optional Data", 0); // if you do not specify the uid, we will generate the uid for you
}