当前位置: 首页>>代码示例>>Java>>正文


Java VideoCanvas类代码示例

本文整理汇总了Java中io.agora.rtc.video.VideoCanvas的典型用法代码示例。如果您正苦于以下问题:Java VideoCanvas类的具体用法?Java VideoCanvas怎么用?Java VideoCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VideoCanvas类属于io.agora.rtc.video包,在下文中一共展示了VideoCanvas类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initUIandEvent

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
@Override
protected void initUIandEvent() {
    event().addEventHandler(this);

    Intent i = getIntent();
    int cRole = i.getIntExtra(ConstantApp.ACTION_KEY_CROLE, 0);

    if (cRole == 0) {
        throw new RuntimeException("Should not reach here");
    }

    String roomName = i.getStringExtra(ConstantApp.ACTION_KEY_ROOM_NAME);

    doConfigEngine(cRole);

    mGridVideoViewContainer = (GridVideoViewContainer) findViewById(R.id.grid_video_view_container);
    mGridVideoViewContainer.setItemEventHandler(new VideoViewEventListener() {
        @Override
        public void onItemDoubleClick(View v, Object item) {
            log.debug("onItemDoubleClick " + v + " " + item);

            if (mUidsList.size() < 2) {
                return;
            }

            if (mViewType == VIEW_TYPE_DEFAULT)
                switchToSmallVideoView(((VideoStatusData) item).mUid);
            else
                switchToDefaultVideoView();
        }
    });

    ImageView button1 = (ImageView) findViewById(R.id.btn_1);
    ImageView button2 = (ImageView) findViewById(R.id.btn_2);
    ImageView button3 = (ImageView) findViewById(R.id.btn_3);

    if (isBroadcaster(cRole)) {
        SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
        rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, 0));
        surfaceV.setZOrderOnTop(true);
        surfaceV.setZOrderMediaOverlay(true);

        mUidsList.put(0, surfaceV); // get first surface view

        mGridVideoViewContainer.initViewContainer(getApplicationContext(), 0, mUidsList); // first is now full view
        worker().preview(true, surfaceV, 0);
        broadcasterUI(button1, button2, button3);
    } else {
        audienceUI(button1, button2, button3);
    }

    worker().joinChannel(roomName, config().mUid);

    TextView textRoomName = (TextView) findViewById(R.id.room_name);
    textRoomName.setText(roomName);
}
 
开发者ID:AgoraIO,项目名称:OpenLive-Android,代码行数:57,代码来源:LiveRoomActivity.java

示例2: preview

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
public final void preview(boolean start, SurfaceView view, int uid) {
    if (Thread.currentThread() != this) {
        log.warn("preview() - worker thread asynchronously " + start + " " + view + " " + (uid & 0XFFFFFFFFL));
        Message envelop = new Message();
        envelop.what = ACTION_WORKER_PREVIEW;
        envelop.obj = new Object[]{start, view, uid};
        mWorkerHandler.sendMessage(envelop);
        return;
    }

    ensureRtcEngineReadyLock();
    if (start) {
        mRtcEngine.setupLocalVideo(new VideoCanvas(view, VideoCanvas.RENDER_MODE_HIDDEN, uid));
        mRtcEngine.startPreview();
    } else {
        mRtcEngine.stopPreview();
    }
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:19,代码来源:WorkerThread.java

示例3: setupRemoteVideo

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void setupRemoteVideo(int uid) {
    FrameLayout container = (FrameLayout) findViewById(R.id.remote_video_view_container);

    if (container.getChildCount() >= 1) {
        return;
    }

    SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
    container.addView(surfaceView);
    mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, uid));
    surfaceView.setTag(uid); // for mark purpose
    View tipMsg = findViewById(R.id.quick_tips_when_use_agora_sdk); // optional UI
    tipMsg.setVisibility(View.GONE);
}
 
开发者ID:AgoraIO,项目名称:Agora-Video-Source-Android,代码行数:15,代码来源:VideoChatViewActivity.java

示例4: doRenderRemoteUi

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void doRenderRemoteUi(final int uid) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (isFinishing()) {
                return;
            }

            if (mUidsList.containsKey(uid)) {
                return;
            }

            SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
            mUidsList.put(uid, surfaceV);

            boolean useDefaultLayout = mLayoutType == LAYOUT_TYPE_DEFAULT;

            surfaceV.setZOrderOnTop(true);
            surfaceV.setZOrderMediaOverlay(true);

            rtcEngine().setupRemoteVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, uid));

            if (useDefaultLayout) {
                log.debug("doRenderRemoteUi LAYOUT_TYPE_DEFAULT " + (uid & 0xFFFFFFFFL));
                switchToDefaultVideoView();
            } else {
                int bigBgUid = mSmallVideoViewAdapter == null ? uid : mSmallVideoViewAdapter.getExceptedUid();
                log.debug("doRenderRemoteUi LAYOUT_TYPE_SMALL " + (uid & 0xFFFFFFFFL) + " " + (bigBgUid & 0xFFFFFFFFL));
                switchToSmallVideoView(bigBgUid);
            }
        }
    });
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:34,代码来源:ChatActivity.java

