/// <summary> /// Pause Video Animation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PauseVideo(object sender, EventArgs e) { if (VideoControl.CanPause) { VideoControl.Pause(); } }
private void VideoControl_FullScreen(object sender, RoutedEventArgs e) { if (_vpi != null) { VideoControl vc = e.OriginalSource as VideoControl; if (vc.ViewModel.IsFullScreen) { Panel parent = _vpi.Parent as Panel; parent.Children.Remove(_vpi); gridFull.Children.Add(_vpi); } else { if (_isInitFullScreen) { ClearVideoPanel(); } else { Panel parent = _vpi.Parent as Panel; parent.Children.Remove(_vpi); gridMain.Children.Add(_vpi); } } e.Handled = true; } }
private void ValiderFichier_Click(object sender, RoutedEventArgs e) { if (MediaPathTextBox.Text.Length <= 0) { MessageBox.Show("Choisissez une vidéo"); return; } if (SrtTextBox.Text.Length <= 0) { MessageBox.Show("Choisissez un fichier de sous-titre"); return; } PauseTextBox.Text = "1"; VideoControl.Source = new Uri(MediaPathTextBox.Text); VideoControl.Play(); string CheminSrt = SrtTextBox.Text; Srt srt = new Srt(CheminSrt); srt.Lecture(soustitre, PauseTextBox, VideoControl, AvanceRapide, Pla, Pla2); }
public override bool StartPreview(CameraInfo camera, VideoControl vc, int StreamIndex = 0) { VideoSourceInfo videoSourceInfo = camera.VideoSourceInfo; int loginID = Hik_Open8200API.GetLoginID(videoSourceInfo.IP, (int)videoSourceInfo.Port, videoSourceInfo.User, videoSourceInfo.Password); if (loginID == -1) { string error = Hik_Open8200API.GetLastError(); this.LogModule.Error($"初始化登录服务器失败, 错误码:{error}, 设备{videoSourceInfo.IP}:{videoSourceInfo.Port} "); return(false); } int playHandle = Hik_Open8200API.Std_StartRealPlay(loginID, camera.CameraCode, vc.VControl.Handle, StreamIndex, null, IntPtr.Zero); if (playHandle < 0) { string error = Hik_Open8200API.GetLastError(); Hik_Open8200API.Std_StopRealPlay(playHandle); vc.VControl.Refresh(); this.LogModule.Error($"打开图像失败: 错误码:{error}, 摄像机标识: {camera.CameraCode}"); Hik_Open8200API.Std_StopRealPlay(playHandle); return(false); } ControlInfo_Preview cm = new ControlInfo_Preview() { LoginHandle = loginID, Camera = camera, PlayHandle = playHandle, VideoSource = videoSourceInfo, VC = vc, StreamIndex = StreamIndex }; this.m_ControlTable[vc] = cm; return(true); }
public override bool Ptz_DirCamera(VideoControl vc, PTZ.DirDirection dirDirection, int hSpeed, int vSpeed) { ControlInfo_Preview info = this.m_ControlTable[vc] as ControlInfo_Preview; if (info == null) { return(false); } int hspeed = hSpeed * 64 / 256; int vspeed = vSpeed * 64 / 256; string ptzCmd = ""; PTZ.DirDirection d = dirDirection; if (d == PTZ.DirDirection.Stop) { d = (PTZ.DirDirection)info.LastDirection; } switch (d) { case PTZ.DirDirection.Left: ptzCmd = "LEFT"; break; case PTZ.DirDirection.Right: ptzCmd = "RIGHT"; break; case PTZ.DirDirection.Down: ptzCmd = "DOWN"; break; case PTZ.DirDirection.Up: ptzCmd = "UP"; break; case PTZ.DirDirection.LeftUp: ptzCmd = "LEFT_UP"; break; case PTZ.DirDirection.LeftDown: ptzCmd = "LEFT_DOWN"; break; case PTZ.DirDirection.RightUp: ptzCmd = "RIGHT_UP"; break; case PTZ.DirDirection.RightDown: ptzCmd = "RIGHT_DOWN"; break; } if (dirDirection == PTZ.DirDirection.Stop) { ptzCmd += "_STOP"; } info.LastDirection = (int)dirDirection; return(Hik_Open8200API.Std_PtzCtrl((int)info.LoginHandle, info.Camera.CameraCode, ptzCmd, hspeed, 0, 0) >= 0 ? true : false); }
//ADDING OF VIDEO FEEDS #region add video feed private void btnAddFeed_Click(object sender, EventArgs e) { FeedSettings settings = new FeedSettings(); //have some default settings settings.setDetectorSettings(MotionDetectorInstance.MOTION.MOTION_BORDER_HIGHLIGHTING, MotionDetectorInstance.DETECTIONTYPE.TWO_FRAMES_DIFFERENCE, MotionDetectorInstance.DETECTIONSPEED.SLOW, MotionDetectorInstance.DETECTIONSENSITIVITY.HIGH); settings.setFeedSettings("", @"C:\Users\s212227122\Desktop\VehicleSystem\My Movie.wmv", true, true); settings.background = Resources.preview_frame; if (settings.ShowDialog() == DialogResult.OK) { //VideoControl newControl = new VideoControl(settings.feedName, @"C:\Users\Matthew\Desktop\Front Edited.wmv", true, this) { Margin = new Padding(0) }; //C:\Users\Matthew\Desktop\Front Edited.wmv VideoControl newControl = new VideoControl(settings.feedName, settings.feedURL, settings.isEntrance, this) { Margin = new Padding(0), robustChecking = settings.robustChecking }; newControl.updateMotionDetectorDetails(settings.resultRegion, settings.processor, settings.detector, settings.speed, settings.sensitivity); _videoControls.Add(newControl); pnlVideoFeed.Controls.Add(newControl); } Console.WriteLine("Stream added"); }
public async Task StartStreamAsync() { var controlData = new VideoControl( VideoControlFlags.StartStream | VideoControlFlags.RequestKeyframe); await SendAsync(controlData); }
/// <summary> /// Code to project a video /// If the Header value is not provided, the content is projected in full screen mode /// </summary> /// <param name="Content"></param> /// <param name="header"></param> private void ShowVideo(String Content, String header) { try { //Check if header is null //Null - Show full screen content if (String.IsNullOrEmpty(header)) { //Show the full screen video control currentVideoURI = Helper.GetAssetURI(Content); FullScreenVideoControl.Source = new Uri(currentVideoURI); FullScreenContentGrid.Visibility = Visibility.Collapsed; FullScreenVideoGrid.Visibility = Visibility.Visible; FullScreenVideoControl.Play(); } else { TitleLabel.Text = header; currentVideoURI = Helper.GetAssetURI(Content); VideoControl.Source = new Uri(currentVideoURI); ContentGrid.Visibility = Visibility.Collapsed; FullScreenContentGrid.Visibility = Visibility.Collapsed; FullScreenVideoGrid.Visibility = Visibility.Collapsed; VideoControl.Visibility = Visibility.Visible; VideoGrid.Visibility = Visibility.Visible; VideoControl.Play(); } this.UpdateLayout(); } catch (Exception ex) { RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in Show Video method {0}", ex.Message); } }
void OnSceneUpdated(VideoControl videoControl, VideoControl.VideoScene scene) { Debug.LogFormat("OnSceneUpdated :: scene:{0}", scene.label); videoScenesVisitCount [scene.label] += 1; if (videoScenesVisitCount [scene.label] == 1) { // if first time visit then play the associated audio track switch (scene.label) { case VideoControl.SCENE_INTRO: playAudioClips(new string[] { "scene0_a" }); break; case VideoControl.SCENE_TOP_MIDDLE: playAudioClips(new string[] { "scene1_a" }); break; case VideoControl.SCENE_UNDER: playAudioClips(new string[] { "scene2_a" }); break; case VideoControl.SCENE_OUTTRO: playAudioClips(new string[] { "scene3_a" }); break; } } }
private void exitButton(object sender, RoutedEventArgs e) { VideoControl.Stop(); this.sensorChooser.Stop(); this.sG.returnWindow(); this.Close(); }
public IDSCamera(VideoControl videoControl) { this.videoControl = videoControl; this.displayHandle = videoControl.Handle; this.uEyeCamera = new uEye.Camera(); CameraSizeControl = new CameraSizeControl(uEyeCamera); }
private void procVideo_StartPlayback(WSRequest request) { var req = JsonConvert.DeserializeObject <WSVideoRequest_StartPlayback>(request.Params.ToString()); VideoSourceInfo videoSourceInfo = new VideoSourceInfo() { ID = req.SourceID, IP = req.SourceIP, Port = req.SourcePort, User = req.SourceUser, Password = req.SourcePassword, Type = (VideoSourceType)req.SourceType, Name = req.SourceName }; CameraInfo cameraInfo = new CameraInfo() { ID = req.CameraID, CameraCode = req.CameraCode, Name = req.CameraName }; VideoControl vc = this.VideoManager.GetVideoControl(req.PanelID, req.VCIndex); if (vc == null) { this.LogModule.Error("找不到指定控件"); return; } this.VideoManager.StartPlayback(cameraInfo, videoSourceInfo, vc, req.StartTime, req.EndTime); }
private void SentVideoStateData(VideoControl state) { Display_VideoControl display_VideoControl = new Display_VideoControl(); display_VideoControl.state = state.ToString(); UdpSclient.Instance.SendDataToSever(ParmaterCodes.Display_VideoControl, display_VideoControl); }
void framer_DoWork(object sender, DoWorkEventArgs e) { Stopwatch sw = new Stopwatch(); BackgroundWorker worker = (BackgroundWorker)sender; while (!worker.CancellationPending) { int frameTime = (int)(1000 / (double)FPS); int delay = frameTime; sw.Start(); if (saveImages) { byte[] frame = null; this.Dispatcher.Invoke((Action)(() => { frame = VideoControl.GetFrame((Scale / 100D), Quality); })); long ticks = DateTime.Now.Ticks; string name = ticks + ".jpg"; worker.ReportProgress(0, new PushImage() { Image = frame, Name = name }); } sw.Reset(); delay -= (int)sw.ElapsedMilliseconds; if (delay > 0) { System.Threading.Thread.Sleep(delay); } } }
public void StartStream() { var controlData = new VideoControl( VideoControlFlags.StartStream | VideoControlFlags.RequestKeyframe); SendControl(controlData); }
private void TransitionOut() { var opacityTask = OpacityGrid .Fade(1, 0).Then() .Fade(1, 500).Then() .Fade(0, 1500) .StartAsync(); var blurTask = BlurGrid .Blur(50, 1000, easingType: EasingType.Quadratic, easingMode: Windows.UI.Xaml.Media.Animation.EasingMode.EaseInOut).Then() .Blur(0, 1000, easingType: EasingType.Quadratic, easingMode: Windows.UI.Xaml.Media.Animation.EasingMode.EaseInOut) .StartAsync(); _transitionOutTask = Task.WhenAll(opacityTask, blurTask).ContinueWith(async(t) => { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (VideoControl?.MediaPlayer != null) { VideoControl.Deactivate(); ImageControl.UriSource = null; } }); }); }
public void StopVideo( ) { var hr = VideoControl.Stop( ); checkHR(hr, "Failed stopping graph"); File.Move(TempAvi, Path.Combine(VideoFolder, VideoCount++ + ".avi")); VideoRunning = false; CleanupStop( ); }
/// <summary> /// Start Video Animation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartVideo(object sender, EventArgs e) { VideoControl.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\videoplayback.mp4"); while (!VideoControl.IsLoaded && !_videoWindowActive) { Thread.Sleep(5); } VideoControl.Play(); }
private void SendControl(VideoControl controlData) { var payload = new Streamer((uint)VideoPayloadType.Control) { Data = controlData }; SendStreamerOnControlSocket(payload); }
private void VideoControl_MediaEnded(object sender, RoutedEventArgs e) { if (currentScreenContent == ContentType.Video && loopVideo && (!String.IsNullOrEmpty(currentVideoURI))) { //Replay the video VideoControl.Source = new Uri(currentVideoURI); VideoControl.Play(); } }
private void BtPlayClick(object sender, RoutedEventArgs e) { // VideoControl.Source = newUri(MediaPathTextBox.Text); VideoControl.Visibility = Visibility.Visible; VideoControl.Play(); }
public void ReportLostFrames(uint firstFrame, uint lastFrame) { var controlData = new VideoControl( flags: VideoControlFlags.RequestKeyframe | VideoControlFlags.LostFrames, firstLostFrame: firstFrame, lastLostFrame: lastFrame ); SendControl(controlData); }
public VideoIntroScreen() { InitializeComponent(); ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(startupPath + "/images/SkipButton.png", UriKind.Absolute)); skipBtn.Background = ib; VideoControl.Source = new Uri(startupPath + "/images/SpaceBallsIntro.wmv", UriKind.Absolute); VideoControl.Play(); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { frameThread.Start(); dbThread.Start(); VideoControl.Play(); //framer.RunWorkerAsync(); //saver.RunWorkerAsync(); }
private void VideoControl_PanelVisible(object sender, RoutedEventArgs e) { VideoControl vc = e.OriginalSource as VideoControl; if (string.IsNullOrWhiteSpace(vc.ViewModel.VideoId) && !vc.ViewModel.IsFullScreen) { ClearVideoPanel(); } e.Handled = true; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var viewModel = this.DataContext as GymTrainerViewModel; viewModel.TurnOnMedia += StartMedia; VideoControl.ScrubbingEnabled = true; VideoControl.Play(); VideoControl.Pause(); }
private void StopMedia() { var viewModel = this.DataContext as GymTrainerViewModel; VideoControl.Stop(); MediaStartBtn.Content = "Start"; MediaPauseBtn.Content = "Pause"; viewModel.CurrentReps = 0; viewModel.SystemMode = "Free"; }
public async Task ReportLostFramesAsync(uint firstFrame, uint lastFrame) { var controlData = new VideoControl( flags: VideoControlFlags.RequestKeyframe | VideoControlFlags.LostFrames, firstLostFrame: firstFrame, lastLostFrame: lastFrame ); await SendAsync(controlData); }
private void btnPlay_Click(object sender, RoutedEventArgs e) { if (txtMediaPathTextBox.Text.Length <= 0) { MessageBox.Show("Enter a valid media file"); } VideoControl.Source = new System.Uri(txtMediaPathTextBox.Text); VideoControl.Play(); }
public override bool OpenSound(VideoControl vc) { ControlInfo_Preview info = this.m_ControlTable[vc] as ControlInfo_Preview; if (info == null) { return(false); } return(Hik_Open8200API.Std_OpenSound((int)info.PlayHandle) >= 0 ? true : false); }
//public override void OnApplyTemplate() //{ // //m_rootElement = GetTemplateChild("RootElement") as Panel; //} protected override void init() { MediaData.MediaItem m = MediaCollect.MediaItems[0]; switch (m.ItemType) { case MultiMediaPlayer.MediaData.MediaType.Video: VideoControl v = new VideoControl(); v.SetData(m); m_rootElement.Children.Add(v); break; } }