diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index c0dd4e1..369842c 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -148,6 +148,9 @@
VideoList.xaml
+
+ VideoPlayer.xaml
+
@@ -284,6 +287,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/FoxTube/MainPage.xaml.cs b/FoxTube/MainPage.xaml.cs
index 86d9b16..fe3eab4 100644
--- a/FoxTube/MainPage.xaml.cs
+++ b/FoxTube/MainPage.xaml.cs
@@ -55,6 +55,7 @@ namespace FoxTube
settings.Values.Add("moblieWarning", false);
settings.Values.Add("videoAutoplay", true);
+ settings.Values.Add("volume", 100);
}
content.Navigate(typeof(Home));
}
@@ -350,7 +351,7 @@ namespace FoxTube
async void buildSearchSuggestionsTree(string keyword)
{
-
+
}
private void searchField_LostFocus(object sender, RoutedEventArgs e)
@@ -360,7 +361,8 @@ namespace FoxTube
private void searchButton_Click(object sender, RoutedEventArgs e)
{
- StartSearch(searchField.Text);
+ if(searchField.Text != "")
+ StartSearch(searchField.Text);
}
private async void StartSearch(string keyword)
@@ -369,7 +371,7 @@ namespace FoxTube
YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
{
- ApiKey = "INSERT_API_HERE",
+ ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
ApplicationName = this.GetType().ToString()
});
@@ -390,7 +392,7 @@ namespace FoxTube
private void searchField_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
- StartSearch(searchField.Text);
+ searchButton_Click(this, null);
}
}
}
diff --git a/FoxTube/Video.xaml b/FoxTube/Video.xaml
index ccc28e2..3ecf5c6 100644
--- a/FoxTube/Video.xaml
+++ b/FoxTube/Video.xaml
@@ -13,7 +13,8 @@
-
+
+
diff --git a/FoxTube/VideoPlayer.xaml b/FoxTube/VideoPlayer.xaml
new file mode 100644
index 0000000..b38e867
--- /dev/null
+++ b/FoxTube/VideoPlayer.xaml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/VideoPlayer.xaml.cs b/FoxTube/VideoPlayer.xaml.cs
new file mode 100644
index 0000000..d55f9e3
--- /dev/null
+++ b/FoxTube/VideoPlayer.xaml.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Timers;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.Storage;
+using Windows.UI.Core;
+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 User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
+
+namespace FoxTube
+{
+ public sealed partial class VideoPlayer : UserControl
+ {
+ ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
+ Timer t = new Timer();
+
+ public VideoPlayer()
+ {
+ this.InitializeComponent();
+ volume.Value = (double)settings.Values["volume"];
+ t.Elapsed += T_Elapsed;
+ UserControl_Tapped(this, null);
+ }
+
+ private async void T_Elapsed(object sender, ElapsedEventArgs e)
+ {
+ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Elapsed);
+ }
+
+ void Elapsed()
+ {
+ volumePane.IsOpen = false;
+ qualityPane.IsOpen = false;
+ controls.Visibility = Visibility.Collapsed;
+ t.Stop();
+ }
+
+ private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ Height = e.NewSize.Width / 16 * 9;
+ }
+
+ private void openVolume_Click(object sender, RoutedEventArgs e)
+ {
+ volumePane.IsOpen = true;
+ }
+
+ private void volume_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
+ {
+ double v = volume.Value;
+ if (v == 0)
+ muteBtn.Content = openVolume.Content = "";
+ else if (v <= 25 && v > 0)
+ muteBtn.Content = openVolume.Content = "";
+ else if (v <= 50 && v > 25)
+ muteBtn.Content = openVolume.Content = "";
+ else if (v <= 75 && v > 50)
+ muteBtn.Content = openVolume.Content = "";
+ else if (v > 75)
+ muteBtn.Content = openVolume.Content = "";
+
+ settings.Values["volume"] = volume.Value;
+ }
+
+ private void openSets_Click(object sender, RoutedEventArgs e)
+ {
+ qualityPane.IsOpen = true;
+ }
+
+ private void openSubs_Click(object sender, RoutedEventArgs e)
+ {
+ subsPane.IsOpen = true;
+ subsSwitch.IsOn = !subsSwitch.IsOn;
+ }
+
+ private void muteBtn_Click(object sender, RoutedEventArgs e)
+ {
+ if(volume.Value != 0)
+ {
+ double v = (double)settings.Values["volume"];
+ volume.Value = 0;
+ settings.Values["volume"] = v;
+ }
+ else volume.Value = (double)settings.Values["volume"];
+ }
+
+ private void UserControl_Tapped(object sender, TappedRoutedEventArgs e)
+ {
+ controls.Visibility = Visibility.Visible;
+ t.Interval = 5000;
+ t.Stop();
+ t.Start();
+ }
+
+ private void UserControl_PointerMoved(object sender, PointerRoutedEventArgs e)
+ {
+ controls.Visibility = Visibility.Visible;
+ t.Interval = 3000;
+ t.Stop();
+ t.Start();
+ }
+ }
+}