示例5: doRenderRemoteUi

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void doRenderRemoteUi(final int uid) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (isFinishing()) {
                return;
            }

            SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
            surfaceV.setZOrderOnTop(true);
            surfaceV.setZOrderMediaOverlay(true);
            mUidsList.put(uid, surfaceV);
            if (config().mUid == uid) {
                rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, uid));
            } else {
                rtcEngine().setupRemoteVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, uid));
            }

            if (mViewType == VIEW_TYPE_DEFAULT) {
                log.debug("doRenderRemoteUi VIEW_TYPE_DEFAULT" + " " + (uid & 0xFFFFFFFFL));
                switchToDefaultVideoView();
            } else {
                int bigBgUid = mSmallVideoViewAdapter.getExceptedUid();
                log.debug("doRenderRemoteUi VIEW_TYPE_SMALL" + " " + (uid & 0xFFFFFFFFL) + " " + (bigBgUid & 0xFFFFFFFFL));
                switchToSmallVideoView(bigBgUid);
            }
        }
    });
}
 
开发者ID:AgoraIO,项目名称:OpenLive-Android,代码行数:30,代码来源:LiveRoomActivity.java

示例6: doRenderRemoteUi

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void doRenderRemoteUi(final int uid) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (isFinishing()) {
                return;
            }

            if (mUidsList.containsKey(uid)) {
                return;
            }

            SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
            mUidsList.put(uid, surfaceV);

            boolean useDefaultLayout = mLayoutType == LAYOUT_TYPE_DEFAULT && mUidsList.size() != 2;

            surfaceV.setZOrderOnTop(!useDefaultLayout);
            surfaceV.setZOrderMediaOverlay(!useDefaultLayout);

            rtcEngine().setupRemoteVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, uid));

            if (useDefaultLayout) {
                log.debug("doRenderRemoteUi LAYOUT_TYPE_DEFAULT " + (uid & 0xFFFFFFFFL));
                switchToDefaultVideoView();
            } else {
                int bigBgUid = mSmallVideoViewAdapter == null ? uid : mSmallVideoViewAdapter.getExceptedUid();
                log.debug("doRenderRemoteUi LAYOUT_TYPE_SMALL " + (uid & 0xFFFFFFFFL) + " " + (bigBgUid & 0xFFFFFFFFL));
                switchToSmallVideoView(bigBgUid);
            }
        }
    });
}
 
开发者ID:huangjingqiang,项目名称:SWDemo,代码行数:34,代码来源:ChatActivity.java

示例7: setupLocalVideo

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void setupLocalVideo() {
    FrameLayout container = findViewById(R.id.local_video_view_container);
    SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
    surfaceView.setZOrderMediaOverlay(true);
    container.addView(surfaceView);
    mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, 0));
}
 
开发者ID:AgoraIO,项目名称:Agora-Picture-in-Picture-Android,代码行数:8,代码来源:VideoChatViewActivity.java

示例8: setupRemoteVideo

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void setupRemoteVideo(int uid) {
    FrameLayout container = findViewById(R.id.remote_video_view_container);

    if (container.getChildCount() >= 1) {
        return;
    }

    SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
    container.addView(surfaceView);
    mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, uid));

    surfaceView.setTag(uid); // for mark purpose
    View tipMsg = findViewById(R.id.quick_tips_when_use_agora_sdk); // optional UI
    tipMsg.setVisibility(View.GONE);
}
 
开发者ID:AgoraIO,项目名称:Agora-Picture-in-Picture-Android,代码行数:16,代码来源:VideoChatViewActivity.java

示例9: setupLocalVideo

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void setupLocalVideo() {
    FrameLayout container = (FrameLayout) findViewById(R.id.local_video_view_container);
    SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
    surfaceView.setZOrderMediaOverlay(true);
    container.addView(surfaceView);
    mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, 0));
}
 
开发者ID:AgoraIO,项目名称:Agora-Android-Tutorial-1to1,代码行数:8,代码来源:VideoChatViewActivity.java

示例10: setupRemoteVideo

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
private void setupRemoteVideo(int uid) {
    FrameLayout container = (FrameLayout) findViewById(R.id.remote_video_view_container);

    if (container.getChildCount() >= 1) {
        return;
    }

    SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext());
    container.addView(surfaceView);
    mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, uid));

    surfaceView.setTag(uid); // for mark purpose
    View tipMsg = findViewById(R.id.quick_tips_when_use_agora_sdk); // optional UI
    tipMsg.setVisibility(View.GONE);
}
 
