-
Notifications
You must be signed in to change notification settings - Fork 492
Expand file tree
/
Copy pathMediaElementMultipleWindowsPage.cs
More file actions
45 lines (39 loc) · 1.26 KB
/
MediaElementMultipleWindowsPage.cs
File metadata and controls
45 lines (39 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Markup;
using CommunityToolkit.Maui.Sample.Constants;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
using CommunityToolkit.Maui.Views;
namespace CommunityToolkit.Maui.Sample.Pages.Views;
public partial class MediaElementMultipleWindowsPage : BasePage<MediaElementMultipleWindowsViewModel>
{
const string buckBunnyMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
const string elephantsDreamMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4";
readonly Window? secondWindow;
public MediaElementMultipleWindowsPage(MediaElementMultipleWindowsViewModel viewModel) : base(viewModel)
{
secondWindow = new Window(new ContentPage
{
Content = new MediaElement
{
AndroidViewType= AndroidViewType.SurfaceView,
Source = StreamingVideoUrls.ElephantsDream,
ShouldAutoPlay = true
}
});
Content = new MediaElement
{
AndroidViewType= AndroidViewType.SurfaceView,
Source = StreamingVideoUrls.BuckBunny,
ShouldAutoPlay = true
};
}
protected override void OnAppearing()
{
base.OnAppearing();
if(secondWindow is null)
{
return;
}
Application.Current?.OpenWindow(secondWindow);
}
}