あなたのスナップショットに基づいて、あなたはこのような解決策を見つけるように見える:
A music player app that lets users see what's playing while browsing through a list of other available music.
私の理解が正しければ、あなたはCoreApplication.CreateNewView()
を利用することができます。 NewWindowPage.xaml
<MediaElement Name="newMedia"/>
でMainPage.xamlを
で
<Button Content="Select media file" Click="Button_Click_1"/>
<Button Content="PlayInNewWindow" Click="Button_Click" />
MainPage.xaml.csで
public static IRandomAccessStream stream = null;
public StorageFile file = null;
public async void GetMedia()
{
var openPicker = new FileOpenPicker();
openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
openPicker.FileTypeFilter.Add(".wmv");
openPicker.FileTypeFilter.Add(".mp4");
file = await openPicker.PickSingleFileAsync();
stream = await file.OpenAsync(FileAccessMode.Read);
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
CoreApplicationView newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
Frame frame = new Frame();
MediaData mediaData = new MediaData();
mediaData.stream = stream;
mediaData.file = file;
frame.Navigate(typeof(NewWindowPage), mediaData);
Window.Current.Content = frame;
Window.Current.Activate();
newViewId = ApplicationView.GetForCurrentView().Id;
});
bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
GetMedia();
}
:ここ
とは、サンプルコードですNewWindowPage.xaでml.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var mediaData = (MediaData)e.Parameter;
newMedia.SetSource(mediaData.stream, mediaData.file.ContentType);
newMedia.Play();
}
MediaDataクラス:
public class MediaData
{
public IRandomAccessStream stream { get; set; }
public StorageFile file { get; set; }
}
ありがとう、それは動作します。私はWindows 10のIOTをオペレーティングシステムとして使用するRaspberry Pi 3でテストしました。ビデオの選択にバグがあり、ラズベリーでビデオをアップロードするための他のプロトコルがあります。 –