Added System Media Transport Controls and continuing developing video page
This commit is contained in:
+2
-1
@@ -13,7 +13,8 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer>
|
||||
<StackPanel Orientation="Vertical" Name="mainContent">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Name="mainContent"/>
|
||||
<!--<local:VideoPlayer Name="player"/>-->
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock Name="title" Text="Video title this is very biiiiig title. It's amazingly big. OLOLOLOLOLO!!!!!!)))))). 1234567890. ABCD" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
||||
|
||||
@@ -16,6 +16,7 @@ using Windows.UI.Xaml.Navigation;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using System.Diagnostics;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
@@ -47,7 +48,8 @@ namespace FoxTube
|
||||
views.Text = item.Statistics.ViewCount + " views";
|
||||
dislikes.Text = item.Statistics.DislikeCount.ToString();
|
||||
likes.Text = item.Statistics.LikeCount.ToString();
|
||||
dislikeLine.X2 = (int)(item.Statistics.DislikeCount / (item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250);
|
||||
Debug.WriteLine((double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250);
|
||||
dislikeLine.X2 = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250;
|
||||
description.Text = item.Snippet.Description;
|
||||
|
||||
ChannelsResource.ListRequest request1 = SecretsVault.YoutubeService.Channels.List("snippet,contentDetails,statistics");
|
||||
@@ -60,13 +62,12 @@ namespace FoxTube
|
||||
channelName.Text = item.Snippet.ChannelTitle;
|
||||
subscribers.Text = item1.Statistics.SubscriberCount + " subscribers";
|
||||
|
||||
mainContent.Children.Add(new VideoPlayer(id));
|
||||
mainContent.Children.Reverse();
|
||||
mainContent.Children.Add(new VideoPlayer(id, item1.Snippet.Thumbnails.Medium.Url));
|
||||
}
|
||||
|
||||
private void gotoChannel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(Window.Current.Content as MainPage).GoToChannel(item.Snippet.ChannelId);
|
||||
((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<ComboBoxItem Content="480p"/>
|
||||
<ComboBoxItem Content="360p"/>
|
||||
<ComboBoxItem Content="240p"/>
|
||||
<ComboBoxItem Content="144p"/>
|
||||
<ComboBoxItem Content="144p" Visibility="Collapsed"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Popup>
|
||||
@@ -123,7 +123,7 @@
|
||||
<TextBlock Text="You are on a metered connection now. Additional charges may apply." FontSize="22" Foreground="White"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Content="Add to 'Watch later' playlist and go back" Margin="10" Background="Red" Foreground="White"/>
|
||||
<Button Content="Continue" Margin="10"/>
|
||||
<Button Name="meteredDismiss" Click="meteredDismiss_Click" Content="Continue" Margin="10"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -21,6 +21,10 @@ using Google.Apis.YouTube.v3.Data;
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using MyToolkit.Multimedia;
|
||||
using Windows.Networking.Connectivity;
|
||||
using System.Diagnostics;
|
||||
using Windows.Media;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
@@ -39,20 +43,25 @@ namespace FoxTube
|
||||
Enabled = true
|
||||
};
|
||||
|
||||
public VideoPlayer(string id)
|
||||
public VideoPlayer(string id, string channelAvatar)
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
volume.Value = Convert.ToDouble(settings.Values["volume"]);
|
||||
videoSource.AutoPlay = (bool)settings.Values["videoAutoplay"];
|
||||
|
||||
var connection = NetworkInformation.GetInternetConnectionProfile().GetConnectionCost();
|
||||
if ((bool)settings.Values["moblieWarning"] && (connection.NetworkCostType == NetworkCostType.Fixed || connection.NetworkCostType == NetworkCostType.Variable))
|
||||
meteredNotification.Visibility = Visibility.Visible;
|
||||
|
||||
quality.SelectedIndex = (int)settings.Values["quality"] +
|
||||
(int)settings.Values["quality"] > 0? 1 : 0;
|
||||
|
||||
t.Elapsed += T_Elapsed;
|
||||
Initialize(id);
|
||||
Initialize(id, channelAvatar);
|
||||
}
|
||||
|
||||
public async void Initialize(string id)
|
||||
public async void Initialize(string id, string channelAvatar)
|
||||
{
|
||||
videoId = id;
|
||||
VideosResource.ListRequest request = SecretsVault.YoutubeService.Videos.List("snippet,contentDetails,statistics");
|
||||
@@ -63,9 +72,21 @@ namespace FoxTube
|
||||
var item = response.Items[0];
|
||||
|
||||
videoSource.PosterSource = new BitmapImage(new Uri(item.Snippet.Thumbnails.Maxres.Url));
|
||||
title.Text = item.Snippet.Title;
|
||||
|
||||
YouTubeUri url = await YouTube.GetVideoUriAsync(item.Id, videoQuality);
|
||||
videoSource.Source = url.Uri;
|
||||
|
||||
SystemMediaTransportControls controls = SystemMediaTransportControls.GetForCurrentView();
|
||||
controls.IsNextEnabled = true;
|
||||
controls.IsPauseEnabled = true;
|
||||
controls.IsPlayEnabled = true;
|
||||
|
||||
controls.DisplayUpdater.Type = MediaPlaybackType.Video;
|
||||
controls.DisplayUpdater.VideoProperties.Title = item.Snippet.Title;
|
||||
controls.DisplayUpdater.VideoProperties.Subtitle = item.Snippet.ChannelTitle;
|
||||
controls.DisplayUpdater.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri(channelAvatar));
|
||||
controls.DisplayUpdater.Update();
|
||||
}
|
||||
|
||||
private async void T_Elapsed(object sender, ElapsedEventArgs e)
|
||||
@@ -162,6 +183,7 @@ namespace FoxTube
|
||||
|
||||
private async void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Selected index: " + quality.SelectedIndex);
|
||||
switch(quality.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
@@ -253,5 +275,10 @@ namespace FoxTube
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void meteredDismiss_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
meteredNotification.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user