diff --git a/FoxTube/Assets/LargeTile.scale-100.png b/FoxTube/Assets/LargeTile.scale-100.png index b338fa5..b8ebe3f 100644 Binary files a/FoxTube/Assets/LargeTile.scale-100.png and b/FoxTube/Assets/LargeTile.scale-100.png differ diff --git a/FoxTube/Assets/LargeTile.scale-125.png b/FoxTube/Assets/LargeTile.scale-125.png index 9f13122..9c83d55 100644 Binary files a/FoxTube/Assets/LargeTile.scale-125.png and b/FoxTube/Assets/LargeTile.scale-125.png differ diff --git a/FoxTube/Assets/LargeTile.scale-150.png b/FoxTube/Assets/LargeTile.scale-150.png index 3fbb4ec..677927b 100644 Binary files a/FoxTube/Assets/LargeTile.scale-150.png and b/FoxTube/Assets/LargeTile.scale-150.png differ diff --git a/FoxTube/Assets/LargeTile.scale-200.png b/FoxTube/Assets/LargeTile.scale-200.png index 429dd7d..0788ec9 100644 Binary files a/FoxTube/Assets/LargeTile.scale-200.png and b/FoxTube/Assets/LargeTile.scale-200.png differ diff --git a/FoxTube/Assets/LargeTile.scale-400.png b/FoxTube/Assets/LargeTile.scale-400.png index ea5dc88..1275239 100644 Binary files a/FoxTube/Assets/LargeTile.scale-400.png and b/FoxTube/Assets/LargeTile.scale-400.png differ diff --git a/FoxTube/Assets/SmallTile.scale-100.png b/FoxTube/Assets/SmallTile.scale-100.png index d617be7..2b2d279 100644 Binary files a/FoxTube/Assets/SmallTile.scale-100.png and b/FoxTube/Assets/SmallTile.scale-100.png differ diff --git a/FoxTube/Assets/SmallTile.scale-125.png b/FoxTube/Assets/SmallTile.scale-125.png index b563ff6..d495087 100644 Binary files a/FoxTube/Assets/SmallTile.scale-125.png and b/FoxTube/Assets/SmallTile.scale-125.png differ diff --git a/FoxTube/Assets/SmallTile.scale-150.png b/FoxTube/Assets/SmallTile.scale-150.png index efc3d78..80263ec 100644 Binary files a/FoxTube/Assets/SmallTile.scale-150.png and b/FoxTube/Assets/SmallTile.scale-150.png differ diff --git a/FoxTube/Assets/SmallTile.scale-200.png b/FoxTube/Assets/SmallTile.scale-200.png index 7b29662..7029107 100644 Binary files a/FoxTube/Assets/SmallTile.scale-200.png and b/FoxTube/Assets/SmallTile.scale-200.png differ diff --git a/FoxTube/Assets/SmallTile.scale-400.png b/FoxTube/Assets/SmallTile.scale-400.png index 1c7a8d6..e68e897 100644 Binary files a/FoxTube/Assets/SmallTile.scale-400.png and b/FoxTube/Assets/SmallTile.scale-400.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-100.png b/FoxTube/Assets/SplashScreen.scale-100.png index 77e313a..5c05bb5 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-100.png and b/FoxTube/Assets/SplashScreen.scale-100.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-125.png b/FoxTube/Assets/SplashScreen.scale-125.png index 5e5b2ba..d31d279 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-125.png and b/FoxTube/Assets/SplashScreen.scale-125.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-150.png b/FoxTube/Assets/SplashScreen.scale-150.png index 8820ab3..c54b15c 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-150.png and b/FoxTube/Assets/SplashScreen.scale-150.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-200.png b/FoxTube/Assets/SplashScreen.scale-200.png index e83ae40..8ff87be 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-200.png and b/FoxTube/Assets/SplashScreen.scale-200.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-400.png b/FoxTube/Assets/SplashScreen.scale-400.png index 2e242e2..8b8c537 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-400.png and b/FoxTube/Assets/SplashScreen.scale-400.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-100.png b/FoxTube/Assets/Square150x150Logo.scale-100.png index 4912ff4..3502f35 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-100.png and b/FoxTube/Assets/Square150x150Logo.scale-100.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-125.png b/FoxTube/Assets/Square150x150Logo.scale-125.png index 80b2d1f..28f29b5 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-125.png and b/FoxTube/Assets/Square150x150Logo.scale-125.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-150.png b/FoxTube/Assets/Square150x150Logo.scale-150.png index 6cf113b..15c3280 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-150.png and b/FoxTube/Assets/Square150x150Logo.scale-150.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-200.png b/FoxTube/Assets/Square150x150Logo.scale-200.png index feb190f..d9cd9e3 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-200.png and b/FoxTube/Assets/Square150x150Logo.scale-200.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-400.png b/FoxTube/Assets/Square150x150Logo.scale-400.png index d226fce..26455e6 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-400.png and b/FoxTube/Assets/Square150x150Logo.scale-400.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png index ed3277d..4190717 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png index 39790c6..3f8b07f 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png index add1a0d..966ef2c 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png index 3b74fae..d5566cd 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-100.png b/FoxTube/Assets/Square44x44Logo.scale-100.png index 5900856..4d54ade 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-100.png and b/FoxTube/Assets/Square44x44Logo.scale-100.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-125.png b/FoxTube/Assets/Square44x44Logo.scale-125.png index dedc1da..1d10473 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-125.png and b/FoxTube/Assets/Square44x44Logo.scale-125.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-150.png b/FoxTube/Assets/Square44x44Logo.scale-150.png index 27f4b81..532eeb5 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-150.png and b/FoxTube/Assets/Square44x44Logo.scale-150.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-200.png b/FoxTube/Assets/Square44x44Logo.scale-200.png index 40e041d..a388b69 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-200.png and b/FoxTube/Assets/Square44x44Logo.scale-200.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-400.png b/FoxTube/Assets/Square44x44Logo.scale-400.png index c3cf925..952b836 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-400.png and b/FoxTube/Assets/Square44x44Logo.scale-400.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-16.png b/FoxTube/Assets/Square44x44Logo.targetsize-16.png index 75918f2..ae65581 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-16.png and b/FoxTube/Assets/Square44x44Logo.targetsize-16.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-24.png b/FoxTube/Assets/Square44x44Logo.targetsize-24.png index 9188bbe..2e920ea 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-24.png and b/FoxTube/Assets/Square44x44Logo.targetsize-24.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png index 5d3b730..157e51b 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and b/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-256.png b/FoxTube/Assets/Square44x44Logo.targetsize-256.png index 075c6ef..c512e4f 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-256.png and b/FoxTube/Assets/Square44x44Logo.targetsize-256.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-32.png b/FoxTube/Assets/Square44x44Logo.targetsize-32.png index 9437baa..e21a640 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-32.png and b/FoxTube/Assets/Square44x44Logo.targetsize-32.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-48.png b/FoxTube/Assets/Square44x44Logo.targetsize-48.png index 8ca545e..9fb449f 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-48.png and b/FoxTube/Assets/Square44x44Logo.targetsize-48.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-100.png b/FoxTube/Assets/StoreLogo.scale-100.png index 3ab11f5..7a7928b 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-100.png and b/FoxTube/Assets/StoreLogo.scale-100.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-125.png b/FoxTube/Assets/StoreLogo.scale-125.png index cb504c8..6c6be97 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-125.png and b/FoxTube/Assets/StoreLogo.scale-125.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-150.png b/FoxTube/Assets/StoreLogo.scale-150.png index 8b8b63b..22ec353 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-150.png and b/FoxTube/Assets/StoreLogo.scale-150.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-200.png b/FoxTube/Assets/StoreLogo.scale-200.png index 4e8cf47..1b8d85e 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-200.png and b/FoxTube/Assets/StoreLogo.scale-200.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-400.png b/FoxTube/Assets/StoreLogo.scale-400.png index 67f49b5..9a0689c 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-400.png and b/FoxTube/Assets/StoreLogo.scale-400.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-100.png b/FoxTube/Assets/Wide310x150Logo.scale-100.png index 90bc98f..cc7c465 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-100.png and b/FoxTube/Assets/Wide310x150Logo.scale-100.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-125.png b/FoxTube/Assets/Wide310x150Logo.scale-125.png index 0220830..4c7379c 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-125.png and b/FoxTube/Assets/Wide310x150Logo.scale-125.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-150.png b/FoxTube/Assets/Wide310x150Logo.scale-150.png index cc9bfc9..698b94d 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-150.png and b/FoxTube/Assets/Wide310x150Logo.scale-150.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-200.png b/FoxTube/Assets/Wide310x150Logo.scale-200.png index 77e313a..5c05bb5 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-200.png and b/FoxTube/Assets/Wide310x150Logo.scale-200.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-400.png b/FoxTube/Assets/Wide310x150Logo.scale-400.png index e83ae40..8ff87be 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-400.png and b/FoxTube/Assets/Wide310x150Logo.scale-400.png differ diff --git a/FoxTube/Classes/SettingsStorage.cs b/FoxTube/Classes/SettingsStorage.cs index 10bf150..0cd0fa6 100644 --- a/FoxTube/Classes/SettingsStorage.cs +++ b/FoxTube/Classes/SettingsStorage.cs @@ -194,14 +194,44 @@ namespace FoxTube public static void LoadData() { + /*if(true && (storage.Values["forceUpdate"] == null || storage.Values["forceUpdate"].ToString() != Version)) + { + SaveData(); + storage.Values["forceUpdate"] = Version; + return; + }*/ + try { object[] saved = JsonConvert.DeserializeObject(storage.Values["settings"] as string); if (settings.Length > saved.Length) { - for (int i = 0; i < saved.Length; i++) - if(settings[i].GetType() == saved[i].GetType()) - settings[i] = saved[i]; + if (saved[0] is string) + settings[0] = saved; + if (saved[1] is string) + settings[1] = saved; + if (saved[2] is bool) + settings[2] = saved; + if (saved[3] is bool) + settings[3] = saved; + if (saved[4] is bool) + settings[4] = saved; + if (saved[5] is bool) + settings[5] = saved; + if (saved[6] is int) + settings[6] = saved; + if (saved[7] is string) + settings[7] = saved; + if (saved[8] is string) + settings[8] = saved; + if (saved[9] is string) + settings[9] = saved; + if (saved[10] is int) + settings[10] = saved; + if (saved[11] is int) + settings[11] = saved; + if (saved[12] is bool) + settings[12] = saved; SaveData(); } diff --git a/FoxTube/Controls/LiveCaptions.xaml.cs b/FoxTube/Controls/LiveCaptions.xaml.cs index 4796026..ae4f065 100644 --- a/FoxTube/Controls/LiveCaptions.xaml.cs +++ b/FoxTube/Controls/LiveCaptions.xaml.cs @@ -1,28 +1,19 @@ using FoxTube.Classes; 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 System.Xml; -using System.Diagnostics; - -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 +using Windows.Media; namespace FoxTube.Controls { + /// + /// Control for displaying closed captions + /// public sealed partial class LiveCaptions : UserControl { - public MediaElement Player { get; set; } + public MediaTimelineController Player { get; set; } private bool isClosed = false; DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(10) }; List captions = new List(); @@ -30,7 +21,7 @@ namespace FoxTube.Controls public LiveCaptions() { - this.InitializeComponent(); + InitializeComponent(); timer.Tick += UpdateCaption; } diff --git a/FoxTube/Controls/VideoPlayer.xaml b/FoxTube/Controls/VideoPlayer.xaml index d14122f..fb00dd9 100644 --- a/FoxTube/Controls/VideoPlayer.xaml +++ b/FoxTube/Controls/VideoPlayer.xaml @@ -14,9 +14,9 @@ PointerEntered="UserControl_PointerEntered"> - - - + + + diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs index 0abc0cc..486a541 100644 --- a/FoxTube/Controls/VideoPlayer.xaml.cs +++ b/FoxTube/Controls/VideoPlayer.xaml.cs @@ -30,6 +30,8 @@ using Windows.Media.MediaProperties; using Windows.Storage; using Windows.Storage.FileProperties; using Windows.Media.Editing; +using Windows.Media.Streaming.Adaptive; +using Windows.Media.Playback; namespace FoxTube { @@ -76,17 +78,6 @@ namespace FoxTube IReadOnlyList ccInfo; MediaStreamInfoSet streamInfo; - - Timer t = new Timer() - { - Interval = 5000, - Enabled = false - }; - Timer seekTimer = new Timer() - { - Interval = 1000, - Enabled = true - }; DispatcherTimer timer = new DispatcherTimer() { @@ -94,6 +85,10 @@ namespace FoxTube }; DispatcherTimer ctrlsFadeTimer = null; + MediaPlayer videoPlayer; + MediaPlayer audioPlayer; + MediaTimelineController controller; + public VideoPlayer() { InitializeComponent(); @@ -149,17 +144,28 @@ namespace FoxTube public void InitializeContols() { + videoPlayer = new MediaPlayer(); + controller = new MediaTimelineController(); + + videoPlayer.TimelineController = controller; + controller.PositionChanged += UpdateSeek; + videoSource.SetMediaPlayer(videoPlayer); + videoPlayer.MediaOpened += (s, e) => + { + if (SettingsStorage.Autoplay) + controller.Resume(); + }; + volume.Value = SettingsStorage.Volume; - videoSource.AutoPlay = SettingsStorage.Autoplay; if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) miniViewBtn.Visibility = Visibility.Collapsed; - videoSource.MediaEnded += (s, arg) => + controller.StateChanged += CurrentStateChanged; + controller.Ended += (s, arg) => { seek.Value = seek.Maximum; seekIndicator.Value = seekIndicator.Maximum; - timer.Stop(); }; #region System Media Transport Controls @@ -229,8 +235,6 @@ namespace FoxTube { InitializeContols(); captions = grid.Children[2] as LiveCaptions; - timer.Tick += UpdateSeek; - timer.Start(); total = XmlConvert.ToTimeSpan(item.ContentDetails.Duration); seek.Maximum = total.TotalSeconds; @@ -271,8 +275,6 @@ namespace FoxTube else captionsBtn.Visibility = Visibility.Collapsed; #endregion - - //quality_SelectionChanged(this, null); } public void UpdateCountdown(object sender, object e) @@ -285,10 +287,13 @@ namespace FoxTube } - public void UpdateSeek(object sender, object e) + public async void UpdateSeek(MediaTimelineController sender, object e) { - seek.Value = videoSource.Position.TotalSeconds; - seekIndicator.Value = seek.Value; + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + seek.Value = controller.Position.TotalSeconds; + seekIndicator.Value = seek.Value; + }); } public void RaiseError(Exception e) @@ -306,11 +311,11 @@ namespace FoxTube switch (args.Button) { case SystemMediaTransportControlsButton.Pause: - videoSource.Pause(); + controller.Pause(); break; case SystemMediaTransportControlsButton.Play: - videoSource.Play(); + controller.Resume(); break; case SystemMediaTransportControlsButton.Next: @@ -353,7 +358,9 @@ namespace FoxTube SettingsStorage.Volume = (int) volume.Value; - videoSource.Volume = volume.Value * 0.01; + if(audioPlayer != null) + audioPlayer.Volume = volume.Value * .01; + videoPlayer.Volume = volume.Value * .01; } private void muteBtn_Click(object sender, RoutedEventArgs e) @@ -419,37 +426,41 @@ namespace FoxTube ctrlsFadeTimer?.Start(); } - private async void quality_SelectionChanged(object sender, SelectionChangedEventArgs e) + private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e) { - //try + try { SettingsStorage.RememberedQuality = ((ComboBoxItem)quality.SelectedItem).Content.ToString(); - videoSource.Pause(); - timecodeBackup = videoSource.Position.TotalSeconds; + controller.Pause(); + timecodeBackup = controller.Position.TotalSeconds; if(streamInfo.Muxed.ToList().Exists(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content.ToString())) - videoSource.Source = streamInfo.Muxed.Find(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string).Url.ToUri(); + { + videoPlayer.Source = MediaSource.CreateFromUri(streamInfo.Muxed.Find(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string).Url.ToUri()); + audioPlayer = null; + } else { + if(audioPlayer == null) + { + audioPlayer = new MediaPlayer(); + audioPlayer.TimelineController = controller; + audioPlayer.Volume = volume.Value * .01; + audioSource.SetMediaPlayer(audioPlayer); + } + VideoStreamInfo videoInfo = streamInfo.Video.Find(i => i.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content.ToString()); AudioStreamInfo audioInfo = streamInfo.Audio.First(); - MediaComposition muxedStream = new MediaComposition(); - - BackgroundAudioTrack audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(audioInfo.Url)); - MediaClip videoTrack = await MediaClip.CreateFromFileAsync(await StorageFile.GetFileFromApplicationUriAsync(videoInfo.Url.ToUri())); - - muxedStream.BackgroundAudioTracks.Add(audioTrack); - muxedStream.Clips.Add(videoTrack); - - videoSource.SetMediaStreamSource(muxedStream.GenerateMediaStreamSource()); + videoPlayer.Source = MediaSource.CreateFromUri(videoInfo.Url.ToUri()); + audioPlayer.Source = MediaSource.CreateFromUri(audioInfo.Url.ToUri()); } needUpdateTimecode = true; - videoSource.Play(); + controller.Resume(); } - //catch + catch { } @@ -500,76 +511,58 @@ namespace FoxTube private void play_Click(object sender, RoutedEventArgs e) { - if (videoSource.CurrentState == MediaElementState.Playing) - videoSource.Pause(); - else if (videoSource.CurrentState == MediaElementState.Paused) - videoSource.Play(); + if (controller.State == MediaTimelineControllerState.Running) + controller.Pause(); + else if (controller.State == MediaTimelineControllerState.Paused) + controller.Resume(); } - private void videoSource_Opened(object sender, RoutedEventArgs arg) + private async void CurrentStateChanged(MediaTimelineController sender, object e) { - if (SettingsStorage.Autoplay) - play_Click(this, null); - } - - private void videoSource_CurrentStateChanged(object sender, RoutedEventArgs e) - { - if(videoSource.CurrentState == MediaElementState.Playing && needUpdateTimecode) + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { - videoSource.Position = TimeSpan.FromSeconds(timecodeBackup); - needUpdateTimecode = false; - } + if (controller.State == MediaTimelineControllerState.Running && needUpdateTimecode) + { + controller.Position = TimeSpan.FromSeconds(timecodeBackup); + needUpdateTimecode = false; + } - switch(videoSource.CurrentState) - { - case MediaElementState.Buffering: - bufferingBar.Visibility = Visibility.Visible; + switch (controller.State) + { + case MediaTimelineControllerState.Paused: + bufferingBar.Visibility = Visibility.Collapsed; - seek.IsEnabled = false; - play.IsEnabled = false; - touchPlay.IsEnabled = false; + seek.IsEnabled = true; + play.IsEnabled = true; + touchPlay.IsEnabled = true; - play.Content = "\xE102"; - touchPlay.Content = "\xE102"; + play.Content = "\xE102"; + touchPlay.Content = "\xE102"; - systemControls.PlaybackStatus = MediaPlaybackStatus.Paused; - break; + systemControls.PlaybackStatus = MediaPlaybackStatus.Paused; + break; - case MediaElementState.Paused: - bufferingBar.Visibility = Visibility.Collapsed; + case MediaTimelineControllerState.Running: + bufferingBar.Visibility = Visibility.Collapsed; - seek.IsEnabled = true; - play.IsEnabled = true; - touchPlay.IsEnabled = true; + seek.IsEnabled = true; + play.IsEnabled = true; + touchPlay.IsEnabled = true; - play.Content = "\xE102"; - touchPlay.Content = "\xE102"; + play.Content = "\xE103"; + touchPlay.Content = "\xE103"; - systemControls.PlaybackStatus = MediaPlaybackStatus.Paused; - break; + systemControls.PlaybackStatus = MediaPlaybackStatus.Playing; + break; - case MediaElementState.Playing: - bufferingBar.Visibility = Visibility.Collapsed; + default: + bufferingBar.Visibility = Visibility.Collapsed; + systemControls.PlaybackStatus = MediaPlaybackStatus.Closed; + break; + } - seek.IsEnabled = true; - play.IsEnabled = true; - touchPlay.IsEnabled = true; - - seekTimer.Start(); - - play.Content = "\xE103"; - touchPlay.Content = "\xE103"; - - systemControls.PlaybackStatus = MediaPlaybackStatus.Playing; - break; - - default: - bufferingBar.Visibility = Visibility.Collapsed; - systemControls.PlaybackStatus = MediaPlaybackStatus.Closed; - break; - } - - //SecretsVault.HistoryAdd(videoId, elapsed, total); + //SecretsVault.HistoryAdd(videoId, elapsed, total); + }); } private async void miniView_Click(object sender, RoutedEventArgs e) @@ -633,19 +626,19 @@ namespace FoxTube private void seek_PointerCaptureLost(object sender, PointerRoutedEventArgs e) { - videoSource.Position = elapsed; + controller.Position = elapsed; } private void fwd30_Click(object sender, RoutedEventArgs e) { if(remaining.TotalSeconds >= 30) - videoSource.Position = elapsed.Add(TimeSpan.FromSeconds(30)); + controller.Position = elapsed.Add(TimeSpan.FromSeconds(30)); } private void back10_Click(object sender, RoutedEventArgs e) { if (elapsed.TotalSeconds >= 10) - videoSource.Position = elapsed.Subtract(TimeSpan.FromSeconds(10)); + controller.Position = elapsed.Subtract(TimeSpan.FromSeconds(10)); } private void next_Click(object sender, RoutedEventArgs e) @@ -669,7 +662,7 @@ namespace FoxTube public void Pause() { - videoSource.Pause(); + controller.Pause(); } public void minimize_Click(object sender, RoutedEventArgs e) @@ -732,10 +725,10 @@ namespace FoxTube private void cast_Click(object sender, RoutedEventArgs e) { - if(videoSource.Source != null) + if(videoPlayer.Source != null) { - if (videoSource.CurrentState != MediaElementState.Paused) - videoSource.Pause(); + if (controller.State != MediaTimelineControllerState.Paused) + controller.Pause(); CastingDevicePicker picker = new CastingDevicePicker(); picker.Filter.SupportsVideo = true; picker.CastingDeviceSelected += Picker_CastingDeviceSelected; @@ -749,7 +742,7 @@ namespace FoxTube private async void Picker_CastingDeviceSelected(CastingDevicePicker sender, CastingDeviceSelectedEventArgs args) { CastingConnection connection = args.SelectedCastingDevice.CreateCastingConnection(); - await connection.RequestStartCastingAsync(videoSource.GetAsCastingSource()); + await connection.RequestStartCastingAsync(videoPlayer.GetAsCastingSource()); } private void playPauseArea_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) @@ -798,7 +791,7 @@ namespace FoxTube private void videoSource_BufferingProgressChanged(object sender, RoutedEventArgs e) { - bufferingLevel.Value = videoSource.BufferingProgress * 100; + bufferingLevel.Value = videoPlayer.PlaybackSession.BufferingProgress * 100; } private void GotoLive_Click(object sender, RoutedEventArgs e) diff --git a/FoxTube/Package.appxmanifest b/FoxTube/Package.appxmanifest index 5c394c6..665d62c 100644 --- a/FoxTube/Package.appxmanifest +++ b/FoxTube/Package.appxmanifest @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/FoxTube/Pages/SettingsPages/General.xaml b/FoxTube/Pages/SettingsPages/General.xaml index 4955e99..435448a 100644 --- a/FoxTube/Pages/SettingsPages/General.xaml +++ b/FoxTube/Pages/SettingsPages/General.xaml @@ -30,13 +30,6 @@ - - - - - - - diff --git a/FoxTube/Pages/SettingsPages/General.xaml.cs b/FoxTube/Pages/SettingsPages/General.xaml.cs index 5cd9763..23ae914 100644 --- a/FoxTube/Pages/SettingsPages/General.xaml.cs +++ b/FoxTube/Pages/SettingsPages/General.xaml.cs @@ -6,6 +6,8 @@ using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3.Data; +using YoutubeExplode.Models.MediaStreams; +using System; namespace FoxTube.Pages.SettingsPages { @@ -21,6 +23,8 @@ namespace FoxTube.Pages.SettingsPages language.SelectedItem = language.Items.Find(i => ((ComboBoxItem)i).Tag.ToString() == SettingsStorage.Language); safeSearch.SelectedIndex = SettingsStorage.SafeSearch; + foreach (VideoQuality i in Enum.GetValues(typeof(VideoQuality))) + quality.Items.Add(new ComboBoxItem() { Tag = i.GetVideoQualityLabel(), Content = i.GetVideoQualityLabel() }); quality.SelectedItem = quality.Items.ToList().Find(i => ((ComboBoxItem)i).Tag.ToString() == SettingsStorage.VideoQuality); mobileWarning.IsOn = SettingsStorage.CheckConnection; autoplay.IsOn = SettingsStorage.Autoplay; diff --git a/Src/LogoVer3.png b/Src/LogoVer3.png new file mode 100644 index 0000000..dfa76d6 Binary files /dev/null and b/Src/LogoVer3.png differ diff --git a/Src/NewLogoDraftVer3.psd b/Src/NewLogoDraftVer3.psd new file mode 100644 index 0000000..be4c856 Binary files /dev/null and b/Src/NewLogoDraftVer3.psd differ