@Override public void onConnected(Session session) { Log.v(TAG, "Connected to session " + session.getSessionId()); Log.v(TAG, "Starting to publish video to session " + session.getSessionId()); videoOutPublisher = new Publisher(context); videoOutPublisher .swapCamera(); // need a button to make this controlled by user, depending on phone videoOutPublisher.setPublisherListener(this); videoOutViewGroup.addView(videoOutPublisher.getView()); getSession().publish(videoOutPublisher); }
public void startTransmitting(ViewGroup frame) { mPublisher = new Publisher(mContext, "You"); mPublisher.setCapturer(new CustomVideoCapturer(mContext)); // mPublisher.setRenderer(new CustomVideoRenderer(mContext)); mPublisher.setPublisherListener(mPublisherListener); mPublisher.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); frame.removeAllViews(); frame.addView(mPublisher.getView(), params); mSession.publish(mPublisher); }
// callbacks @Override protected void onConnected() { Publisher p = new Publisher(mContext, "MyPublisher"); publish(p); // Add video preview RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mPreview.addView(p.getView(), lp); p.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); presentText("Welcome to OpenTok Chat."); }