本文整理汇总了C#中MediaPlayerLauncher类的典型用法代码示例。如果您正苦于以下问题:C# MediaPlayerLauncher类的具体用法?C# MediaPlayerLauncher怎么用?C# MediaPlayerLauncher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaPlayerLauncher类属于命名空间,在下文中一共展示了MediaPlayerLauncher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:redsen171ehs,项目名称:phonegap-plugins,代码行数:28,代码来源:VideoPlayer.cs
示例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
}
开发者ID:ramhemasri,项目名称:Pusher,代码行数:32,代码来源:VideoItem.cs
示例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);
}
}
开发者ID:harunpehlivan,项目名称:LiveSDK-for-Windows,代码行数:26,代码来源:PlayAudio.xaml.cs
示例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();
}
开发者ID:timothybinkley,项目名称:Windows-Phone-8-In-Action,代码行数:7,代码来源:MainPage.xaml.cs
示例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();
}
开发者ID:timothybinkley,项目名称:Windows-Phone-8-In-Action,代码行数:20,代码来源:MainPage.xaml.cs
示例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));
}
}
}
开发者ID:sauravmahajan,项目名称:CDN-WindowsApp,代码行数:27,代码来源:file_info.xaml.cs
示例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();
}
开发者ID:rsatter,项目名称:MonoCross,代码行数:9,代码来源:VideoPlayer.cs
示例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();
}
开发者ID:shreedharcva,项目名称:Windows-Phone-7-In-Action,代码行数:9,代码来源:MainPage.xaml.cs
示例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();
}
开发者ID:btsmarco,项目名称:TheAgpeya,代码行数:9,代码来源:Compline.xaml.cs
示例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();
}
开发者ID:WindowsPhone-8-TrainingKit,项目名称:HOL-Launchers,代码行数:9,代码来源:VideoPlayerPage.xaml.cs
示例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();
}
开发者ID:btsmarco,项目名称:TheAgpeya,代码行数:10,代码来源:Sext.xaml.cs
示例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);
}
开发者ID:sauravmahajan,项目名称:CDN-WindowsApp,代码行数:12,代码来源:video_play.xaml.cs
示例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;
}
开发者ID:anytao,项目名称:ModernReader,代码行数:13,代码来源:OkrBrowser.xaml.cs
示例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); }
}
开发者ID:pakrom,项目名称:windows-phone,代码行数:14,代码来源:Video.xaml.cs
示例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();
}
开发者ID:JackieWang,项目名称:Exercise.WP7,代码行数:16,代码来源:VideoPlayerPage.xaml.cs
示例16: Play_Button_Click
private void Play_Button_Click (object sender, GestureEventArgs e)
{
if (null != _recordingListBox.SelectedItem)
{
try
{
var mediaPlayerLauncher = new MediaPlayerLauncher ();
mediaPlayerLauncher.Media = new Uri ((_recordingListBox.SelectedItem as Recording).Name + ".wav", UriKind.Relative);
_recordingListBox.SelectedIndex = -1;
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Controls = MediaPlaybackControls.All;
mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
mediaPlayerLauncher.Show ();
}
catch
{
}
}
}
开发者ID:harishasan,项目名称:Circular-Recorder,代码行数:19,代码来源:Playback.xaml.cs
示例17: show
public void show(string options)
{
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
string url = args[0];
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
mediaPlayerLauncher.Media = new Uri(url, UriKind.RelativeOrAbsolute);
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop;
mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
mediaPlayerLauncher.Show();
});
}
开发者ID:jppradhan,项目名称:cordova.plugin.video.player,代码行数:20,代码来源:VideoPlayer.cs
示例18: play
/// <summary>
/// Opens specified file in media player
/// </summary>
/// <param name="options">MediaFile to play</param>
public void play(string options)
{
try
{
MediaFile file;
try
{
file = String.IsNullOrEmpty(options) ? null : JSON.JsonHelper.Deserialize<MediaFile>(options);
}
catch (Exception ex)
{
this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
return;
}
if (file == null || String.IsNullOrEmpty(file.FilePath))
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "File path is missing"));
return;
}
// if url starts with '/' media player throws FileNotFound exception
Uri fileUri = new Uri(file.FilePath.TrimStart(new char[] { '/', '\\' }), UriKind.Relative);
MediaPlayerLauncher player = new MediaPlayerLauncher();
player.Media = fileUri;
player.Location = MediaLocationType.Data;
player.Show();
this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
}
catch (Exception e)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
}
}
开发者ID:rknalakurthi,项目名称:phonegap,代码行数:43,代码来源:Capture.cs
示例19: OnClicked
private void OnClicked(object sender, RoutedEventArgs args)
{
if (VideoSource != null && NavigationState.TryBeginNavigating())
{
var player = new MediaPlayerLauncher
{
Controls = MediaPlaybackControls.All,
Media = VideoSource
};
player.Show();
}
}
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:12,代码来源:VideoButton.xaml.cs
示例20: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string newparameter = this.NavigationContext.QueryString["parameter"];
PageTitle.Text = newparameter;
if (newparameter.Contains("wmv"))
{
MediaPlayerLauncher objMPlayerLauncher = new MediaPlayerLauncher();
objMPlayerLauncher.Media = new Uri("MyFolder\\" + newparameter, UriKind.Relative);
//replace "gags" with your file path.
objMPlayerLauncher.Location = MediaLocationType.Data;
objMPlayerLauncher.Controls = MediaPlaybackControls.All;
objMPlayerLauncher.Show();
}
else
{
// Read the entire image in one go into a byte array
byte[] data;
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
// Open the file - error handling omitted for brevity
// Note: If the image does not exist in isolated storage the following exception will be generated:
// System.IO.IsolatedStorage.IsolatedStorageException was unhandled
// Message=Operation not permitted on IsolatedStorageFileStream
//string newparameter = this.NavigationContext.QueryString["parameter"];
using (IsolatedStorageFileStream isfs = isf.OpenFile("MyFolder\\" + newparameter, FileMode.Open, FileAccess.Read))
{
// Allocate an array large enough for the entire file
data = new byte[isfs.Length];
// Read the entire file and then close it
isfs.Read(data, 0, data.Length);
isfs.Close();
}
}
// Create memory stream and bitmap
MemoryStream ms = new MemoryStream(data);
BitmapImage bi = new BitmapImage();
// Set bitmap source to memory stream
bi.SetSource(ms);
// Create an image UI element – Note: this could be declared in the XAML instead
Image image = new Image();
// Set size of image to bitmap size for this demonstration
image.Height = System.Windows.Application.Current.Host.Content.ActualHeight;
image.Width = System.Windows.Application.Current.Host.Content.ActualWidth;
// Assign the bitmap image to the image’s source
image.Source = bi;
// Add the image to the grid in order to display the bit map
ContentPanel.Children.Add(image);
}
}
开发者ID:sauravmahajan,项目名称:CDN-WindowsApp,代码行数:92,代码来源:video_image.xaml.cs
注:本文中的MediaPlayerLauncher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论