Exemple #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                NavigationHelper.OnNavigatedTo(this);

                SubscribeModelEvents();
                _sensor.OrientationChanged += Sensor_OrientationChanged;

                if (VideoPageViewHelper.IsLandscapeOrientation(Orientation))
                {
                    SetVisibilityControls(Visibility.Collapsed);
                }
                else
                {
                    SetVisibilityControls(Visibility.Visible);
                }

                var viewModel = DataContext as PlaylistVideoPageViewModel;
                if (viewModel == null)
                {
                    return;
                }

                if (viewModel.NavigationPanelViewModel == null)
                {
                    return;
                }

                var binding = new Binding {
                    Source = viewModel, Path = new PropertyPath("VideoViewModel.VideoUri")
                };
                player.SetBinding(LiteTubePlayer.SourceProperty, binding);

                if (e.NavigationMode == NavigationMode.Back && viewModel.VideoViewModel.IsLive)
                {
                    player = null;
                    RestorePlayer();
                    player?.Load();
                }

                if (!viewModel.NavigationPanelViewModel.IsAuthorized)
                {
                    return;
                }

                if (_currentApplicationBar.Buttons.Contains(_favoritesApplicationBarButton))
                {
                    return;
                }
                _currentApplicationBar.Buttons.Add(_favoritesApplicationBarButton);
            }
            catch (Exception)
            {
                ;
            }
        }
Exemple #2
0
        private void ChangeOrientation(PageOrientation orientation)
        {
            if (VideoPageViewHelper.IsLandscapeOrientation(orientation))
            {
                SetPlayerFullScreenState();
                SetVisibilityControls(Visibility.Collapsed);
                return;
            }

            SetPlayerNormalState();
            SetVisibilityControls(Visibility.Visible);
        }