开发者ID:AgoraIO,项目名称:Agora-Android-Tutorial-1to1,代码行数:16,代码来源:VideoChatViewActivity.java

示例11: initUIandEvent

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
@Override
protected void initUIandEvent() {
    event().addEventHandler(this);

    Intent i = getIntent();

    String channelName = i.getStringExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME);

    final String encryptionKey = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY);
    final String encryptionMode = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE);

    doConfigEngine(encryptionKey, encryptionMode);

    mGridVideoViewContainer = (GridVideoViewContainer) findViewById(R.id.grid_video_view_container);
    mGridVideoViewContainer.setItemEventHandler(new VideoViewEventListener() {
        @Override
        public void onItemDoubleClick(View v, Object item) {
            log.debug("onItemDoubleClick " + v + " " + item + " " + mLayoutType);

            if (mUidsList.size() < 2) {
                return;
            }

            UserStatusData user = (UserStatusData) item;
            int uid = (user.mUid == 0) ? config().mUid : user.mUid;

            if (mLayoutType == LAYOUT_TYPE_DEFAULT && mUidsList.size() != 1) {
                switchToSmallVideoView(uid);
            } else {
                switchToDefaultVideoView();
            }
        }
    });

    SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
    rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, 0));
    surfaceV.setZOrderOnTop(false);
    surfaceV.setZOrderMediaOverlay(false);

    mUidsList.put(0, surfaceV); // get first surface view

    mGridVideoViewContainer.initViewContainer(this, 0, mUidsList, mIsLandscape); // first is now full view
    worker().preview(true, surfaceV, 0);

    worker().joinChannel(channelName, config().mUid);

    TextView textChannelName = (TextView) findViewById(R.id.channel_name);
    textChannelName.setText(channelName);

    optional();

    LinearLayout bottomContainer = (LinearLayout) findViewById(R.id.bottom_container);
    FrameLayout.MarginLayoutParams fmp = (FrameLayout.MarginLayoutParams) bottomContainer.getLayoutParams();
    fmp.bottomMargin = virtualKeyHeight() + 16;

    initMessageList();
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:58,代码来源:ChatActivity.java

示例12: initUIandEvent

import io.agora.rtc.video.VideoCanvas; //导入依赖的package包/类
@Override
protected void initUIandEvent() {
    event().addEventHandler(this);

    Intent i = getIntent();

    String channelName = i.getStringExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME);

    final String encryptionKey = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY);

    final String encryptionMode = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE);

    doConfigEngine(encryptionKey, encryptionMode);

    mGridVideoViewContainer = (GridVideoViewContainer) findViewById(R.id.grid_video_view_container);
    mGridVideoViewContainer.setItemEventHandler(new VideoViewEventListener() {
        @Override
        public void onItemDoubleClick(View v, Object item) {
            log.debug("onItemDoubleClick " + v + " " + item + " " + mLayoutType);

            if (mUidsList.size() < 2) {
                return;
            }

            UserStatusData user = (UserStatusData) item;
            int uid = (user.mUid == 0) ? config().mUid : user.mUid;

            if (mLayoutType == LAYOUT_TYPE_DEFAULT && mUidsList.size() != 1) {
                switchToSmallVideoView(uid);
            } else {
                switchToDefaultVideoView();
            }
        }
    });

    SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
    rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, 0));
    surfaceV.setZOrderOnTop(false);
    surfaceV.setZOrderMediaOverlay(false);

    mUidsList.put(0, surfaceV); // get first surface view

    mGridVideoViewContainer.initViewContainer(getApplicationContext(), 0, mUidsList); // first is now full view
    worker().preview(true, surfaceV, 0);
    config().mUid = AGApplication.uid;
    String channelKey = AGApplication.channelKey;
    worker().joinChannel(channelName, config().mUid,channelKey);

    TextView textChannelName = (TextView) findViewById(R.id.channel_name);
    textChannelName.setText(channelName);

    optional();

    LinearLayout bottomContainer = (LinearLayout) findViewById(R.id.bottom_container);
    FrameLayout.MarginLayoutParams fmp = (FrameLayout.MarginLayoutParams) bottomContainer.getLayoutParams();
    fmp.bottomMargin = virtualKeyHeight() + 16;

    initMessageList();
}
 
开发者ID:huangjingqiang,项目名称:SWDemo,代码行数:60,代码来源:ChatActivity.java


注:本文中的io.agora.rtc.video.VideoCanvas类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。