private void LstVidos_OnItemClick(VideoItem obj) { lstPlayListVidos?.ClearSelection(); Task.Run(() => { var item = obj.SelectedItem; if (!item.IsVideo) { _video = item; LoadData(); Device.BeginInvokeOnMainThread(async() => { lstVidos?.ClearSelection(); if (PageO != PageOrientation.Horizontal) { expandableViewPlayList.IsExpanded = expandableViewPlayList.IsVisible = true; } }); } else { _video = item; LoadData(); } Play(); }); }
public Video(VideoWrapper video, List <VideoWrapper> allCollection) { InitializeComponent(); _video = video; searchedVideos = allCollection; screanHeight = Height; yVideo.OnFullScrean = b => { expandableView.IsVisible = !b && PageO != PageOrientation.Horizontal; expandableViewPlayList.IsVisible = _video.HasVideos && !b && PageO != PageOrientation.Horizontal; }; yVideo.OnVideoStarted = v => { if (_video.HasVideos && lstPlayListVidos != null && (lstPlayListVidos.SelectedItem != null || lstVidos?.SelectedItem == null)) { lstPlayListVidos.SelectedItem = _video; } else if (lstVidos != null) { lstVidos.SelectedItem = _video; } }; yVideo.OnError = (e) => { //Methods.Logger() }; // play next and ignore the error yVideo.OnVideoEnded = VideoEnded; yVideo.OnNext = VideoEnded; yVideo.OnPrev = () => { AutoPlay(false); }; this.AddTrigger(ControllerRepository.GetInfo <IDbController, Task>(x => x.SaveCategory(null)), ControllerRepository.GetInfo <IDbController, Task>(x => x.SaveVideo(null))); }
public Video LoadData() { if (!_video.IsVideo) { var title = _video.Title; _video.LoadVideos(); if (!_video.Videos.Any()) { return(this); } var v = _video.Videos.FirstOrDefault(x => x.IsVideo); v.Videos = _video.Videos; _video = v; PlayListTitle = title; LoadlstPlayListVideos(); } else { var index = searchedVideos.FindIndex(x => x.Id == _video.Id); searchedVideos = ControllerRepository.Y(x => x.SearchAsync(UserData.CurrentUser.EntityId.Value, "", 30, 1, _video.Title, VideoSearchType.Mix)).Await().ToItemList(); // get relevant Videos searchedVideos.RemoveAll(x => x.Id == _video.Id); searchedVideos.Insert(0, _video); LoadlstVideos(); } return(this); }
private void Play(VideoWrapper video) { if (video == null) { return; } new Video(video, _videos.ToItemList()).LoadData().Open(); }
public VideosProperties(VideoWrapper video, long categoryId) { InitializeComponent(); _categoryId = categoryId; lstVideosProperties.Category_Id = categoryId; _requastedItem = video; this.AddTrigger( ControllerRepository.GetInfo <IDbController, Task>(x => x.SaveCategory(null)), ControllerRepository.GetInfo <IDbController, Task>(x => x.SaveVideo(null))); }
/// <summary> /// Prepare a downloadable object /// </summary> /// <param name="yubeItem"></param> /// <param name="videoCategory"></param> /// <returns></returns> public static YFileDownloadItem GetDownloadableItem(this VideoWrapper yubeItem, VideoCategory videoCategory) { var v = new YFileDownloadItem(); v.Playlist = videoCategory.Name; v.VideoId = yubeItem.Id; v.Title = yubeItem.Title; v.category_Id = videoCategory.EntityId; v.ThumpUrl = yubeItem.DefaultThumbnailUrl; return(v); }
private void PlayListSuggesting_SelectedItemChanged(object sender, EventArgs e) { var category = playListSuggesting.SelectedItem as VideoCategoryView; var videos = ControllerRepository.Db(x => x.GetVideoData(null, category.EntityId, null, 1)).Await(); var videoWrappers = videos?.Select(x => new VideoWrapper(x)).ToList(); var playList = new VideoWrapper() { Title = videoWrappers.First().Title, Videos = videoWrappers, IsVideo = false, IsPlaylist = true }; new Video(playList, videoWrappers).LoadData().Open(); playListSuggesting.SelectedItem = null; }
// Start is called before the first frame update void Start() { m_CameraRig = FindObjectOfType<OVRCameraRig>(); m_InputModule = FindObjectOfType<UnityEngine.EventSystems.OVRInputModule>(); // videoWrapper = new VideoPlayerWrapper(videoPlayer); videoWrapper = new MediaPlayerWrapper(mediaPlayer, applyToMaterial); SetActiveController(OVRInput.Controller.LTouch); updateProjectionTypeUI = AddToggleGroup<ProjectionType>(viewSettingsGameObject, "Projection", viewSettings.SetProjectionType); updateFieldOfViewUI = AddToggleGroup<FieldOfView>(viewSettingsGameObject, "Field of View", viewSettings.SetFieldOfView); updateLayoutUI = AddToggleGroup<Layout>(viewSettingsGameObject, "Layout", viewSettings.SetLayout); updateFlipYUI = AddCheckbox(viewSettingsGameObject, "Flip Y", viewSettings.SetFlipY); updateScaleUI = AddSlider(viewSettingsGameObject, "Scale", viewSettings.SetScale, 0.25f, 2.0f); viewSettingsGameObject.SetActive(false); UpdateViewSettings(false); }
protected void AutoPlay(bool playNext = true) { Task.Run(() => { var i = playNext ? 1 : -1; if (!_video.HasVideos) { var index = searchedVideos.FindIndex(x => x.Id == _video.Id); if (index + i < 0 || searchedVideos.Count() <= index + i) { index = 0; } else { index += i; } var item = searchedVideos[index]; _video = item; if (!_video.IsVideo) { LoadData(); } } else { var index = _video.LoadVideos().Videos.FindIndex(x => x.Id == _video.Id); if (index + i < 0 || _video.Videos.Count() <= index + i) { index = 0; } else { index += i; } var item = _video.Videos[index]; item.Videos = _video.Videos; _video = item; if (!item.IsVideo) { LoadData(); } } Play(); }); }
private void lstPlaylistvideos_OnItemClick(VideoItem obj) { lstVidos?.ClearSelection(); Task.Run(() => { var item = obj.SelectedItem; if (!item.IsVideo) { _video = item; LoadData(); } else { item.Videos = _video.Videos; _video = item; LoadData(); } Play(); }); }
public void SetFile(string filepath) { Reset(); if (_wrapper != null) { _wrapper.Dispose(); } _wrapper = new VideoWrapper(); _wrapper.Open(filepath); _buffer = new byte[_wrapper.Width * _wrapper.Height * 3]; _texture = new Texture2D(_wrapper.Width, _wrapper.Height, TextureFormat.RGB24, false); GetComponent <Renderer>().material.mainTexture = _texture; var ri = GetComponent <RawImage>(); if (ri != null) { ri.texture = _texture; } }
private void Startup() { using (new Splash(this)) { AppDataContext = new AppDataContext() { Devices = new ObservableCollection <string>(), StrokeCollection = new System.Windows.Ink.StrokeCollection(), VideoImage = null, VideoSelectedImage = null, ImageDifference = null, FrameRate = 0, ImageChangePercentage = 0.0, Status = string.Empty }; AppDataContext.NotifyIconHandler = new NotifyIconHandler(AppDataContext, Properties.Resources.Icon, Properties.Resources.Icon_Working); AppDataContext.NotifyIconHandler.OnClickEvent += () => { WindowState = System.Windows.WindowState.Maximized; Topmost = true; Show(); Topmost = false; }; (AppDataContext.Controllers = (Controllers = new ControllerInitialiser(AppDataContext))).InitialiseControllers(); _videoHandler = new VideoWrapper(AppDataContext); _videoHandler.TriggerEvent += Video_TriggerEvent; _videoHandler.GetDevices(); _videoHandler.Start(); this.DataContext = AppDataContext; } }
internal void Initialize(VideoWrapper videoWrapper) { m_VideoWrapper = videoWrapper; UpdateControls(); }
internal void OnNewVideoSource(VideoWrapper videWrapper) { m_Bpp = int.Parse(videWrapper.CameraBitDepth); }
internal void CameraConnected(IVideo driverInstance, VideoWrapper videoObject, OverlayManager overlayManager, int maxOcrErrorsPerRun, bool isIntegrating) { this.driverInstance = driverInstance; this.overlayManager = overlayManager; this.VideoObject = videoObject; isIntegratingCamera = isIntegrating; ocrErrors = 0; isUsingManualIntegration = false; providesOcredTimestamps = false; MAX_ORC_ERRORS_PER_RUN = maxOcrErrorsPerRun; driverInstanceSupportedActions = driverInstance.SupportedActions.Cast<string>().ToList(); ocrMayBeRunning = driverInstanceSupportedActions.Contains("DisableOcr"); if (isIntegrating) ChangeState(UndeterminedVtiOsdLocationState.Instance); else if (driverInstance is Drivers.ASCOMVideo.Video) ChangeState(ExternallyManagedCameraState.Instance); else ChangeState(NoIntegrationSupportedCameraState.Instance); }
/// <summary> /// Download the video, also checks for an existing user and playlist /// </summary> /// <param name="page"></param> /// <param name="video"></param> public static async void Download(this ILayout page, VideoWrapper video, PageType pageType = PageType.Popup) { if (UserData.CurrentUser == null) { await Application.Current.MainPage.DisplayAlert(null, "NotLoggedIn".GetString(), "Ok".GetString()); return; // break } if (!UserData.VideoCategoryViews.Any()) { var action = await Application.Current.MainPage.DisplayActionSheet("PCreate".GetString(), null, "Create".GetString()); if (action == "Create".GetString()) { var catId = await UserData.CreateEditPlayList(); if (catId > 0) { if (!video.IsVideo) { var vView = await new VideosProperties(video, catId).DataBind(); vView.Open(); } else { if (UserData.CanDownload(true)) { Methods.AppSettings.DownloadVideo(video.GetDownloadableItem(UserData.VideoCategoryViews.Find(x => x.EntityId == catId))); } } } } } else { if (pageType == PageType.Popup || !video.IsVideo) { var temp = new DataTemplate(() => { var cellView = new ViewCell(); var text = new Label { Style = (Style)Application.Current.Resources["Header"] }; text.SetBinding(Label.TextProperty, "Name"); cellView.View = new StackLayout { Children = { text }, Style = (Style)Application.Current.Resources["FormFloatLeft"] }; return(cellView); }); var lst = new YListView { ItemsSource = UserData.VideoCategoryViews, ItemTemplate = temp }; var btnClose = new CustomButton { Text = "Close".GetString(), Style = (Style)Application.Current.Resources["ButtonContainer"] }; var btnCreate = new CustomButton { Text = "Create".GetString(), Style = (Style)Application.Current.Resources["ButtonContainer"] }; var stk = new StackLayout { Style = (Style)Application.Current.Resources["PopUpCenter"], Children = { new StackLayout { Style = (Style)Application.Current.Resources["FormFloatLeft"], BackgroundColor = (Color)Application.Current.Resources["barBackgroundColor"], Children = { new Label { Text = "PChoose".GetString(), Style = (Style)Application.Current.Resources["HeaderContainer"] } } }, new StackLayout { Children = { lst }, BackgroundColor = (Color)Application.Current.Resources["applicationColor"] }, new StackLayout { Style = (Style)Application.Current.Resources["FormFloatLeft"], BackgroundColor = (Color)Application.Current.Resources["barBackgroundColor"], Children = { btnClose, // Cancel btnCreate // Create new playlist } } } }; var view = new PopupPage { Content = stk }; btnClose.Clicked += async(o, e) => await view.Close(); lst.OnSelected += async(o, l) => { var loader = await page.StartLoading(); var category = o as VideoCategory; // Download the video if (!video.IsVideo) { var vView = await new VideosProperties(video, category.EntityId.Value).DataBind(); vView.Open(); await view.Close(); } else { if (UserData.CanDownload(true)) { Methods.AppSettings.DownloadVideo(video.GetDownloadableItem(category)); } await view.Close(); } loader.EndLoading(); }; btnCreate.Clicked += async(o, e) => { var catId = await UserData.CreateEditPlayList(); if (catId > 0) { if (!video.IsVideo) { var vView = await new VideosProperties(video, catId).DataBind(); vView.Open(); await view.Close(); } else { if (UserData.CanDownload(true)) { Methods.AppSettings.DownloadVideo(video.GetDownloadableItem(UserData.VideoCategoryViews.Find(x => x.EntityId == catId))); } } } }; view.Open(); } else { var buttons = UserData.VideoCategoryViews.Select(x => x.Name).ToList(); buttons.Insert(0, "Create".GetString()); var action = await Application.Current.MainPage.DisplayActionSheet("PChoose".GetString(), "Close".GetString(), null, buttons.ToArray()); if (action == "Create".GetString()) { var catId = await UserData.CreateEditPlayList(); if (catId > 0) { if (UserData.CanDownload(true)) { Methods.AppSettings.DownloadVideo(video.GetDownloadableItem(UserData.VideoCategoryViews.Find(x => x.EntityId == catId))); } } } else { var cat = UserData.VideoCategoryViews.FirstOrDefault(x => x.Name == action); if (cat != null && UserData.CanDownload(true)) { Methods.AppSettings.DownloadVideo(video.GetDownloadableItem(cat)); } } } } }
private void ConnectToDriver(IVideo driverInstance) { try { Cursor = Cursors.WaitCursor; initializationErrorMessages.Clear(); m_PrevStateWasDisconnected = true; videoObject = m_VideoRenderingController.ConnectToDriver(driverInstance); if (videoObject.Connected) { imageWidth = videoObject.Width; imageHeight = videoObject.Height; picVideoFrame.Image = new Bitmap(imageWidth, imageHeight); ResizeVideoFrameTo(imageWidth, imageHeight); tssIntegrationRate.Visible = Settings.Default.IsIntegrating && OccuRecContext.Current.IsAAV; pnlAAV.Visible = OccuRecContext.Current.IsAAV; tsbtnDisplayMode.Visible = true; if (videoObject.SupporstFreeStyleGain) videoObject.SetFreeRangeGainIntervals(0); m_OverlayManager = new OverlayManager(videoObject.Width, videoObject.Height, initializationErrorMessages, m_AnalysisManager, m_StateManager); m_VideoFrameInteractionController.OnNewVideoSource(videoObject); OccuRecContext.Current.IsConnected = true; if (Settings.Default.RecordStatusSectionOnly) MessageBox.Show( this, "The 'Record Status Section Only' flag is currently enabled. No video images will be recorded.", "OccuRec", MessageBoxButtons.OK, MessageBoxIcon.Warning); } m_StateManager.CameraConnected(driverInstance, videoObject, m_OverlayManager, Settings.Default.OcrMaxErrorsPerCameraTestRun, OccuRecContext.Current.IsAAV); UpdateScheduleDisplay(); } finally { Cursor = Cursors.Default; if (videoObject == null || !videoObject.Connected) { foreach (string error in initializationErrorMessages) { MessageBox.Show(this, error, "OccuRec", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } picVideoFrame.Width = videoObject.Width; picVideoFrame.Height = videoObject.Height; UpdateCameraState(true); ucVideoControl.Initialize(videoObject); }
private void DisconnectFromCamera() { if (videoObject != null) { if (videoObject.State == VideoCameraState.videoCameraRecording) videoObject.StopRecording(); videoObject.Disconnect(); videoObject = null; } UpdateCameraState(false); tssIntegrationRate.Visible = false; tsbtnDisplayMode.Visible = false; m_StateManager.CameraDisconnected(); if (m_OverlayManager != null) { m_OverlayManager.Finalise(); m_OverlayManager = null; } if (m_ObservatoryController.IsConnectedToVideoCamera()) m_ObservatoryController.DisconnectVideoCamera(); m_PrevStateWasDisconnected = true; OccuRecContext.Current.IsConnected = false; }
internal VideoWrapper ConnectToDriver(IVideo driverInstance) { videoObject = new VideoWrapper(driverInstance, m_MainForm); videoObject.Connected = true; if (videoObject.Connected) { imageWidth = videoObject.Width; imageHeight = videoObject.Height; } return videoObject; }