Livestreams support on new player
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<items>
|
||||
<item time="2019-02-12" version="0.4">
|
||||
<item time="2019-04-05" version="0.4">
|
||||
<content>
|
||||
<en-US>### What's new:
|
||||
- Improved stability and speed of the app
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace FoxTube
|
||||
public sealed class PlayerControls : MediaTransportControls
|
||||
{
|
||||
public event RoutedEventHandler CloseRequested;
|
||||
public event RoutedEventHandler LiveRequested;
|
||||
public event MinimodeChangedEventHandler MiniModeChanged;
|
||||
public event RoutedEventHandler NextRequested;
|
||||
|
||||
@@ -63,6 +64,8 @@ namespace FoxTube
|
||||
|
||||
(GetTemplateChild("ProgressSlider") as Slider).ValueChanged += ProgressSlider_ValueChanged;
|
||||
|
||||
(GetTemplateChild("goLive") as Button).Click += (s, e) => LiveRequested.Invoke(s, e);
|
||||
|
||||
if (queue.Count > 0)
|
||||
foreach (Action i in queue)
|
||||
i();
|
||||
@@ -321,7 +324,17 @@ namespace FoxTube
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Set up stream UI
|
||||
(GetTemplateChild("goLive") as Button).Visibility = Visibility.Visible;
|
||||
(GetTemplateChild("sliderPan") as Grid).Children.Remove(GetTemplateChild("TimeElapsedElement") as TextBlock);
|
||||
(GetTemplateChild("rightStack") as StackPanel).Children.Insert(0, GetTemplateChild("TimeElapsedElement") as TextBlock);
|
||||
(GetTemplateChild("TimeElapsedElement") as TextBlock).VerticalAlignment = VerticalAlignment.Center;
|
||||
(GetTemplateChild("TimeElapsedElement") as TextBlock).FontSize = 18;
|
||||
(GetTemplateChild("TimeElapsedElement") as TextBlock).Margin = new Thickness(10, 0, 10, 0);
|
||||
(GetTemplateChild("sliderPan") as Grid).Visibility = Visibility.Collapsed;
|
||||
(GetTemplateChild("cc") as Button).Visibility = Visibility.Collapsed;
|
||||
(GetTemplateChild("quality") as Button).Visibility = Visibility.Collapsed;
|
||||
|
||||
Player.Source = url.ToUri();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace FoxTube
|
||||
else if (item.Snippet.LiveBroadcastContent == "live")
|
||||
{
|
||||
InitializeContols();
|
||||
Controls.IsSkipBackwardButtonVisible = false;
|
||||
Controls.IsSkipForwardButtonVisible = false;
|
||||
Controls.LiveRequested += Controls_LiveRequested;
|
||||
Controls.SetStream((await new YoutubeClient().GetVideoMediaStreamInfosAsync(item.Id)).HlsLiveStreamUrl);
|
||||
}
|
||||
else
|
||||
@@ -67,6 +70,11 @@ namespace FoxTube
|
||||
Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void Controls_LiveRequested(object sender, RoutedEventArgs e)
|
||||
{
|
||||
videoSource.Position = videoSource.NaturalDuration.TimeSpan;
|
||||
}
|
||||
|
||||
public void InitializeContols()
|
||||
{
|
||||
videoSource.Volume = SettingsStorage.Volume;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ResourceDictionary
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:FoxTube"
|
||||
@@ -533,7 +533,7 @@
|
||||
<Button x:Name="compactClose" VerticalAlignment="Top" HorizontalAlignment="Right">
|
||||
<FontIcon Glyph=""/>
|
||||
</Button>
|
||||
<Button Height="32" Width="50" Margin="0,0,48,0" VerticalAlignment="Top" HorizontalAlignment="Right" FontFamily="Segoe MDL2 Assets" Content="" IsHitTestVisible="False" x:Name="dragholder"/>
|
||||
<Button Height="32" Width="50" Margin="0,0,48,0" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="" IsHitTestVisible="False" x:Name="dragholder"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="centralStack"/>
|
||||
|
||||
@@ -574,9 +574,12 @@
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
<Button x:Name="goLive" Width="NaN" Visibility="Collapsed">
|
||||
<TextBlock Text="🔴 LIVE"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Column="1" Margin="10,5">
|
||||
<Grid Grid.Column="1" Margin="10,5" x:Name="sliderPan">
|
||||
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Left" x:Name="TimeElapsedElement" Text="00:00"/>
|
||||
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Right" x:Name="TimeRemainingElement" Text="00:00"/>
|
||||
<Grid VerticalAlignment="Top" Height="4" Margin="0,15,0,0">
|
||||
|
||||
Reference in New Issue
Block a user