本文整理汇总了Java中org.webrtc.VideoRendererGui类的典型用法代码示例。如果您正苦于以下问题:Java VideoRendererGui类的具体用法?Java VideoRendererGui怎么用?Java VideoRendererGui使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VideoRendererGui类属于org.webrtc包,在下文中一共展示了VideoRendererGui类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAddRemoteStream
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onAddRemoteStream(final MediaStream remoteStream, final PnPeer peer) {
super.onAddRemoteStream(remoteStream, peer); // Will log values
VideoChatActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(VideoChatActivity.this,"Connected to " + peer.getId(), Toast.LENGTH_SHORT).show();
try {
if(remoteStream.audioTracks.size()==0 || remoteStream.videoTracks.size()==0) return;
mCallStatus.setVisibility(View.GONE);
remoteStream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
VideoRendererGui.update(remoteRender, 0, 0, 100, 100, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
VideoRendererGui.update(localRender, 72, 65, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FIT, true);
}
catch (Exception e){ e.printStackTrace(); }
}
});
}
示例2: RoomChatPresenter
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
public RoomChatPresenter(IRoomChatView view) {
mView = view;
mSocketAddress = "http://" + App.getInstance().getString(R.string.stream_host);
mSocketAddress += (":" + App.getInstance().getString(R.string.stream_port) + "/");
GLSurfaceView surfaceView = mView.getSurfaceView();
surfaceView.setPreserveEGLContextOnPause(true);
surfaceView.setKeepScreenOn(true);
VideoRendererGui.setView(surfaceView, new Runnable() {
@Override
public void run() {
// SurfaceView 准备完毕
L.d("eglContextReadyCallback");
init();
}
});
localRender = VideoRendererGui.create(
0, 0,
50, 50, scalingType, true);
}
示例3: onCreate
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");
java.lang.System.setProperty("java.net.preferIPv4Stack", "true");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_janus);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
vsv = (GLSurfaceView) findViewById(R.id.glview);
vsv.setPreserveEGLContextOnPause(true);
vsv.setKeepScreenOn(true);
VideoRendererGui.setView(vsv, new MyInit());
localRender = VideoRendererGui.create(72, 72, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
remoteRender = VideoRendererGui.create(0, 0, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true);
}
示例4: attachVideoRenderer
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
/**
* Attach the call's video renderers to the specified GLSurfaceView
*
* @param glView The GLSurfaceView on which to render video
*/
public void attachVideoRenderer(GLSurfaceView glView) {
if (null != glView) {
VideoRendererGui.setView(glView, new Runnable() {
@Override
public void run() {
Log.d(TAG, "VideoRendererGui GL Context ready");
}
});
remoteRender = VideoRendererGui.create(0, 0, 100, 100,
VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
localRender = VideoRendererGui.create(70, 5, 25, 25,
VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
}
}
示例5: onCreate
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(
LayoutParams.FLAG_FULLSCREEN
| LayoutParams.FLAG_KEEP_SCREEN_ON
| LayoutParams.FLAG_DISMISS_KEYGUARD
| LayoutParams.FLAG_SHOW_WHEN_LOCKED
| LayoutParams.FLAG_TURN_SCREEN_ON);
// setContentView(R.layout.main);
// mSocketAddress = "http://" + getResources().getString(R.string.host);
// mSocketAddress += (":" + getResources().getString(R.string.port) + "/");
//
// vsv = (GLSurfaceView) findViewById(R.id.glview_call);
// vsv.setPreserveEGLContextOnPause(true);
// vsv.setKeepScreenOn(true);
VideoRendererGui.setView(vsv, new Runnable() {
@Override
public void run() {
init();
}
});
// local and remote render
remoteRender = VideoRendererGui.create(
REMOTE_X, REMOTE_Y,
REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, false);
localRender = VideoRendererGui.create(
LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING,
LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING, scalingType, true);
final Intent intent = getIntent();
final String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) {
final List<String> segments = intent.getData().getPathSegments();
callerId = segments.get(0);
}
}
示例6: onLocalStream
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onLocalStream(MediaStream localStream) {
localStream.videoTracks.get(0).addRenderer(new VideoRenderer(localRender));
VideoRendererGui.update(localRender,
LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING,
LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING,
scalingType, true);
}
示例7: onAddRemoteStream
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onAddRemoteStream(MediaStream remoteStream, int endPoint) {
remoteStream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
VideoRendererGui.update(remoteRender,
REMOTE_X, REMOTE_Y,
REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, true);
VideoRendererGui.update(localRender,
LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED,
LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED,
scalingType, true);
}
示例8: onRemoveRemoteStream
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onRemoveRemoteStream(int endPoint) {
VideoRendererGui.update(localRender,
LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING,
LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING,
scalingType, true);
}
示例9: init
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
private void init() {
if (mView == null) {
L.w("view is null, it may be destroyed");
return;
}
Point displaySize = mView.getDisplaySize();
// TODO make sure video height and width supported.确保手机摄像头支持displaySize的分辨率
PeerConnectionParameters params = new PeerConnectionParameters(
true, false, displaySize.x, displaySize.y, 30, 1, VIDEO_CODEC_VP9, true, 1, AUDIO_CODEC_OPUS, true);
mWebRtcClient = new WebRtcClient(this, mSocketAddress, params, VideoRendererGui.getEGLContext());
}
示例10: addRender
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
private void addRender(MediaStream stream, int position) {
VideoRenderer.Callbacks render;
L.d("addRender position is " + position);
if (position == 0) {
render = localRender;
} else {
render = VideoRendererGui.create(position % 2 == 0 ? 0 : 50,
position / 2 * 50,
50, 50,
scalingType, false);
}
stream.videoTracks.get(0).addRenderer(new VideoRenderer(render));
}
示例11: onRemoteStream
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
@Override
public void onRemoteStream(MediaStream stream) {
stream.videoTracks.get(0).setEnabled(true);
if(stream.videoTracks.get(0).enabled())
Log.d("JANUSCLIENT", "video tracks enabled");
stream.videoTracks.get(0).addRenderer(new VideoRenderer(remoteRender));
VideoRendererGui.update(remoteRender, 0, 0, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, true);
VideoRendererGui.update(localRender, 72, 72, 25, 25, VideoRendererGui.ScalingType.SCALE_ASPECT_FILL, false);
}
示例12: init
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
private void init() {
try {
EGLContext con = VideoRendererGui.getEGLContext();
echoTest = new EchoTest(localRender, remoteRender);
echoTest.initializeMediaContext(JanusActivity.this, true, true, true, con);
echoTest.Start();
} catch (Exception ex) {
Log.e("computician.janusclient", ex.getMessage());
}
}
示例13: startLocalMediaSync
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
private boolean startLocalMediaSync() {
if (mediaResourceManager != null && mediaResourceManager.getLocalMediaStream() == null) {
mediaResourceManager.createLocalMediaStream(VideoRendererGui.getEglBaseContext(), localRender);
mediaResourceManager.startVideoSource();
mediaResourceManager.selectCameraPosition(config.getCameraPosition());
return true;
} else {
return false;
}
}
示例14: clientConnected
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
/**
* Notify the shared SDK instance that the specified client has connected. This is for internal use only, and should never be called by your client application.
*
* @param client The client that just connected
*/
public void clientConnected(RespokeClient client) {
if (null != pushToken) {
registerPushServices();
}
if (!factoryStaticInitialized) {
// Perform a one-time WebRTC global initialization
PeerConnectionFactory.initializeAndroidGlobals(context, true, true, true, VideoRendererGui.getEGLContext());
factoryStaticInitialized = true;
}
}
示例15: onClick
import org.webrtc.VideoRendererGui; //导入依赖的package包/类
public void onClick(View v) {
boolean useSurfaceLocal = true;
boolean useSurfaceRemote = false;
Log.d(TAG, "Start decoder WebRTC test. GUI thread id = " + Thread.currentThread().getId());
DecodeWebRTCTest testLocal = new DecodeWebRTCTest();
//DecodeWebRTCTest testRemote = new DecodeWebRTCTest();
try {
testLocal.testDecoder(localRenderer, useSurfaceLocal, VideoRendererGui.getEGLContext());
//testRemote.testDecoder(remoteRenderer, useSurfaceRemote, VideoRendererGui.getEGLContext());
} catch (Throwable e) {
Log.e(TAG, e.toString());
}
Log.d(TAG, "Decoder WebRTC test done");
}