private void PublishStream(object sender, EventArgs e) { if (String.IsNullOrEmpty(publishSreamID.Text)) { throw new Exception("publishSreamID should not be empty!"); } ZegoCanvas preViewCanvas = new ZegoCanvas(); preViewCanvas.view = pictureBox1.Handle; preViewCanvas.viewMode = ZegoViewMode.Fit;//设置有效 engine.StartPreview(preViewCanvas); engine.StartPublishingStream(publishSreamID.Text); }
public void OnPreviewButtonClicked()//preview use rawimage { mainLocalVideoPlane = GameObject.Find("MainPreViewRawImage"); if (mainLocalVideoPlane != null && localVideoSurface == null) { localVideoSurface = mainLocalVideoPlane.AddComponent <RawImageVideoSurface>(); localVideoSurface.SetCaptureVideoInfo(); localVideoSurface.SetVideoSource(engine); } engine.StartPreview(); }