本文整理汇总了Java中android.view.SurfaceView.setZOrderMediaOverlay方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceView.setZOrderMediaOverlay方法的具体用法?Java SurfaceView.setZOrderMediaOverlay怎么用?Java SurfaceView.setZOrderMediaOverlay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.SurfaceView
的用法示例。
在下文中一共展示了SurfaceView.setZOrderMediaOverlay方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: switchToSmallVideoView
import android.view.SurfaceView; //导入方法依赖的package包/类
private void switchToSmallVideoView(int bigBgUid) {
HashMap<Integer, SurfaceView> slice = new HashMap<>(1);
slice.put(bigBgUid, mUidsList.get(bigBgUid));
Iterator<SurfaceView> iterator = mUidsList.values().iterator();
while (iterator.hasNext()) {
SurfaceView s = iterator.next();
s.setZOrderOnTop(true);
s.setZOrderMediaOverlay(true);
}
mUidsList.get(bigBgUid).setZOrderOnTop(false);
mUidsList.get(bigBgUid).setZOrderMediaOverlay(false);
mGridVideoViewContainer.initViewContainer(this, bigBgUid, slice, mIsLandscape);
bindToSmallVideoView(bigBgUid);
mLayoutType = LAYOUT_TYPE_SMALL;
requestRemoteStreamType(mUidsList.size());
}
示例2: initUIandEvent
import android.view.SurfaceView; //导入方法依赖的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);
}
示例3: onCreate
import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multi_surface_test);
// #1 is at the bottom; mark it as secure just for fun. By default, this will use
// the RGB565 color format.
mSurfaceView1 = (SurfaceView) findViewById(R.id.multiSurfaceView1);
mSurfaceView1.getHolder().addCallback(this);
mSurfaceView1.setSecure(true);
// #2 is above it, in the "media overlay"; must be translucent or we will totally
// obscure #1 and it will be ignored by the compositor. The addition of the alpha
// plane should switch us to RGBA8888.
mSurfaceView2 = (SurfaceView) findViewById(R.id.multiSurfaceView2);
mSurfaceView2.getHolder().addCallback(this);
mSurfaceView2.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mSurfaceView2.setZOrderMediaOverlay(true);
// #3 is above everything, including the UI. Also translucent.
mSurfaceView3 = (SurfaceView) findViewById(R.id.multiSurfaceView3);
mSurfaceView3.getHolder().addCallback(this);
mSurfaceView3.getHolder().setFormat(PixelFormat.TRANSLUCENT);
mSurfaceView3.setZOrderOnTop(true);
}
示例4: composeDataItem1
import android.view.SurfaceView; //导入方法依赖的package包/类
public static void composeDataItem1(final ArrayList<UserStatusData> users, HashMap<Integer, SurfaceView> uids, int localUid) {
for (HashMap.Entry<Integer, SurfaceView> entry : uids.entrySet()) {
if (DEBUG) {
log.debug("composeDataItem1 " + (entry.getKey() & 0xFFFFFFFFL) + " " + (localUid & 0xFFFFFFFFL) + " " + users.size() + " " + entry.getValue());
}
SurfaceView surfaceV = entry.getValue();
surfaceV.setZOrderOnTop(false);
surfaceV.setZOrderMediaOverlay(false);
searchUidsAndAppend(users, entry, localUid, UserStatusData.DEFAULT_STATUS, UserStatusData.DEFAULT_VOLUME, null);
}
removeNotExisted(users, uids, localUid);
}
示例5: onCreate
import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SimpleExoPlayerView playerView = findViewById(R.id.player_view);
SimpleExoPlayerView previewPlayerView
= findViewById(R.id.previewPlayerView);
previewTimeBar = playerView.findViewById(R.id.exo_progress);
previewTimeBarLayout = findViewById(R.id.previewSeekBarLayout);
previewTimeBarLayout.setTintColorResource(R.color.colorPrimary);
previewTimeBar.addOnPreviewChangeListener(this);
exoPlayerManager = new ExoPlayerManager(playerView, previewPlayerView, previewTimeBarLayout);
exoPlayerManager.play(Uri.parse(getString(R.string.url_hls)));
previewTimeBarLayout.setup(exoPlayerManager);
View view = previewPlayerView.getVideoSurfaceView();
if (view instanceof SurfaceView) {
SurfaceView surfaceView = (SurfaceView) view;
surfaceView.setZOrderMediaOverlay(true);
surfaceView.setZOrderOnTop(true);
surfaceView.setVisibility(View.INVISIBLE);
}
requestFullScreenIfLandscape();
}
示例6: addIntoLargeSizePreviewLayout
import android.view.SurfaceView; //导入方法依赖的package包/类
/**
* 添加surfaceview到largeSizePreviewLayout
*
* @param surfaceView
*/
private void addIntoLargeSizePreviewLayout(SurfaceView surfaceView) {
if (surfaceView.getParent() != null) {
((ViewGroup) surfaceView.getParent()).removeView(surfaceView);
}
largeSizePreviewLayout.addView(surfaceView);
surfaceView.setZOrderMediaOverlay(false);
if (manager.getCallingState() == CallStateEnum.VIDEO || manager.getCallingState() == CallStateEnum.OUTGOING_VIDEO_CALLING) {
largeSizePreviewCoverLayout.setVisibility(View.GONE);
}
}
示例7: addIntoSmallSizePreviewLayout
import android.view.SurfaceView; //导入方法依赖的package包/类
/**
* 添加surfaceview到smallSizePreviewLayout
*/
private void addIntoSmallSizePreviewLayout(SurfaceView surfaceView) {
smallSizePreviewCoverImg.setVisibility(View.GONE);
if (surfaceView.getParent() != null) {
((ViewGroup) surfaceView.getParent()).removeView(surfaceView);
}
smallSizePreviewLayout.addView(surfaceView);
surfaceView.setZOrderMediaOverlay(true);
smallSizePreviewLayout.setVisibility(View.VISIBLE);
}
示例8: onPictureInPictureModeChanged
import android.view.SurfaceView; //导入方法依赖的package包/类
@Override
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
FrameLayout container = findViewById(R.id.local_video_view_container);
SurfaceView surfaceView = (SurfaceView) container.getChildAt(0);
surfaceView.setZOrderMediaOverlay(!isInPictureInPictureMode);
surfaceView.setVisibility(isInPictureInPictureMode ? View.GONE : View.VISIBLE);
container.setVisibility(isInPictureInPictureMode ? View.GONE : View.VISIBLE);
}
示例9: setupLocalVideo
import android.view.SurfaceView; //导入方法依赖的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));
}
示例10: fixZOrder
import android.view.SurfaceView; //导入方法依赖的package包/类
private void fixZOrder(SurfaceView video, SurfaceView preview) {
video.setZOrderOnTop(false);
preview.setZOrderOnTop(true);
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
}
示例11: initUIandEvent
import android.view.SurfaceView; //导入方法依赖的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();
}
示例12: onSwitchRemoteUsers
import android.view.SurfaceView; //导入方法依赖的package包/类
public void onSwitchRemoteUsers(View view) {
String from = (String) view.getTag();
if (from == null)
return;
String to = (String) localView.getTag();
FrameLayout layout = (FrameLayout) view;
SurfaceView fromView = (SurfaceView) layout.getChildAt(0);
SurfaceView toView = localView;
localViewContainer.removeAllViews();
layout.removeAllViews();
View singleRemoteView = remoteViewContainer.findViewWithTag(from + "view");
UserInfo toUserInfo = RongContext.getInstance().getUserInfoFromCache(to);
UserInfo fromUserInfo = RongContext.getInstance().getUserInfoFromCache(from);
AsyncImageView userPortraitView = (AsyncImageView) singleRemoteView.findViewById(R.id.user_portrait);
TextView backUserNameView = (TextView) singleRemoteView.findViewById(R.id.user_name);
if (toUserInfo != null) {
if (toUserInfo.getPortraitUri() != null) {
userPortraitView.setAvatar(toUserInfo.getPortraitUri().toString(), R.drawable.rc_default_portrait);
}
backUserNameView.setText(toUserInfo.getName());
} else {
backUserNameView.setText(to);
}
singleRemoteView.setTag(to + "view");
fromView.setZOrderOnTop(false);
fromView.setZOrderMediaOverlay(false);
localViewContainer.addView(fromView);
toView.setZOrderOnTop(true);
toView.setZOrderMediaOverlay(true);
layout.addView(toView);
TextView topUserNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name);
topUserNameView.setTag(from + "name");
if (fromUserInfo != null) {
topUserNameView.setText(fromUserInfo.getName());
} else {
topUserNameView.setText(from);
}
layout.setTag(to);
localView = fromView;
localView.setTag(from);
localViewUserId = from;
}
示例13: initUIandEvent
import android.view.SurfaceView; //导入方法依赖的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();
}