Archived
1
0

Missync fixed. New logo. Supporting all existing qualities

Related Work Items: #207
This commit is contained in:
Michael Gordeev
2019-01-01 13:48:00 +03:00
parent bfa389a3b3
commit df6d74da5c
54 changed files with 146 additions and 135 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 55 KiB

+33 -3
View File
@@ -194,14 +194,44 @@ namespace FoxTube
public static void LoadData() public static void LoadData()
{ {
/*if(true && (storage.Values["forceUpdate"] == null || storage.Values["forceUpdate"].ToString() != Version))
{
SaveData();
storage.Values["forceUpdate"] = Version;
return;
}*/
try try
{ {
object[] saved = JsonConvert.DeserializeObject<object[]>(storage.Values["settings"] as string); object[] saved = JsonConvert.DeserializeObject<object[]>(storage.Values["settings"] as string);
if (settings.Length > saved.Length) if (settings.Length > saved.Length)
{ {
for (int i = 0; i < saved.Length; i++) if (saved[0] is string)
if(settings[i].GetType() == saved[i].GetType()) settings[0] = saved;
settings[i] = saved[i]; 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(); SaveData();
} }
+6 -15
View File
@@ -1,28 +1,19 @@
using FoxTube.Classes; using FoxTube.Classes;
using System; using System;
using System.Collections.Generic; 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;
using Windows.UI.Xaml.Controls; 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.Xml;
using System.Diagnostics; using Windows.Media;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube.Controls namespace FoxTube.Controls
{ {
/// <summary>
/// Control for displaying closed captions
/// </summary>
public sealed partial class LiveCaptions : UserControl public sealed partial class LiveCaptions : UserControl
{ {
public MediaElement Player { get; set; } public MediaTimelineController Player { get; set; }
private bool isClosed = false; private bool isClosed = false;
DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(10) }; DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(10) };
List<Caption> captions = new List<Caption>(); List<Caption> captions = new List<Caption>();
@@ -30,7 +21,7 @@ namespace FoxTube.Controls
public LiveCaptions() public LiveCaptions()
{ {
this.InitializeComponent(); InitializeComponent();
timer.Tick += UpdateCaption; timer.Tick += UpdateCaption;
} }
+3 -3
View File
@@ -14,9 +14,9 @@
PointerEntered="UserControl_PointerEntered"> PointerEntered="UserControl_PointerEntered">
<Grid Background="White" Name="grid" Tapped="UserControl_Tapped"> <Grid Background="White" Name="grid" Tapped="UserControl_Tapped">
<MediaElement IsDoubleTapEnabled="False" CurrentStateChanged="videoSource_CurrentStateChanged" AutoPlay="False" MediaOpened="videoSource_Opened" BufferingProgressChanged="videoSource_BufferingProgressChanged" Volume="0" Name="videoSource" AreTransportControlsEnabled="False" PosterSource="ms-appx:///Assets/videoThumbSample.png"/> <MediaPlayerElement IsDoubleTapEnabled="False" Name="videoSource" AreTransportControlsEnabled="False" PosterSource="ms-appx:///Assets/videoThumbSample.png"/>
<MediaPlayerElement Name="audioSource" Width="0" Height="0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<controls1:LiveCaptions Player="{x:Bind videoSource}" Visibility="Collapsed"/> <controls1:LiveCaptions Player="{x:Bind controller}" Visibility="Collapsed"/>
<Grid Name="controls" Visibility="Visible"> <Grid Name="controls" Visibility="Visible">
<Grid.RowDefinitions> <Grid.RowDefinitions>
+98 -105
View File
@@ -30,6 +30,8 @@ using Windows.Media.MediaProperties;
using Windows.Storage; using Windows.Storage;
using Windows.Storage.FileProperties; using Windows.Storage.FileProperties;
using Windows.Media.Editing; using Windows.Media.Editing;
using Windows.Media.Streaming.Adaptive;
using Windows.Media.Playback;
namespace FoxTube namespace FoxTube
{ {
@@ -77,23 +79,16 @@ namespace FoxTube
IReadOnlyList<ClosedCaptionTrackInfo> ccInfo; IReadOnlyList<ClosedCaptionTrackInfo> ccInfo;
MediaStreamInfoSet streamInfo; MediaStreamInfoSet streamInfo;
Timer t = new Timer()
{
Interval = 5000,
Enabled = false
};
Timer seekTimer = new Timer()
{
Interval = 1000,
Enabled = true
};
DispatcherTimer timer = new DispatcherTimer() DispatcherTimer timer = new DispatcherTimer()
{ {
Interval = TimeSpan.FromSeconds(1) Interval = TimeSpan.FromSeconds(1)
}; };
DispatcherTimer ctrlsFadeTimer = null; DispatcherTimer ctrlsFadeTimer = null;
MediaPlayer videoPlayer;
MediaPlayer audioPlayer;
MediaTimelineController controller;
public VideoPlayer() public VideoPlayer()
{ {
InitializeComponent(); InitializeComponent();
@@ -149,17 +144,28 @@ namespace FoxTube
public void InitializeContols() 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; volume.Value = SettingsStorage.Volume;
videoSource.AutoPlay = SettingsStorage.Autoplay;
if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay))
miniViewBtn.Visibility = Visibility.Collapsed; miniViewBtn.Visibility = Visibility.Collapsed;
videoSource.MediaEnded += (s, arg) => controller.StateChanged += CurrentStateChanged;
controller.Ended += (s, arg) =>
{ {
seek.Value = seek.Maximum; seek.Value = seek.Maximum;
seekIndicator.Value = seekIndicator.Maximum; seekIndicator.Value = seekIndicator.Maximum;
timer.Stop();
}; };
#region System Media Transport Controls #region System Media Transport Controls
@@ -229,8 +235,6 @@ namespace FoxTube
{ {
InitializeContols(); InitializeContols();
captions = grid.Children[2] as LiveCaptions; captions = grid.Children[2] as LiveCaptions;
timer.Tick += UpdateSeek;
timer.Start();
total = XmlConvert.ToTimeSpan(item.ContentDetails.Duration); total = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
seek.Maximum = total.TotalSeconds; seek.Maximum = total.TotalSeconds;
@@ -271,8 +275,6 @@ namespace FoxTube
else else
captionsBtn.Visibility = Visibility.Collapsed; captionsBtn.Visibility = Visibility.Collapsed;
#endregion #endregion
//quality_SelectionChanged(this, null);
} }
public void UpdateCountdown(object sender, object e) 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; await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
seekIndicator.Value = seek.Value; {
seek.Value = controller.Position.TotalSeconds;
seekIndicator.Value = seek.Value;
});
} }
public void RaiseError(Exception e) public void RaiseError(Exception e)
@@ -306,11 +311,11 @@ namespace FoxTube
switch (args.Button) switch (args.Button)
{ {
case SystemMediaTransportControlsButton.Pause: case SystemMediaTransportControlsButton.Pause:
videoSource.Pause(); controller.Pause();
break; break;
case SystemMediaTransportControlsButton.Play: case SystemMediaTransportControlsButton.Play:
videoSource.Play(); controller.Resume();
break; break;
case SystemMediaTransportControlsButton.Next: case SystemMediaTransportControlsButton.Next:
@@ -353,7 +358,9 @@ namespace FoxTube
SettingsStorage.Volume = (int) volume.Value; 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) private void muteBtn_Click(object sender, RoutedEventArgs e)
@@ -419,37 +426,41 @@ namespace FoxTube
ctrlsFadeTimer?.Start(); 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(); SettingsStorage.RememberedQuality = ((ComboBoxItem)quality.SelectedItem).Content.ToString();
videoSource.Pause(); controller.Pause();
timecodeBackup = videoSource.Position.TotalSeconds; timecodeBackup = controller.Position.TotalSeconds;
if(streamInfo.Muxed.ToList().Exists(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content.ToString())) 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 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()); VideoStreamInfo videoInfo = streamInfo.Video.Find(i => i.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content.ToString());
AudioStreamInfo audioInfo = streamInfo.Audio.First(); AudioStreamInfo audioInfo = streamInfo.Audio.First();
MediaComposition muxedStream = new MediaComposition(); videoPlayer.Source = MediaSource.CreateFromUri(videoInfo.Url.ToUri());
audioPlayer.Source = MediaSource.CreateFromUri(audioInfo.Url.ToUri());
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());
} }
needUpdateTimecode = true; needUpdateTimecode = true;
videoSource.Play(); controller.Resume();
} }
//catch catch
{ {
} }
@@ -500,76 +511,58 @@ namespace FoxTube
private void play_Click(object sender, RoutedEventArgs e) private void play_Click(object sender, RoutedEventArgs e)
{ {
if (videoSource.CurrentState == MediaElementState.Playing) if (controller.State == MediaTimelineControllerState.Running)
videoSource.Pause(); controller.Pause();
else if (videoSource.CurrentState == MediaElementState.Paused) else if (controller.State == MediaTimelineControllerState.Paused)
videoSource.Play(); controller.Resume();
} }
private void videoSource_Opened(object sender, RoutedEventArgs arg) private async void CurrentStateChanged(MediaTimelineController sender, object e)
{ {
if (SettingsStorage.Autoplay) await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
play_Click(this, null);
}
private void videoSource_CurrentStateChanged(object sender, RoutedEventArgs e)
{
if(videoSource.CurrentState == MediaElementState.Playing && needUpdateTimecode)
{ {
videoSource.Position = TimeSpan.FromSeconds(timecodeBackup); if (controller.State == MediaTimelineControllerState.Running && needUpdateTimecode)
needUpdateTimecode = false; {
} controller.Position = TimeSpan.FromSeconds(timecodeBackup);
needUpdateTimecode = false;
}
switch(videoSource.CurrentState) switch (controller.State)
{ {
case MediaElementState.Buffering: case MediaTimelineControllerState.Paused:
bufferingBar.Visibility = Visibility.Visible; bufferingBar.Visibility = Visibility.Collapsed;
seek.IsEnabled = false; seek.IsEnabled = true;
play.IsEnabled = false; play.IsEnabled = true;
touchPlay.IsEnabled = false; touchPlay.IsEnabled = true;
play.Content = "\xE102"; play.Content = "\xE102";
touchPlay.Content = "\xE102"; touchPlay.Content = "\xE102";
systemControls.PlaybackStatus = MediaPlaybackStatus.Paused; systemControls.PlaybackStatus = MediaPlaybackStatus.Paused;
break; break;
case MediaElementState.Paused: case MediaTimelineControllerState.Running:
bufferingBar.Visibility = Visibility.Collapsed; bufferingBar.Visibility = Visibility.Collapsed;
seek.IsEnabled = true; seek.IsEnabled = true;
play.IsEnabled = true; play.IsEnabled = true;
touchPlay.IsEnabled = true; touchPlay.IsEnabled = true;
play.Content = "\xE102"; play.Content = "\xE103";
touchPlay.Content = "\xE102"; touchPlay.Content = "\xE103";
systemControls.PlaybackStatus = MediaPlaybackStatus.Paused; systemControls.PlaybackStatus = MediaPlaybackStatus.Playing;
break; break;
case MediaElementState.Playing: default:
bufferingBar.Visibility = Visibility.Collapsed; bufferingBar.Visibility = Visibility.Collapsed;
systemControls.PlaybackStatus = MediaPlaybackStatus.Closed;
break;
}
seek.IsEnabled = true; //SecretsVault.HistoryAdd(videoId, elapsed, total);
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);
} }
private async void miniView_Click(object sender, RoutedEventArgs e) private async void miniView_Click(object sender, RoutedEventArgs e)
@@ -633,19 +626,19 @@ namespace FoxTube
private void seek_PointerCaptureLost(object sender, PointerRoutedEventArgs e) private void seek_PointerCaptureLost(object sender, PointerRoutedEventArgs e)
{ {
videoSource.Position = elapsed; controller.Position = elapsed;
} }
private void fwd30_Click(object sender, RoutedEventArgs e) private void fwd30_Click(object sender, RoutedEventArgs e)
{ {
if(remaining.TotalSeconds >= 30) 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) private void back10_Click(object sender, RoutedEventArgs e)
{ {
if (elapsed.TotalSeconds >= 10) 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) private void next_Click(object sender, RoutedEventArgs e)
@@ -669,7 +662,7 @@ namespace FoxTube
public void Pause() public void Pause()
{ {
videoSource.Pause(); controller.Pause();
} }
public void minimize_Click(object sender, RoutedEventArgs e) public void minimize_Click(object sender, RoutedEventArgs e)
@@ -732,10 +725,10 @@ namespace FoxTube
private void cast_Click(object sender, RoutedEventArgs e) private void cast_Click(object sender, RoutedEventArgs e)
{ {
if(videoSource.Source != null) if(videoPlayer.Source != null)
{ {
if (videoSource.CurrentState != MediaElementState.Paused) if (controller.State != MediaTimelineControllerState.Paused)
videoSource.Pause(); controller.Pause();
CastingDevicePicker picker = new CastingDevicePicker(); CastingDevicePicker picker = new CastingDevicePicker();
picker.Filter.SupportsVideo = true; picker.Filter.SupportsVideo = true;
picker.CastingDeviceSelected += Picker_CastingDeviceSelected; picker.CastingDeviceSelected += Picker_CastingDeviceSelected;
@@ -749,7 +742,7 @@ namespace FoxTube
private async void Picker_CastingDeviceSelected(CastingDevicePicker sender, CastingDeviceSelectedEventArgs args) private async void Picker_CastingDeviceSelected(CastingDevicePicker sender, CastingDeviceSelectedEventArgs args)
{ {
CastingConnection connection = args.SelectedCastingDevice.CreateCastingConnection(); CastingConnection connection = args.SelectedCastingDevice.CreateCastingConnection();
await connection.RequestStartCastingAsync(videoSource.GetAsCastingSource()); await connection.RequestStartCastingAsync(videoPlayer.GetAsCastingSource());
} }
private void playPauseArea_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) private void playPauseArea_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
@@ -798,7 +791,7 @@ namespace FoxTube
private void videoSource_BufferingProgressChanged(object sender, RoutedEventArgs e) 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) private void GotoLive_Click(object sender, RoutedEventArgs e)
+2 -2
View File
@@ -15,7 +15,7 @@
</Resources> </Resources>
<Applications> <Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube"> <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="red"> <uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png"> <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
<uap:ShowNameOnTiles> <uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" /> <uap:ShowOn Tile="square150x150Logo" />
@@ -23,7 +23,7 @@
<uap:ShowOn Tile="square310x310Logo" /> <uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles> </uap:ShowNameOnTiles>
</uap:DefaultTile> </uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="red" /> <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#282828" />
</uap:VisualElements> </uap:VisualElements>
<Extensions> <Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="FoxTube.Background.BackgroundProcessor"> <Extension Category="windows.backgroundTasks" EntryPoint="FoxTube.Background.BackgroundProcessor">
-7
View File
@@ -30,13 +30,6 @@
<TextBlock x:Uid="/General/playback" Text="Playback" FontSize="22"/> <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"> <ComboBox x:Uid="/General/quality" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
<ComboBoxItem Tag="remember" x:Uid="/General/remember" Content="Remember my choice"/> <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> </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/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"/> <ToggleSwitch x:Uid="/General/autoplay" OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Toggled="autoplay_Toggled"/>
@@ -6,6 +6,8 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data; using Google.Apis.YouTube.v3.Data;
using YoutubeExplode.Models.MediaStreams;
using System;
namespace FoxTube.Pages.SettingsPages namespace FoxTube.Pages.SettingsPages
{ {
@@ -21,6 +23,8 @@ namespace FoxTube.Pages.SettingsPages
language.SelectedItem = language.Items.Find(i => ((ComboBoxItem)i).Tag.ToString() == SettingsStorage.Language); language.SelectedItem = language.Items.Find(i => ((ComboBoxItem)i).Tag.ToString() == SettingsStorage.Language);
safeSearch.SelectedIndex = SettingsStorage.SafeSearch; 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); quality.SelectedItem = quality.Items.ToList().Find(i => ((ComboBoxItem)i).Tag.ToString() == SettingsStorage.VideoQuality);
mobileWarning.IsOn = SettingsStorage.CheckConnection; mobileWarning.IsOn = SettingsStorage.CheckConnection;
autoplay.IsOn = SettingsStorage.Autoplay; autoplay.IsOn = SettingsStorage.Autoplay;
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.