Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gallery][Wasm] MediaPlayerElement, [X] Close button does not work for customizable option once click on the last sample option. #784

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using MediaPlayerLocal = Windows.Media.Playback.MediaPlayer;
using System;
using System.Collections.Generic;
using Windows.Foundation.Metadata;
using Windows.Media.Core;
using Windows.Media.Playback;
using Microsoft.UI.Xaml;
Expand All @@ -19,16 +21,28 @@ public MediaPlayerElementSample_NestedPage5()

private void InitializePlaybackList()
{
var mediaPlaybackList = new MediaPlaybackList();

if (ApiInformation.IsPropertyPresent("Windows.Media.Playback.MediaPlaybackList", "Items"))
{
#pragma warning disable Uno0001 // Uno type or member is not implemented
var mediaPlaybackList = new MediaPlaybackList();
mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/videos/Mobile_Development_in_VS_Code_with_Uno_Platform_orDotNetMAUI.mp4"))));
mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/audio/Getting_Started_with_Uno_Platform_and_Visual_Studio_Code.mp3"))));
mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/videos/Getting_Started_with_Uno_Platform_and_Visual_Studio_Code.mp4"))));
#pragma warning restore Uno0001 // Uno type or member is not implemented

mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/videos/Mobile_Development_in_VS_Code_with_Uno_Platform_orDotNetMAUI.mp4"))));
mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/audio/Getting_Started_with_Uno_Platform_and_Visual_Studio_Code.mp3"))));
mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/videos/Getting_Started_with_Uno_Platform_and_Visual_Studio_Code.mp4"))));

MediaPlayerElementSample5.MediaPlayer.Source = mediaPlaybackList;
MediaPlayerElementSample5.MediaPlayer.Source = mediaPlaybackList;
}
else
{
if (MediaPlayerElementSample5.MediaPlayer == null)
{
MediaPlayerElementSample5.SetMediaPlayer(new MediaPlayerLocal());
}
MediaPlayerElementSample5.Source = MediaSource.CreateFromUri(new Uri("https://uno-assets.platform.uno/tests/videos/Mobile_Development_in_VS_Code_with_Uno_Platform_orDotNetMAUI.mp4"));
}
}


private void NavigateBack(object sender, RoutedEventArgs e)
{
MediaPlayerElementSample5.MediaPlayer.Pause();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<local:SamplePageLayout>
<local:SamplePageLayout x:Name="LocalSamplePageLayout">
<local:SamplePageLayout.FluentTemplate>
<DataTemplate>
<StackPanel>
Expand Down Expand Up @@ -40,10 +40,12 @@
Click="LaunchMediaPlayerElementSample4"
Style="{StaticResource FilledButtonStyle}" />

<TextBlock Text="MediaPlayerElement sample using a Playlist"
Style="{StaticResource TitleLarge}"
Margin="0,16" />
<Button Content="Show sample"
<TextBlock Name="LaunchMediaPlayerElementSampleTextBlock5"
Text="MediaPlayerElement sample using a Playlist"
Style="{StaticResource TitleLarge}"
Margin="0,16" />
<Button Name="LaunchMediaPlayerElementSampleButton5"
Content="Show sample"
Click="LaunchMediaPlayerElementSample5"
Style="{StaticResource FilledButtonStyle}" />
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Uno.Gallery.Views.NestedPages;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml;
using Windows.Foundation.Metadata;

namespace Uno.Gallery.Views.Samples
{
Expand All @@ -10,6 +11,22 @@ public sealed partial class MediaPlayerElementSamplePage : Page
public MediaPlayerElementSamplePage()
{
this.InitializeComponent();
Loaded += MediaPlayerElementSamplePage_Loaded;
}

private void MediaPlayerElementSamplePage_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (!ApiInformation.IsPropertyPresent("Windows.Media.Playback.MediaPlaybackList", "Items"))
{
Button buttonSampleButton5 = (Button)LocalSamplePageLayout.FindName("LaunchMediaPlayerElementSampleButton5");
TextBlock textBlockSampleButton5 = (TextBlock)LocalSamplePageLayout.FindName("LaunchMediaPlayerElementSampleTextBlock5");
if (buttonSampleButton5 != null && textBlockSampleButton5 != null)
{
buttonSampleButton5.Visibility = Visibility.Collapsed;
textBlockSampleButton5.Visibility = Visibility.Collapsed;
}
}

}

private void LaunchMediaPlayerElementSample1(object sender, RoutedEventArgs e)
Expand Down
3 changes: 3 additions & 0 deletions Uno.Gallery/Uno.Gallery.Skia.Gtk/Uno.Gallery.Skia.Gtk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<PackageReference Include="SkiaSharp.Skottie" Version="2.88.3" />
<PackageReference Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.3" />
<PackageReference Include="Uno.WinUI.Svg" Version="5.0.0-dev.1728" />
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.18" />
<PackageReference Include="Uno.WinUI.MediaPlayer.Skia.Gtk" Version="5.0.0-dev.1148" />

</ItemGroup>

<Import Project="..\Uno.Gallery.Shared\Uno.Gallery.Shared.projitems" Label="Shared" />
Expand Down