Video playback fixes
Merged to YouTubeExplode instead of MyToolkit
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
xmlns:local="using:FoxTube.Pages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:FoxTube.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
@@ -27,7 +28,9 @@
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<StackPanel Margin="5" Name="stack"/>
|
||||
<StackPanel Margin="5" Name="stack">
|
||||
<ListView ItemsSource="{Binding Path=Methods.MainPage.agent.items}" SelectionMode="None"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -11,11 +11,6 @@ using Windows.Storage.Pickers;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
|
||||
@@ -28,33 +23,20 @@ namespace FoxTube.Pages
|
||||
public sealed partial class Downloads : Page
|
||||
{
|
||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
DownloadAgent agent = Methods.MainPage.Agent;
|
||||
public Downloads()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
path.Text = settings.Values["defaultDownload"] as string;
|
||||
|
||||
agent.ListChanged += UpdateList;
|
||||
|
||||
foreach (DownloadItem item in agent.Items)
|
||||
stack.Children.Add(item);
|
||||
}
|
||||
|
||||
private void UpdateList(object sender, params object[] e)
|
||||
{
|
||||
if (e[0] == "remove")
|
||||
stack.Children.Remove(sender as DownloadItem);
|
||||
else if (e[0] == "add")
|
||||
stack.Children.Add(sender as DownloadItem);
|
||||
}
|
||||
|
||||
private async void changePath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FolderPicker picker = new FolderPicker()
|
||||
{
|
||||
SuggestedStartLocation = PickerLocationId.Desktop,
|
||||
SuggestedStartLocation = PickerLocationId.Downloads,
|
||||
ViewMode = PickerViewMode.Thumbnail
|
||||
};
|
||||
picker.FileTypeFilter.Add(".shit"); //Because overwise it trhows an exception
|
||||
|
||||
StorageFolder p = await picker.PickSingleFolderAsync();
|
||||
if (p != null)
|
||||
@@ -64,7 +46,7 @@ namespace FoxTube.Pages
|
||||
|
||||
private async void openFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri(settings.Values["defaultDownload"] as string));
|
||||
await Launcher.LaunchFolderAsync( await StorageFolder.GetFolderFromPathAsync(settings.Values["defaultDownload"] as string));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.Net;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.Networking.Connectivity;
|
||||
using Windows.UI.Core;
|
||||
using Syroot.Windows.IO;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
|
||||
@@ -48,7 +49,9 @@ namespace FoxTube
|
||||
this.InitializeComponent();
|
||||
|
||||
if (settings.Values["quality"] == null)
|
||||
settings.Values.Add("quality", 1);
|
||||
settings.Values.Add("quality", "remember");
|
||||
if (settings.Values["rememberedQuality"] == null)
|
||||
settings.Values.Add("rememberedQuality", "1080p");
|
||||
|
||||
if (settings.Values["newVideoNotification"] == null)
|
||||
settings.Values.Add("newVideoNotification", true);
|
||||
@@ -70,7 +73,7 @@ namespace FoxTube
|
||||
settings.Values.Add("safeSearch", 0);
|
||||
|
||||
if (settings.Values["defaultDownload"] == null)
|
||||
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
|
||||
settings.Values.Add("defaultDownload", Syroot.Windows.IO.KnownFolders.Downloads.Path + "\\DownloadedVideos");
|
||||
|
||||
if (settings.Values["notificationsHistory"] == null)
|
||||
{
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
|
||||
<TextBlock x:Uid="/General/playback" Text="Playback" FontSize="22"/>
|
||||
<ComboBox x:Uid="/General/quality" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
|
||||
<ComboBoxItem x:Uid="/General/remember" Content="Remember my choice"/>
|
||||
<ComboBoxItem Content="2160p"/>
|
||||
<ComboBoxItem Content="1080p"/>
|
||||
<ComboBoxItem Content="720p"/>
|
||||
<ComboBoxItem Content="480p"/>
|
||||
<ComboBoxItem Content="360p"/>
|
||||
<ComboBoxItem Content="240p"/>
|
||||
<ComboBoxItem Content="144p"/>
|
||||
<ComboBoxItem Tag="remember" x:Uid="/General/remember" Content="Remember my choice"/>
|
||||
<ComboBoxItem Tag="2160p" Content="2160p"/>
|
||||
<ComboBoxItem Tag="1080p" Content="1080p"/>
|
||||
<ComboBoxItem Tag="720p" Content="720p"/>
|
||||
<ComboBoxItem Tag="480p" Content="480p"/>
|
||||
<ComboBoxItem Tag="360p" Content="360p"/>
|
||||
<ComboBoxItem Tag="240p" Content="240p"/>
|
||||
<ComboBoxItem Tag="144p" Content="144p"/>
|
||||
</ComboBox>
|
||||
<ToggleSwitch x:Uid="/General/metered" OnContent="Notify when playing on metered connection" OffContent="Notify when playing on metered connection" Name="mobileWarning" Toggled="mobileWarning_Toggled"/>
|
||||
<ToggleSwitch x:Uid="/General/autoplay" OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Toggled="autoplay_Toggled"/>
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace FoxTube.Pages.SettingsPages
|
||||
|
||||
private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
settings.Values["quality"] = quality.SelectedIndex;
|
||||
settings.Values["quality"] = (quality.SelectedItem as ComboBoxItem).Tag as string;
|
||||
}
|
||||
|
||||
private void mobileWarning_Toggled(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -1,36 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Windows.System;
|
||||
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using System.Diagnostics;
|
||||
using System.Timers;
|
||||
using Windows.UI.Core;
|
||||
using System.Threading;
|
||||
using Windows.ApplicationModel.DataTransfer;
|
||||
using Windows.Storage;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Text;
|
||||
using Windows.UI;
|
||||
using FoxTube.Pages;
|
||||
|
||||
using MyToolkit.Multimedia;
|
||||
using FoxTube.Controls;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
@@ -250,7 +235,7 @@ namespace FoxTube.Pages
|
||||
|
||||
async void LoadDownloads()
|
||||
{
|
||||
List<YouTubeUri> uris = (await YouTube.GetUrisAsync(item.Id)).ToList();
|
||||
/*List<YouTubeUri> uris = (await YouTube.GetUrisAsync(item.Id)).ToList();
|
||||
if (uris.Count > 0)
|
||||
foreach (YouTubeUri u in uris)
|
||||
{
|
||||
@@ -276,12 +261,12 @@ namespace FoxTube.Pages
|
||||
}
|
||||
}
|
||||
else
|
||||
download.Visibility = Visibility.Collapsed;
|
||||
download.Visibility = Visibility.Collapsed;*/
|
||||
}
|
||||
|
||||
private void downloadItemSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Methods.MainPage.Agent.Add(videoId, (sender as MenuFlyoutItem).Tag.ToString());
|
||||
Methods.MainPage.Agent.Add((sender as MenuFlyoutItem).Tag.ToString());
|
||||
}
|
||||
|
||||
async void LoadRelatedVideos()
|
||||
|
||||
Reference in New Issue
Block a user