private async Task PlayStream()
        {
            try
            {
                qualities = await HelperMethods.RetrieveHlsStream(stream.channel.name);
            }
            catch
            {
                streamOfflineTextBlock.Visibility = Visibility.Visible;
                playPauseButton.IsEnabled         = false;
            }
            streamElement.Source = await HelperMethods.GetPreferredQuality(qualities);

            streamElement.Play();
            playPauseButton.IsEnabled = true;
        }
Example #2
0
        private async void gameStreamsGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            GameStreamsGridViewBinding streamItem = e.ClickedItem as GameStreamsGridViewBinding;
            List <object> parameters = new List <object>();

            parameters.Add(streamItem.stream);
            Dictionary <AppConstants.StreamQuality, Uri> qualities = null;

            try
            {
                qualities = await HelperMethods.RetrieveHlsStream(streamItem.stream.channel.name);
            }
            catch (Exception ex)
            {
                await HelperMethods.ShowMessageDialog(string.Format("Looks like {0} is offline. Sorry about that.", streamItem.stream.channel.displayName), string.Format("{0} is offline", streamItem.stream.channel.displayName));
            }
            parameters.Add(qualities);
            Frame.Navigate(typeof(StreamPage), parameters);
        }
Example #3
0
 async Task PlayStream()
 {
     try
     {
         qualities = await HelperMethods.RetrieveHlsStream(user.name);
     }
     catch (Exception ex)
     {
         qualities = null;
         streamOfflineTextBlock.Visibility         = Visibility.Visible;
         ((SymbolIcon)playPauseButton.Icon).Symbol = Symbol.Play;
         playPauseButton.IsEnabled = false;
         //await HelperMethods.ShowMessageDialog("Looks like you're not streaming currently.", "Stream offline");
     }
     if (qualities != null)
     {
         streamPlayer.Source = qualities[AppConstants.StreamQuality.Chunked];
         ((SymbolIcon)playPauseButton.Icon).Symbol = Symbol.Stop;
         videoPlaying = true;
     }
 }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (Frame.BackStack.Count > 0)
            {
                if (Frame.BackStack[Frame.BackStack.Count - 1].SourcePageType == typeof(LoadingPage) ||
                    Frame.BackStack[Frame.BackStack.Count - 1].SourcePageType == typeof(FinalConfirmation))
                {
                    HelperMethods.DisableBackButton();
                }
            }

            progressRing.IsActive = true;

            try
            {
                streams = await AppConstants.Twixel.RetrieveFeaturedStreams(0, 10);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }
            foreach (FeaturedStream stream in streams)
            {
                stream.CleanTextString();
                stream.text = stream.text.Replace('\n', ' ').Trim();
                Dictionary <AppConstants.StreamQuality, Uri> q = null;
                try
                {
                    q = await HelperMethods.RetrieveHlsStream(stream.stream.channel.name);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
                if (q != null)
                {
                    qualities.Add(q);
                }
                else
                {
                    qualities.Add(q);
                }
            }

            if (streams.Count > 0)
            {
                SetUpFeaturedStream();
                streamButton.IsEnabled = true;
                playButton.IsEnabled   = true;
                nextButton.IsEnabled   = true;
            }

            Total <List <Game> > topGames = null;

            try
            {
                topGames = await AppConstants.Twixel.RetrieveTopGames(0, 10);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }
            if (topGames != null)
            {
                foreach (Game game in topGames.wrapped)
                {
                    topGamesCollection.Add(new GameGridViewBinding(game));
                }
            }
            progressRing.IsActive = false;
            base.OnNavigatedTo(e);
        }