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