#176: Done
This commit is contained in:
@@ -23,6 +23,7 @@ namespace FoxTube.Controls
|
||||
public sealed partial class LiveCaptions : UserControl
|
||||
{
|
||||
public MediaElement Player { get; set; }
|
||||
private bool isClosed = false;
|
||||
DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(10) };
|
||||
List<Caption> captions = new List<Caption>();
|
||||
Caption currentCaption = null;
|
||||
@@ -38,6 +39,7 @@ namespace FoxTube.Controls
|
||||
TimeSpan currentPosition = Player.Position;
|
||||
|
||||
bool found = false;
|
||||
if(!isClosed)
|
||||
captions.ForEach((x) =>
|
||||
{
|
||||
if (Player.Position >= x.Start && Player.Position <= x.End)
|
||||
@@ -64,6 +66,7 @@ namespace FoxTube.Controls
|
||||
foreach (XmlElement i in doc["timedtext"]["body"].ChildNodes)
|
||||
captions.Add(new Caption(int.Parse(i.GetAttribute("t")), int.Parse(i.GetAttribute("d")), i.InnerText));
|
||||
|
||||
if(!isClosed)
|
||||
captions.ForEach((x) =>
|
||||
{
|
||||
if(Player.Position > x.Start && Player.Position < x.End)
|
||||
@@ -84,5 +87,15 @@ namespace FoxTube.Controls
|
||||
Visibility = Visibility.Collapsed;
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
isClosed = true;
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
isClosed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,19 @@ namespace FoxTube
|
||||
{
|
||||
public string videoId;
|
||||
|
||||
public bool miniView = false;
|
||||
private bool miniview = false;
|
||||
public bool MiniView
|
||||
{
|
||||
get { return miniview; }
|
||||
set
|
||||
{
|
||||
miniview = value;
|
||||
if (value)
|
||||
captions.Hide();
|
||||
else
|
||||
captions.Show();
|
||||
}
|
||||
}
|
||||
private bool fullScreen = false;
|
||||
public bool pointerCaptured = false;
|
||||
|
||||
@@ -244,7 +256,7 @@ namespace FoxTube
|
||||
void Elapsed()
|
||||
{
|
||||
controls.Visibility = Visibility.Collapsed;
|
||||
if (!miniView)
|
||||
if (!MiniView)
|
||||
touchCentral.Visibility = Visibility.Collapsed;
|
||||
if (pointerCaptured)
|
||||
{
|
||||
@@ -257,7 +269,7 @@ namespace FoxTube
|
||||
|
||||
public void UpdateSize()
|
||||
{
|
||||
if(miniView)
|
||||
if(MiniView)
|
||||
{
|
||||
Height = Window.Current.Bounds.Height;
|
||||
Debug.WriteLine("Video player aspect ratio has been corrected.");
|
||||
@@ -318,7 +330,7 @@ namespace FoxTube
|
||||
void ShowControls()
|
||||
{
|
||||
controls.Visibility = Visibility.Visible;
|
||||
if (miniView)
|
||||
if (MiniView)
|
||||
seekIndicator.Visibility = Visibility.Visible;
|
||||
if (pointerCaptured)
|
||||
Window.Current.CoreWindow.PointerCursor = cursorBackup;
|
||||
@@ -477,10 +489,10 @@ namespace FoxTube
|
||||
private async void miniView_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||
miniView = !miniView;
|
||||
SetFullSize(this, miniView);
|
||||
MiniView = !MiniView;
|
||||
SetFullSize(this, MiniView);
|
||||
|
||||
if (miniView)
|
||||
if (MiniView)
|
||||
{
|
||||
if (fullScreen)
|
||||
{
|
||||
@@ -606,7 +618,7 @@ namespace FoxTube
|
||||
Width = 432;
|
||||
Height = 243;
|
||||
|
||||
miniView = true;
|
||||
MiniView = true;
|
||||
Methods.MainPage.MinimizeVideo();
|
||||
|
||||
mainControls.Visibility = Visibility.Collapsed;
|
||||
@@ -633,7 +645,7 @@ namespace FoxTube
|
||||
Width = double.NaN;
|
||||
Height = double.NaN;
|
||||
|
||||
miniView = false;
|
||||
MiniView = false;
|
||||
Methods.MainPage.MaximizeVideo();
|
||||
|
||||
mainControls.Visibility = Visibility.Visible;
|
||||
@@ -671,19 +683,19 @@ namespace FoxTube
|
||||
|
||||
private void playPauseArea_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
|
||||
{
|
||||
if (miniView && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay)
|
||||
if (MiniView && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay)
|
||||
miniView_Click(this, null);
|
||||
else if (miniView && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.Default)
|
||||
else if (MiniView && ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.Default)
|
||||
maximize_Click(this, null);
|
||||
else if (fullScreen)
|
||||
fullscreen_Click(this, null);
|
||||
else if (!miniView && !fullScreen)
|
||||
else if (!MiniView && !fullScreen)
|
||||
fullscreen_Click(this, null);
|
||||
}
|
||||
|
||||
private void playPauseArea_Tapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
if (e.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse && !miniView)
|
||||
if (e.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse && !MiniView)
|
||||
play_Click(this, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace FoxTube
|
||||
{
|
||||
nav.OpenPaneLength = 0;
|
||||
nav.CompactPaneLength = 0;
|
||||
if ((videoPlaceholder.Content as VideoPage).player.miniView)
|
||||
if ((videoPlaceholder.Content as VideoPage).player.MiniView)
|
||||
nav.Margin = new Thickness(0, -80, 0, 0);
|
||||
else
|
||||
nav.Margin = new Thickness(0, -91, 0, 0);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace FoxTube
|
||||
{
|
||||
loading.Refresh();
|
||||
|
||||
//try
|
||||
try
|
||||
{
|
||||
Parameters = arg;
|
||||
request = SecretsVault.Service.Search.List("id,snippet");
|
||||
@@ -159,14 +159,14 @@ namespace FoxTube
|
||||
|
||||
loading.Close();
|
||||
}
|
||||
/*catch (System.Net.Http.HttpRequestException)
|
||||
catch (System.Net.Http.HttpRequestException)
|
||||
{
|
||||
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
loading.Error(e.GetType().ToString(), e.Message);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleFilters_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user