public void open(string options) { //Options: [".\/89uqlqyms.avi","image\/png","FileOpener21439379467"] string mime = null; string path = null; string id = null; Debug.WriteLine("Options: " + options); try { string[] optionStrings = JSON.JsonHelper.Deserialize <string[]>(options); path = optionStrings[0]; mime = optionStrings[1]; id = optionStrings[2]; } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); return; } MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher(); objMediaPlayerLauncher.Media = new Uri(path.Replace("./", ""), UriKind.Relative); objMediaPlayerLauncher.Location = MediaLocationType.Data; objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All; objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; objMediaPlayerLauncher.Show(); }
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); } }
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(); }
private void btnMediaPlayerLauncher_Click(object sender, RoutedEventArgs e) { MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new Uri(txtUrl.Text); player.Show(); }
private void btnMediaPlayerLauncher_Click(object sender, RoutedEventArgs e) { MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new Uri("http://203.162.16.22:8081/movies/Video/disk1/video-raw-cp-10095/62f2546474adf9645bbfe1754db87398.mp4?sessionID=wWkenMtA&user_id=146&payment_value=0&payment_item_id=17710&des_user_id=null&ipaddress=113.190.240.238"); player.Show(); }
private void LaunchVideoFromStorage_Click(object sender, EventArgs e) { var task = new MediaPlayerLauncher(); task.Media = new Uri("sample.wmv", UriKind.Relative); task.Show(); }
public static HttpResponse Play(string youTubeId, YouTubeQuality maxQuality = YouTubeQuality.Quality480P, Action<Exception> completed = null) { return GetVideoUri(youTubeId, maxQuality, (entry, e) => { if (e != null) { if (completed != null) completed(e); } else { if (completed != null) completed(null); if (entry != null) { var launcher = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Media = entry.Uri }; launcher.Show(); } } }); }
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)); } } }
/// <summary> /// Launches the disk item. /// </summary> /// <param name="item">The disk item.</param> private void LaunchItem(DiskItemInfo item) { if (item.ContentType.ToLower().Contains("audio/") || item.ContentType.ToLower().Contains("video/")) { var mediaLauncher = new MediaPlayerLauncher(); mediaLauncher.Media = new Uri(item.OriginalDisplayName, UriKind.Relative); mediaLauncher.Location = MediaLocationType.Data; mediaLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop; try { mediaLauncher.Show(); } catch (Exception ex) { this.Dispatcher.BeginInvoke(() => MessageBox.Show(ex.Message)); } } else if (item.ContentType.ToLower().Contains("text/") || item.ContentType.ToLower().Contains("image/")) { this.NavigationService.Navigate(new Uri("/ImageViewer.xaml?path=" + Uri.EscapeDataString(item.OriginalDisplayName), UriKind.Relative)); } else { this.Dispatcher.BeginInvoke(() => MessageBox.Show("Error: unknown file format")); } }
private void ProcessTransfer(BackgroundTransferRequest request) { switch (request.TransferStatus) { case TransferStatus.Completed: if (request.StatusCode == 200 || request.StatusCode == 206) { Status.Text = "Abgeschlossen"; // Download fertig - Transfer-Obhjekt entfernen RemoveTransferRequest(request); // AppBar-Buttons aktualisieren DeleteButton.IsEnabled = true; DownloadButton.IsEnabled = false; // Video abspielen string sourcePath = request.DownloadLocation.OriginalString.Substring(1); var player = new MediaPlayerLauncher(); player.Location = MediaLocationType.Data; player.Media = new Uri(sourcePath, UriKind.Relative); player.Orientation = MediaPlayerOrientation.Landscape; player.Show(); } break; default: Status.Text = request.TransferStatus.ToString(); DeleteButton.IsEnabled = true; DownloadButton.IsEnabled = false; break; } }
public void ShowVideo(string url) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(url, UriKind.Absolute); mediaPlayerLauncher.Show(); }
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 }
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); } }
private void parseJSONGetURL(string jsonGetURL) { try { var URLJSONObj = JsonConvert.DeserializeObject <URLObject>(jsonGetURL); if (URLJSONObj.success == true) { String video_url = URLJSONObj.url; if (video_url != null && !video_url.Equals("")) { MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new Uri(video_url); player.Show(); } else { MessageBox.Show("File MP4 được gửi từ Server bị lỗi !"); } } else { disableProgressIndicator(); MessageBox.Show("Bạn không đủ tiền để xem nội dung này !"); } disableProgressIndicator(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
// 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(); }
// 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(); }
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(); }
private void MediaPlayer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { MediaPlayerLauncher mpl = new MediaPlayerLauncher(); mpl.Controls = MediaPlaybackControls.All; mpl.Location = MediaLocationType.Install; mpl.Media = new Uri("video/DramaticChipmunk.mp4", UriKind.Relative); mpl.Show(); }
private void videoStreaming(PodcastEpisodeModel podcastEpisode) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(podcastEpisode.EpisodeDownloadUri, UriKind.Absolute); mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Show(); }
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(); }
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(); }
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(); }
private void videoPlayback(PodcastEpisodeModel episodeModel) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(episodeModel.EpisodeFile, UriKind.Relative); mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Show(); }
private void Psalm_136(object sender, RoutedEventArgs e) { MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher(); objMediaPlayerLauncher.Media = new Uri("/AgpeyaHyms/Colimpine/-----------", UriKind.Relative); objMediaPlayerLauncher.Location = MediaLocationType.Install; objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All; objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; objMediaPlayerLauncher.Show(); }
public void PlayPause(object arg) { if (_memo != null) { if (App.SettingsHelper.UseSystemPlayer) { MediaPlayerLauncher playerLauncher = new MediaPlayerLauncher(); playerLauncher.Controls = MediaPlaybackControls.FastForward | MediaPlaybackControls.Rewind | MediaPlaybackControls.Pause | MediaPlaybackControls.Stop; playerLauncher.Location = MediaLocationType.Data; playerLauncher.Media = new Uri(_memo.AudioFile, UriKind.RelativeOrAbsolute); playerLauncher.Orientation = MediaPlayerOrientation.Portrait; if (!_memo.IsPlayed) { _memo.IsPlayed = true; //Uow.Save(); } playerLauncher.Show(); } else { if (_instance.Track == null) { SetAudioTrack(_memo.AudioFile, _memo.Title); } if (!_instance.Track.Source.OriginalString.Contains(_memo.AudioFile)) { SetAudioTrack(_memo.AudioFile, _memo.Title); } if (_instance.PlayerState != PlayState.Playing) { _instance.Play(); if (!_memo.IsPlayed) { _memo.IsPlayed = true; Uow.MemoRepository.Update(_memo); //Uow.Save(); } } else { if (_instance.CanPause) { _instance.Pause(); } } } } }
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(); }
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(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher(); objMediaPlayerLauncher.Media = new Uri("AgpeyaHyms/Prime/001-Psalm1.mp3", UriKind.Relative); objMediaPlayerLauncher.Location = MediaLocationType.Install; objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All; objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; objMediaPlayerLauncher.Show(); }
public static void PlayFullScreen(string uri) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(uri, UriKind.Absolute); mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Show(); }
private async Task PlayVideo(BaseItemDto item, bool isResume = false) { Log.Info("Playing {0} [{1}]", item.Type, item.Name); #if WP8 if (!TrialHelper.Current.CanPlayVideo(item.Id)) { TrialHelper.Current.ShowTrialMessage("In trial mode you can only play one video per day. Please try this tomorrow or purchase the full version."); } else { if (SimpleIoc.Default.GetInstance <VideoPlayerViewModel>() != null) { Messenger.Default.Send(new NotificationMessage(item, isResume, Constants.Messages.PlayVideoItemMsg)); TrialHelper.Current.SetNewVideoItem(item.Id); _navService.NavigateTo(Constants.Pages.VideoPlayerView); } } #else var bounds = Application.Current.RootVisual.RenderSize; var query = new VideoStreamOptions { ItemId = item.Id, VideoCodec = VideoCodecs.Wmv, //OutputFileExtension = ".wmv", AudioCodec = AudioCodecs.Wma, VideoBitRate = 1000000, AudioBitRate = 128000, MaxAudioChannels = 2, MaxHeight = 480, // (int)bounds.Width, MaxWidth = 800 // (int)bounds.Height }; var url = _apiClient.GetVideoStreamUrl(query); System.Diagnostics.Debug.WriteLine(url); Log.Info(url); try { Log.Info("Telling the server about watching this video"); await _apiClient.ReportPlaybackStartAsync(item.Id, AuthenticationService.Current.LoggedInUser.Id, true, new List <string>()); } catch (HttpException ex) { Log.ErrorException("PlayMovieCommand", ex); } var mediaPlayerLauncher = new MediaPlayerLauncher { Orientation = MediaPlayerOrientation.Landscape, Media = new Uri(url, UriKind.Absolute), Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop, //Location = MediaLocationType.Data }; mediaPlayerLauncher.Show(); #endif }
private void parseJSONGetURL(string jsonGetURL) { try { var URLJSONObj = JsonConvert.DeserializeObject <URLObject>(jsonGetURL); if (URLJSONObj.success == true) { this.video_url = URLJSONObj.url; if (this.video_url != null && !this.video_url.Equals("")) { MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new Uri(this.video_url); player.Show(); } else { MessageBox.Show("File MP4 được gửi từ Server bị lỗi !"); } //disableProgressBar(); } else { disableProgressBar(); if (URLJSONObj.type != null && URLJSONObj.type.Equals(SystemParameter.ERROR_CODE_FROM_SERVER_NO_AUTHORIZED)) { //MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?"); if (MessageBox.Show("Chưa đăng nhập. Bạn có muốn đăng nhập vào hệ thống ?", "Thông Báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { (App.Current as App).navigation_tvod = "MAIN_PAGE"; disableProgressBar(); LoginActivity_V2 loginWindow = new LoginActivity_V2(); loginWindow.Show(); } } else { MessageBox.Show(URLJSONObj.type + ":" + URLJSONObj.reason); } if ((App.Current as App).user_name != null && (App.Current as App).password != null) { string cmsLogin = SystemParameter.REQUEST_LOGIN; cmsLogin = cmsLogin.Replace("%u", (App.Current as App).user_name); cmsLogin = cmsLogin.Replace("%p", (App.Current as App).password); clientURL = new WebClient(); clientURL.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_Login_getURL_DownloadStringCompleted); clientURL.DownloadStringAsync(new Uri(cmsLogin.ToString())); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void MediaPlayerLauncher_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Controls = MediaPlaybackControls.FastForward | MediaPlaybackControls.Pause | MediaPlaybackControls.Rewind | MediaPlaybackControls.Skip | MediaPlaybackControls.Stop; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Media = new Uri("http://ecn.channel9.msdn.com/o9/ch9/8/9/6/6/3/5/WP7Xbox_ch9.mp4"); mediaPlayerLauncher.Show(); }
public static void LaunchMediaPlayer(Uri uri) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = uri; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop; mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; mediaPlayerLauncher.Show(); }
private void PlayIntroVideo() { var mediaPlayerLauncher = new MediaPlayerLauncher { Media = new Uri("Assets/IntroVideo/intro.mp4", UriKind.Relative), Location = MediaLocationType.Install, Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop, Orientation = MediaPlayerOrientation.Landscape }; mediaPlayerLauncher.Show(); }
private void WatchLocally_OnClick(object sender, RoutedEventArgs e) { var mediaPlayerLauncher = new MediaPlayerLauncher { Media = new Uri(Uri.EscapeUriString(@"Assets/Videos/ShawnAchor.mp4"), UriKind.Relative), Location = MediaLocationType.Install, Controls = MediaPlaybackControls.All, Orientation = MediaPlayerOrientation.Landscape }; mediaPlayerLauncher.Show(); }
public static void PlayVideoFromStreamingAssets(string file) { var mediaPlayerLauncher = new MediaPlayerLauncher { Media = new Uri("Data/StreamingAssets/" + file, UriKind.RelativeOrAbsolute), Location = MediaLocationType.Install, Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop, Orientation = MediaPlayerOrientation.Landscape }; mediaPlayerLauncher.Show(); }
private void button3_Click(object sender, RoutedEventArgs e) { mediaElement1.Stop(); MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); //mediaPlayerLauncher.Media = new Uri("video.mp4", UriKind.Absolute); mediaPlayerLauncher.Media = new Uri(@"video.mp4", UriKind.Absolute); mediaPlayerLauncher.Show(); }
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; }
/// <summary>GoPlay</summary> /// <param name="url">URL</param> private void GoPlay(string url) { try { MediaPlayerLauncher task = new MediaPlayerLauncher(); task.Media = new Uri(url); task.Show(); } catch { // Do Nothing } }
// 播放录制的内容 private void btnPlay_Click(object sender, RoutedEventArgs e) { // 启动媒体播放器,播放录制的内容 MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); // new Uri("webabcdTest.mp4", UriKind.Relative) 结合 MediaLocationType.Data,则系统会先在应用程序存储的 Local 目录下找,找不到再到 Local/IsolatedStorage 目录下找 mediaPlayerLauncher.Media = new Uri(recordVideoFileName, UriKind.Relative); mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop; mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; mediaPlayerLauncher.Show(); }
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); } }
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; }
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(); }
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 { } } }
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(); }); }
private void ProcessTransfer(BackgroundTransferRequest request) { switch (request.TransferStatus) { case TransferStatus.Completed: if (request.StatusCode == 200 || request.StatusCode == 206) { Status.Text = "Abgeschlossen"; // Download fertig - Transfer-Obhjekt entfernen RemoveTransferRequest(request); // AppBar-Buttons aktualisieren DeleteButton.IsEnabled = true; DownloadButton.IsEnabled = false; // Video abspielen string sourcePath = request.DownloadLocation.OriginalString.Substring(1); var player = new MediaPlayerLauncher(); player.Location = MediaLocationType.Data; player.Media = new Uri(sourcePath, UriKind.Relative); player.Orientation = MediaPlayerOrientation.Landscape; player.Show(); } break; default: Status.Text = request.TransferStatus.ToString(); DeleteButton.IsEnabled = true; DownloadButton.IsEnabled = false; break; } }
private void startPlayback() { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(fileName, UriKind.Relative); mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Controls = MediaPlaybackControls.None; mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Portrait; mediaPlayerLauncher.Show(); }
/// <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)); } }
private void videoStreaming(PodcastEpisodeModel podcastEpisode) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(podcastEpisode.EpisodeDownloadUri, UriKind.Absolute); mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Show(); }
private void Button_Click_7(object sender, RoutedEventArgs e) { MediaPlayerLauncher media = new MediaPlayerLauncher(); media.Controls = MediaPlaybackControls.All; media.Location = MediaLocationType.Install; media.Media = new Uri("http://www.w3school.com.cn/i/song.mp3", UriKind.Absolute); media.Show(); }
private void WatchLocally_OnClick(object sender, RoutedEventArgs e) { var mediaPlayerLauncher = new MediaPlayerLauncher { Media = new Uri(Uri.EscapeUriString(@"Assets/Videos/ShawnAchor.mp4"), UriKind.Relative), Location = MediaLocationType.Install, Controls = MediaPlaybackControls.All, Orientation = MediaPlayerOrientation.Landscape }; mediaPlayerLauncher.Show(); }
/// <summary>Plays the YouTube video in the Windows Phone's external player. </summary> /// <param name="youTubeId">The YouTube ID</param> /// <param name="maxQuality">The maximum allowed video quality. </param> /// <param name="token">The cancellation token</param> /// <returns>Awaitable task. </returns> public static async Task PlayAsync(string youTubeId, YouTubeQuality maxQuality, CancellationToken token) { var uri = await GetVideoUriAsync(youTubeId, maxQuality, token); if (uri != null) { var launcher = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Media = uri.Uri }; launcher.Show(); } else throw new Exception("no_video_urls_found"); }
private void OnClicked(object sender, RoutedEventArgs args) { if (VideoSource != null) { PhoneApplication.CurrentPage.TryNavigate(() => { var player = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Media = VideoSource }; player.Show(); return true; }); } }
private void PlayVideoButtonClick(object sender, RoutedEventArgs e) { var video = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Orientation = MediaPlayerOrientation.Landscape, Media = new Uri(VideoUrl, UriKind.Absolute), Location = MediaLocationType.Install }; video.Show(); }
public static HttpResponse Play(string youTubeId, YouTubeQuality maxQuality = YouTubeQuality.Quality480P, Action<Exception> completed = null) { //Debug.WriteLine("GetVideoUri"); return GetVideoUri(youTubeId, maxQuality, (entry, e) => { if (e != null) { if (completed != null) completed(e); } else { if (completed != null) completed(null); if (entry != null) { var launcher = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Media = entry.Uri }; Debug.WriteLine("Media URL = " + entry.Uri); launcher.Show(); } } }); }
public void playPodcast(string parameters) { string[] args = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<string[]>(parameters); string js = ""; if (IsPlayingStation() || IsPlayingPodcast() || IsPlaying()) { js = ("var ev = document.createEvent('Events');ev.initEvent('appMobi.player.podcast.busy');document.dispatchEvent(ev);"); InvokeCustomScript(new ScriptCallback("eval", new string[] { js }), true); return; } if (parameters.Length < 1) { js = (string.Format("var ev = document.createEvent('Events');" + "ev.initEvent('appMobi.cache.picture.add',true,true);ev.success=false;" + "ev.filename='{0}';ev.message='{1}';document.dispatchEvent(ev);", "", "Wrong number of parameters")); InvokeCustomScript(new ScriptCallback("eval", new string[] { js }), true); return; } string strPodcastURL = HttpUtility.UrlDecode(args[0]); string fixedPodcastURL = ""; if (strPodcastURL.StartsWith("http://") == false) { //try to find on local system /*File podcast = new File(Activity.appDir(), strPodcastURL); if (podcast.exists()) { //rewrite url to use localhost //switch to Webview.rootDir instead of building manually StringBuilder rewrittenURL = new StringBuilder("http://localhost:58888/"); rewrittenURL.Append(Webview.appConfigData.appName); rewrittenURL.Append('/'); rewrittenURL.Append(Webview.appConfigData.releaseName); if (strPodcastURL.charAt(0) != '/') rewrittenURL.Append('/'); rewrittenURL.Append(strPodcastURL); fixedPodcastURL = rewrittenURL.ToString(); }*/ } else { fixedPodcastURL = strPodcastURL; } if (fixedPodcastURL == null) { js = ("var ev = document.createEvent('Events');ev.initEvent('appMobi.player.podcast.error',true,true);document.dispatchEvent(ev);"); InvokeCustomScript(new ScriptCallback("eval", new string[] { js }), true); return; } MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(fixedPodcastURL, UriKind.RelativeOrAbsolute); mediaPlayerLauncher.Location = MediaLocationType.Install; mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape; mediaPlayerLauncher.Show(); /* BackgroundAudioPlayer.Instance MediaStreamer mediaStreamer = MediaStreamerFactory.CreateMediaStreamer(123); MediaStreamSource mss = new MediaStreamSource();*/ //mss.SetVideoStream(sourceRGBA, 320, 240, "RGBA", 30 * TimeSpan.TicksPerSecond, false); //ms.SetSource(mss); // commented this out becasue shelling podcast out to native. don't know when it is stopped. //isPlayingPodcast = true; js = ("javascript:var ev = document.createEvent('Events');ev.initEvent('appMobi.player.podcast.start',true,true);document.dispatchEvent(ev);"); InvokeCustomScript(new ScriptCallback("eval", new string[] { js }), true); }
private void OnClicked(object sender, RoutedEventArgs args) { if (VideoSource != null && NavigationState.TryBeginNavigating()) { var player = new MediaPlayerLauncher { Controls = MediaPlaybackControls.All, Media = VideoSource }; player.Show(); } }
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); } }
void Browser_Navigating(object sender, NavigatingEventArgs e) { // Check for a special protocol. If there is, the browser control will handle it so don't show the progress bar. if (e.Uri.Scheme == "javascript") { return; } bool customProtocol = false; foreach (string s in launchProtocols) { if (e.Uri.OriginalString.StartsWith(s, StringComparison.OrdinalIgnoreCase)) { customProtocol = true; break; } } if (!customProtocol) // If there's no special protocol... { // Do a quick check for the common case - if there's no file extension in the URL... if (e.Uri.Segments.Length > 0) { // No file specified if (!e.Uri.Segments[e.Uri.Segments.Length - 1].Contains('.')) { // Browse and show the progress bar ShowOverlay(); } //else // Otherwise check for file types { bool handledExtension = false; // used when URL points to a common file type - skip the other checks bool mediaFileType = false; // used when URL points to a media file type - skip the other checks // Check for common extensions that can be handled in the browser control foreach (string s in bypassList) { if (e.Uri.OriginalString.EndsWith(s, StringComparison.OrdinalIgnoreCase)) { ShowOverlay(); handledExtension = true; break; } } if (!handledExtension) // Are we launching a media file? { foreach (string s in mediaExtensions) { if (e.Uri.LocalPath.EndsWith(s, StringComparison.OrdinalIgnoreCase)) { MediaPlayerLauncher MPL = new MediaPlayerLauncher(); MPL.Media = e.Uri; MPL.Show(); mediaFileType = true; e.Cancel = true; HideOverlay(); break; } } if (!mediaFileType) // If not, are we launching another type of file? { foreach (string s in launchExtensions) { if (e.Uri.OriginalString.EndsWith(s, StringComparison.OrdinalIgnoreCase)) { Windows.System.Launcher.LaunchUriAsync(e.Uri); // Launch the URI e.Cancel = true; HideOverlay(); break; } } } } } } } if (!e.Cancel) { // Bug in WP8 SL WebBrowser control, it does not escape URI string before passing to external apps registered to handle // non-http protocols. if (e.Uri.Scheme == "mailto" || e.Uri.Scheme == "tel") { if (e.Uri.Scheme == "tel" && (_nonHttpUri == null || _nonHttpUri.OriginalString != e.Uri.OriginalString)) { string trimmedUri = HttpUtility.UrlDecode(e.Uri.AbsoluteUri); trimmedUri = trimmedUri.Replace(" ", String.Empty); _nonHttpUri = new Uri(trimmedUri); e.Cancel = true; Browser.Navigate(_nonHttpUri); } HideOverlay(); } else { _currentUrl = e.Uri; } } }
private void videoPlayback(PodcastEpisodeModel episodeModel) { MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); mediaPlayerLauncher.Media = new Uri(episodeModel.EpisodeFile, UriKind.Relative); mediaPlayerLauncher.Controls = MediaPlaybackControls.All; mediaPlayerLauncher.Location = MediaLocationType.Data; mediaPlayerLauncher.Show(); }