Ejemplo n.º 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                if ((bool)e.Parameter)
                {
                    epg = epgUniverSmotri;
                    string qualityStream = "";
                    if (Settings.Settings.QualityStreamVideo != null)
                    {
                        switch (Settings.Settings.QualityStreamVideo)
                        {
                        case "Низкое": qualityStream = univerSmotriUrl_Low; break;

                        case "Среднее": qualityStream = univerSmotriUrl_Medium; break;

                        case "Высокое": qualityStream = univerSmotriUrl_High; break;
                        }
                    }
                    else
                    {
                        qualityStream = univerSmotriUrl_Low;
                    }
                    tvUrl = qualityStream;
                }
                else
                {
                    epg   = epgKFU;
                    tvUrl = kfuTvUrl;
                }
                DisplayInformation.DisplayContentsInvalidated += DisplayInformation_DisplayContentsInvalidated;
                vm             = new TV_ViewModel(epg);
                mPlayer.Source = new Uri(tvUrl);
                DataContext    = vm;
            }
            else
            {
                Frame.GoBack();
            }
        }
Ejemplo n.º 2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            SystemNavigationManager.GetForCurrentView().BackRequested += TVPage_BackRequested;
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped;
            string header         = "";
            bool   internetAccess = NetworkInterface.GetIsNetworkAvailable();

            if (e.Parameter != null && internetAccess)
            {
                if ((bool)e.Parameter)
                {
                    epg = epgUniverSmotri;
                    string qualityStream = "";
                    header = "UNIVERSMOTRI";
                    if (Settings.Settings.QualityStreamVideo != null)
                    {
                        switch (Settings.Settings.QualityStreamVideo)
                        {
                        case "Низкое": qualityStream = univerSmotriUrl_Low; break;

                        case "Среднее": qualityStream = univerSmotriUrl_Medium; break;

                        case "Высокое": qualityStream = univerSmotriUrl_High; break;
                        }
                    }
                    else
                    {
                        qualityStream = univerSmotriUrl_Low;
                    }
                    tvUrl = qualityStream;
                }
                else
                {
                    header = "Телеканал КФУ";
                    epg    = epgKFU;
                    tvUrl  = kfuTvUrl;
                }
                DisplayInformation.GetForCurrentView().OrientationChanged += TVPage_OrientationChanged;
                vm          = new TV_ViewModel(epg);
                vm.HeaderTV = header;
                var streamResponse = await AdaptiveMediaSource.CreateFromUriAsync(new Uri(tvUrl));

                if (streamResponse.Status == AdaptiveMediaSourceCreationStatus.Success)
                {
                    mPlayer.MediaPlayer.SetMediaSource(streamResponse.MediaSource); //mPlayer.Source = new Uri(tvUrl);
                }
                else
                {
                    var dialog = new MessageDialog("Не удалось загрузить видео.\nПроверьте соединение с интернетом.");
                    await dialog.ShowAsync();

                    Frame.GoBack();
                }
                DataContext = vm;
            }
            else
            {
                var dialog = new MessageDialog("Не удалось загрузить видео.\nПроверьте соединение с интернетом.");
                await dialog.ShowAsync();

                Frame.GoBack();
            }
        }