public virtual void SetupVideo(Guid id) { global::Android.App.Application.SynchronizationContext.Post(_ => { AgoraVideoViewHolder <FrameLayout> container = _containers.FirstOrDefault(a => a.GUID == id); if (container == null) { return; } SurfaceView layout = RtcEngine.CreateRendererView(container.NativeView.Context); layout.SetZOrderMediaOverlay(true); container.NativeView.AddView(layout); VideoCanvas canvas = new VideoCanvas(layout, (int)container.VideoView.Mode, (int)container.StreamUID); container.VideoView.IsOffline = false; if (container.StreamUID == 0 || container.StreamUID == _myId) { _agoraEngine?.SetupLocalVideo(canvas); _agoraEngine?.StartPreview(); } else { _agoraEngine?.SetupRemoteVideo(canvas); } container.NativeView.Visibility = ViewStates.Visible; }, null); }
/// <summary> /// Setups the video. /// </summary> /// <param name="uid">Uid.</param> public virtual void SetupVideo(uint uid) { global::Android.App.Application.SynchronizationContext.Post(_ => { AgoraVideoViewHolder <FrameLayout>[] containers = _containers.Where(a => a.StreamUID == uid).ToArray(); if (containers.Length == 0) { return; } containers.ToList().ForEach(container => { SurfaceView layout = RtcEngine.CreateRendererView(container.NativeView.Context); layout.SetZOrderMediaOverlay(true); container.NativeView.AddView(layout); VideoCanvas canvas = new VideoCanvas(layout, (int)container.VideoView.Mode, (int)uid); container.VideoView.IsOffline = false; if (_agoraEngine != null) { if (uid == 0 || uid == _myId) { _agoraEngine.SetupLocalVideo(canvas); _agoraEngine.StartPreview(); } else { _agoraEngine.SetupRemoteVideo(canvas); } } container.NativeView.Visibility = ViewStates.Visible; }); }, null); }
internal override int JoinChannel() { int ret = -1; if (null != rtc_engine_) { ret = rtc_engine_.EnableAudio(); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "EnableAudio", ret); ret = rtc_engine_.EnableVideo(); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "EnableVideo", ret); VideoCanvas vs = new VideoCanvas((ulong)local_win_id_, RENDER_MODE_TYPE.RENDER_MODE_FIT); ret = rtc_engine_.SetupLocalVideo(vs); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "SetupLocalVideo", ret); } if (null != first_channel_) { ret = first_channel_.JoinChannel("", "", 0, new ChannelMediaOptions(true, true, true, true)); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "JoinChannel(ch1)", ret); ret = first_channel_.Publish(); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "Publish(ch1)", ret); } if (null != second_channel_) { ret = second_channel_.JoinChannel("", "", 0, new ChannelMediaOptions(true, true, false, false)); CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "JoinChannel(ch2)", ret); // 同一时刻只能发布一路流 //ret = second_channel_.Publish(); //CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "Publish(ch2)", ret); } return(ret); }
public override void OnJoinChannelSuccess(string channel, uint uid, int elapsed) { Console.WriteLine("----->OnJoinChannelSuccess channel={0} uid={1}", channel, uid); VideoCanvas vs = new VideoCanvas((ulong)joinChannelVideo_inst_.GetLocalWinId(), RENDER_MODE_TYPE.RENDER_MODE_FIT, channel); int ret = joinChannelVideo_inst_.GetEngine().SetupLocalVideo(vs); Console.WriteLine("----->SetupLocalVideo ret={0}", ret); }
public override void OnJoinChannelSuccess(string channel, uint uid, int elapsed) { Console.WriteLine("----->OnJoinChannelSuccess, channel={0}, uid={1}", channel, uid); VideoCanvas vs = new VideoCanvas((ulong)videoGroup_inst_.GetLocalWindowId(), RENDER_MODE_TYPE.RENDER_MODE_FIT, channel); int ret = CSharpForm.usr_engine_.GetEngine().SetupLocalVideo(vs); Console.WriteLine("----->SetupLocalVideo, ret={0}", ret); }
public override void OnUserJoined(uint uid, int elapsed) { Console.WriteLine("----->OnUserJoined uid={0}", uid); if (joinChannelVideo_inst_.GetRemoteWinId() == IntPtr.Zero) { return; } var vc = new VideoCanvas((ulong)joinChannelVideo_inst_.GetRemoteWinId(), RENDER_MODE_TYPE.RENDER_MODE_FIT, joinChannelVideo_inst_.GetChannelId(), uid); int ret = joinChannelVideo_inst_.GetEngine().SetupRemoteVideo(vc); Console.WriteLine("----->SetupRemoteVideo, ret={0}", ret); }
void InitVideoCanvas() { var go = GameObject.Find("VideoCanvas"); if (go.IsNotNull()) { go.DestroySelfGracefully(); } mVideoCanvas = ResLoader.Allocate().LoadSync <GameObject>("VideoCanvas").Instantiate() .GetComponent <VideoCanvas>(); }
public void Dispaly(int count, int width, int height) { this.Width = width; this.Height = height; Canvas = new Canvas(System.Drawing.Point.Empty, new Size(width, height)); System.Drawing.SolidBrush brush = new SolidBrush(Color.Red); System.Drawing.Font font = new System.Drawing.Font("宋体", 22.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); if (count < 0 || count > MAXVIDEO_NUM) { return; } Image image = Image.FromFile(@"D:\Mixer\SlWClient\SS.WPFClient\Images\bg_module_call.png"); mapRects.Clear(); CreateRect(count); System.Drawing.Font logFont = new System.Drawing.Font("宋体", 22.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); for (int i = 0; i < count; i++) { if (mapRects[i] != null) { Rectangle rect = (Rectangle)mapRects[i]; var vc = new VideoCanvas(rect.Location, rect.Size, image); monitor[i] = new VideoCanvasPlay(vc); MarqueeCanvas logmarCanvas = new MarqueeCanvas(vc.Location, vc.Size, new Point(20, 30), "_log", logFont, brush, 60, Direction.Down); logmarCanvas.ID = 35; vc.Add(logmarCanvas); vc.Start(); vc.ID = i; Canvas.Add(vc); } } TimeCanvas timecanvas = new TimeCanvas(Point.Empty, new Size(100, 100), Point.Empty, "", font, brush, ""); timecanvas.ID = 29; Canvas.Add(timecanvas); System.Drawing.Font font1 = new System.Drawing.Font("宋体", 42.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); MarqueeCanvas marCanvas = new MarqueeCanvas(new Point(0, height - 200), new Size(width, 200), new Point(100, 40), "你好,欢迎光临视联动力^*^^*^^*^^*^^*^^*^^*^^*^^*^^*^^*^^*^??!!!!!!!!!!!!!!!!!!!!!!!!!!", font1, brush, 40, Direction.Left); ImageCanvas imgCanvas = new ImageCanvas(new Point(width - 150, 0), new Size(300, 400), Point.Empty, Image.FromFile(@"D:\VisionVera\视联动力图标.png")); imgCanvas.ID = 30; Canvas.Add(imgCanvas); marCanvas.ID = 31; Canvas.Add(marCanvas); }
private void VideoCanvas_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // Capture and track the mouse. _mouseDown = true; _mouseDownPos = e.GetPosition(VideoCanvas); VideoCanvas.CaptureMouse(); // Initial placement of the drag selection box. Canvas.SetLeft(selectionRectangle, _mouseDownPos.X); Canvas.SetTop(selectionRectangle, _mouseDownPos.Y); selectionRectangle.Width = 0; selectionRectangle.Height = 0; //_croppedImage = null; // Make the drag selection box visible. selectionRectangle.Visibility = Visibility.Visible; }
public override void OnUserJoined(uint uid, int elapsed) { Console.WriteLine("----->OnUserJoined, uid={0}", uid); VideoCanvas vc = null; // only consider two users here if (remoteWin_idx_++ % 2 == 0) { vc = new VideoCanvas((ulong)videoGroup_inst_.GetRemoteFirstWinId(), RENDER_MODE_TYPE.RENDER_MODE_FIT, videoGroup_inst_.GetChannelId(), uid); } else { vc = new VideoCanvas((ulong)videoGroup_inst_.GetRemoteSecondWinId(), RENDER_MODE_TYPE.RENDER_MODE_FIT, videoGroup_inst_.GetChannelId(), uid); } int ret = CSharpForm.usr_engine_.GetEngine().SetupRemoteVideo(vc); Console.WriteLine("----->OnUserJoined, ret={0}", ret); }
private void VideoCanvas_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { // Release the mouse capture and stop tracking it. _mouseDown = false; VideoCanvas.ReleaseMouseCapture(); if (!_lockSelection) { Crop(); } else { MessageBox.Show( ResLocalization.NoChangeAllowed, ResLocalization.Warning, MessageBoxButton.OK, MessageBoxImage.Warning); } // Hide the drag selection box. selectionRectangle.Visibility = Visibility.Collapsed; }
private void InitializeAgoraAndroidControl(FrameLayout container, int uid) { Console.WriteLine($"Renderer - we should show stream with uid = {uid}"); if (uid == 0) { //stop video } else { if (container.ChildCount == 0) { var surfaceView = RtcEngine.CreateRendererView(DemoHelper.Context); container.AddView(surfaceView); var videoCanvas = new VideoCanvas(surfaceView, VideoCanvas.RenderModeHidden, uid); var rtcEngine = DemoHelper.CurrentAgoraEngine.RtcEngine; var result = rtcEngine.SetupRemoteVideo(videoCanvas); Console.WriteLine($"Set remote video result {result}"); } } }
public override void OnUserJoined(string channelId, uint uid, int elapsed) { IntPtr win_id = IntPtr.Zero; if (channelId == joinMultipleChannelChannel_inst_.GetFistChannelId()) { win_id = joinMultipleChannelChannel_inst_.GetRemoteFirstWinId(); } else if (channelId == joinMultipleChannelChannel_inst_.GetSecondChannelId()) { win_id = joinMultipleChannelChannel_inst_.GetRemoteSecondWinId(); } else { Console.WriteLine("----->OnUserJoined, invalid channelId{0} !!!", channelId); return; } var vc = new VideoCanvas((ulong)win_id, RENDER_MODE_TYPE.RENDER_MODE_FIT, channelId, uid); int ret = CSharpForm.usr_engine_.GetEngine().SetupRemoteVideo(vc); Console.WriteLine("----->OnUserJoined, channelId={0} uid={1} ret ={2}", channelId, uid, ret); }
public abstract int SetupLocalVideo(VideoCanvas canvas);
public abstract int SetupRemoteVideo(VideoCanvas canvas);
public void CloseVideoPanel() { VideoCanvas.SetActive(false); }
public void VideoButton() { VideoCanvas.SetActive(true); VideoPlayer.Play(); }
public VideoCanvasPlay(VideoCanvas canvas) : base(canvas) { }