本文整理汇总了C#中MediaPlayerLauncher类的典型用法代码示例。如果您正苦于以下问题:C# MediaPlayerLauncher类的具体用法?C# MediaPlayerLauncher怎么用?C# MediaPlayerLauncher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaPlayerLauncher类属于命名空间,在下文中一共展示了MediaPlayerLauncher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: play
private void play(string url)
{
this.mediaPlayer = new MediaPlayerLauncher();
Uri uri = new Uri(url, UriKind.RelativeOrAbsolute);
if (uri.IsAbsoluteUri)
{
this.mediaPlayer.Media = uri;
}
else
{
using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isoFile.FileExists(url))
{
this.mediaPlayer.Location = MediaLocationType.Data;
this.mediaPlayer.Media = uri;
}
else
{
throw new ArgumentException("Media location doesn't exists.");
}
}
}
this.mediaPlayer.Show();
}
示例2: Navigate
public void Navigate()
{
bool noVideoFileUri = this.VideoFileUri == null || string.IsNullOrWhiteSpace(this.VideoFileUri.ToString());
#if !WINDOWS_PHONE
if (noVideoFileUri)
{
Windows.System.Launcher.LaunchUriAsync(this.VideoUri);
}
else
{
Windows.System.Launcher.LaunchUriAsync(this.VideoFileUri);
}
#else
if (this.VideoFileUri != null && !string.IsNullOrEmpty(this.VideoFileUri.ToString()))
{
var launcher = new MediaPlayerLauncher
{
Controls = MediaPlaybackControls.All,
Media = this.VideoFileUri
};
launcher.Show();
}
else
{
WebBrowserTask browser = new WebBrowserTask();
browser.URL = this.VideoUri.ToString();
browser.Show();
}
#endif
}
示例3: ButtonPlay_Click
private async void ButtonPlay_Click(object sender, RoutedEventArgs e)
{
try
{
LiveOperationResult operationResult = await this.liveClient.GetAsync(this.id);
dynamic properties = operationResult.Result;
if (properties.source != null)
{
var launcher = new MediaPlayerLauncher()
{
Media = new Uri(properties.source, UriKind.Absolute),
Controls = MediaPlaybackControls.All
};
launcher.Show();
}
else
{
this.ShowError("Could not find the 'source' attribute.");
}
}
catch (LiveConnectException exception)
{
this.ShowError(exception.Message);
}
}
示例4: LaunchVideoFromWeb_Click
private void LaunchVideoFromWeb_Click(object sender, EventArgs e)
{
var task = new MediaPlayerLauncher();
task.Location = MediaLocationType.None;
task.Media = new Uri("http://www.windowsphoneinaction.com/sample.wmv");
task.Show();
}
示例5: LaunchVideoFromInstall_Click
// Sample code for building a localized ApplicationBar
//private void BuildLocalizedApplicationBar()
//{
// // Set the page's ApplicationBar to a new instance of ApplicationBar.
// ApplicationBar = new ApplicationBar();
// // Create a new button and set the text value to the localized string from AppResources.
// ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
// appBarButton.Text = AppResources.AppBarButtonText;
// ApplicationBar.Buttons.Add(appBarButton);
// // Create a new menu item with the localized string from AppResources.
// ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
// ApplicationBar.MenuItems.Add(appBarMenuItem);
//}
private void LaunchVideoFromInstall_Click(object sender, EventArgs e)
{
var task = new MediaPlayerLauncher();
task.Location = MediaLocationType.Install;
task.Media = new Uri("Assets/sample.wmv", UriKind.Relative);
task.Show();
}
示例6: button1_Click
private void button1_Click(object sender, RoutedEventArgs e)
{
String parameter = PageTitle.Text;
if (parameter.Contains(".txt"))
{
NavigationService.Navigate(new Uri(string.Format("/text.xaml?parameter={0}", parameter), UriKind.Relative));
}
else
{
if (parameter.Contains(".wmv"))
{
//NavigationService.Navigate(new Uri(string.Format("/video_play.xaml?parameter={0}", parameter), UriKind.Relative));
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
mediaPlayerLauncher.Media = new Uri("MyFolder\\" + parameter, UriKind.Relative);
//replace "gags" with your file path.
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Controls = MediaPlaybackControls.All;
mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
mediaPlayerLauncher.Show();
}
else
{
NavigationService.Navigate(new Uri(string.Format("/video_image.xaml?parameter={0}", parameter), UriKind.Relative));
}
}
}
示例7: StartAudioPlayback
public void StartAudioPlayback(string AudioFilePath)
{
MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher();
objMediaPlayerLauncher.Media = new Uri(AudioFilePath, UriKind.Relative);
objMediaPlayerLauncher.Location = MediaLocationType.Install;
objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All;
objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
objMediaPlayerLauncher.Show();
}
示例8: play_Click
private void play_Click(object sender, EventArgs e)
{
var task = new MediaPlayerLauncher
{
Location = MediaLocationType.Data,
Media = new Uri("video-recording.mp4", UriKind.Relative),
};
task.Show();
}
示例9: Psalm_137
private void Psalm_137(object sender, RoutedEventArgs e)
{
MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher();
objMediaPlayerLauncher.Media = new Uri("/AgpeyaHyms/Colimpine/-------------.mp3", UriKind.Relative);
objMediaPlayerLauncher.Location = MediaLocationType.Install;
objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All;
objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
objMediaPlayerLauncher.Show();
}
示例10: btnPlayVideo_Click
private void btnPlayVideo_Click(object sender, RoutedEventArgs e)
{
MediaPlayerLauncher mediaPlayerLauncher =
new MediaPlayerLauncher();
mediaPlayerLauncher.Location =
MediaLocationType.Install; //means is a resource of the app, otherwise it will try to resolve it in Data (IsolatedStorage) for application
mediaPlayerLauncher.Media = new Uri("Media/Bear.wmv", UriKind.Relative);
mediaPlayerLauncher.Show();
}
示例11: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher();
objMediaPlayerLauncher.Media = new Uri("AgpeyaHyms/Sext/--------------", UriKind.Relative);
objMediaPlayerLauncher.Location = MediaLocationType.Install;
objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All;
objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
objMediaPlayerLauncher.Show();
}
示例12: video_play
public video_play()
{
InitializeComponent();
mediaPlayerLauncher= new MediaPlayerLauncher();
//replace "gags" with your file path.
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Controls = MediaPlaybackControls.All;
mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
示例13: OnNavigated
private void OnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
string url = e.Uri.OriginalString;
if (PhoneHelper.IsMedia(url))
{
MediaPlayerLauncher launcher = new MediaPlayerLauncher();
launcher.Media = new Uri(url, UriKind.RelativeOrAbsolute);
launcher.Show();
}
this.loader.Stop();
this.browser.Visibility = Visibility.Visible;
}
示例14: m_DownloadStringCompleted
private void m_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
{
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
mediaPlayerLauncher.Media = new Uri(e.Result.Split(new string[] { "<source src=\"" }, StringSplitOptions.None)[1].Replace('"', '?'), UriKind.Absolute);
mediaPlayerLauncher.Controls = MediaPlaybackControls.All;
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
mediaPlayerLauncher.Show();
}
catch { MessageBox.Show("Сейчас это кино не доступно для просмотра.", "Извините!", MessageBoxButton.OK); }
}
示例15: btnPlayVideo_Click
private void btnPlayVideo_Click(object sender, RoutedEventArgs e)
{
MediaPlayerLauncher mpLauncher = new MediaPlayerLauncher();
if (chkUseExternalMedia.IsChecked.Value)
{
MessageBox.Show("Connecting to external video:\n" + _videoUrl);
mpLauncher.Media = new Uri(_videoUrl, UriKind.Absolute);
}
else
{
mpLauncher.Location = MediaLocationType.Install;
mpLauncher.Media = new Uri("Assets/video1.wmv", UriKind.Relative);
}
mpLauncher.Show();
}