private void InitVideoRenderingMethod() { _videoElement?.UnsubscribeEvents(); switch (_optionsService.RenderingMethod) { case RenderingMethod.Ffmpeg: _videoElement = new MediaElementUnoSquare(VideoElementFfmpeg); break; case RenderingMethod.MediaFoundation: _videoElement = new MediaElementMediaFoundation(VideoElementMediaFoundation, _optionsService); break; default: throw new NotImplementedException(); } _currentRenderingMethod = _optionsService.RenderingMethod; if (_videoDisplayManager != null) { UnsubscribeVideoEvents(); _videoDisplayManager.Dispose(); } _videoDisplayManager = new VideoDisplayManager(_videoElement, SubtitleBlock, _optionsService); SubscribeVideoEvents(); }
public MediaWindow(IOptionsService optionsService, ISnackbarService snackbarService) { InitializeComponent(); _optionsService = optionsService; _imageDisplayManager = new ImageDisplayManager(Image1Element, Image2Element, _optionsService); _snackbarService = snackbarService; _videoDisplayManager = new VideoDisplayManager(new MediaElementUnoSquare(VideoElement)); SubscribeEvents(); }
public MediaWindow(IOptionsService optionsService, ISnackbarService snackbarService) { InitializeComponent(); _optionsService = optionsService; _optionsService.ShowSubtitlesChangedEvent += HandleShowSubtitlesChangedEvent; _imageDisplayManager = new ImageDisplayManager(Image1Element, Image2Element, _optionsService); _imageDisplayManager.MediaChangeEvent += HandleMediaChangeEventForImages; _snackbarService = snackbarService; _videoDisplayManager = new VideoDisplayManager(VideoElement); _videoDisplayManager.MediaChangeEvent += HandleMediaChangeEventForVideoAndAudio; _videoDisplayManager.MediaPositionChangedEvent += HandleMediaPositionChangedEvent; }