protected override void OnNavigatedTo(NavigationEventArgs e) { rootPage = MainPage.Current; if (e.Parameter is DialReceiverActivatedEventArgs) { DialReceiverActivatedEventArgs activationArgs = (DialReceiverActivatedEventArgs)e.Parameter; //Parse the DIAL arguments from the activation arguments DialLaunchArguments dialArgs = DialLaunchArguments.Parse(activationArgs.Arguments); // Get the list of available Azure videos. AzureDataProvider dataProvider = new AzureDataProvider(); // Get the vide that is playing video = dataProvider.GetFromID(dialArgs.VideoId); //Subscribe to player events player.MediaOpened += Player_MediaOpened; player.MediaFailed += Player_MediaFailed; player.CurrentStateChanged += Player_CurrentStateChanged; //Set the source on the player rootPage.NotifyUser(string.Format("Opening '{0}'", video.Title), NotifyType.StatusMessage); this.player.Source = video.VideoLink; player.Position = dialArgs.Position; } else { rootPage.NotifyUser("Scenario was not activated using DIAL", NotifyType.ErrorMessage); } }
public Scenario01() { this.InitializeComponent(); rootPage = MainPage.Current; //Subscribe to player events player.MediaOpened += Player_MediaOpened; player.MediaFailed += Player_MediaFailed; player.CurrentStateChanged += Player_CurrentStateChanged; // Get an Azure hosted video AzureDataProvider dataProvider = new AzureDataProvider(); video = dataProvider.GetFromID("BigBuckBunnyTrailer"); this.player.Source = video.VideoLink; //Set the source on the MediaElement rootPage.NotifyUser(string.Format("Opening '{0}'", video.Title), NotifyType.StatusMessage); // Use the compat version of the transport controls this.player.TransportControls.IsCompact = true; //Start Playback player.Play(); }
public Scenario02() { this.InitializeComponent(); rootPage = MainPage.Current; //Subscribe to player events player.MediaOpened += Player_MediaOpened; player.MediaFailed += Player_MediaFailed; player.CurrentStateChanged += Player_CurrentStateChanged; // Get an Azure hosted video AzureDataProvider dataProvider = new AzureDataProvider(); video = dataProvider.GetFromID("BigBuckBunnyTrailer"); this.player.Source = video.VideoLink; //Set the source on the player rootPage.NotifyUser(string.Format("Opening '{0}'", video.Title), NotifyType.StatusMessage); player.Source = video.VideoLink; //Subscribe for the clicked event on the custom cast button ((MediaTransportControlsWithCustomCastButton)this.player.TransportControls).CastButtonClicked += TransportControls_CastButtonClicked; // Instantiate the Device Picker picker = new CastingDevicePicker(); // Generate the filter based on the content in the MediaElement picker.Filter.SupportedCastingSources.Add(player.GetAsCastingSource()); //Hook up device selected event picker.CastingDeviceSelected += Picker_CastingDeviceSelected; //Hook up device disconnected event picker.CastingDevicePickerDismissed += Picker_CastingDevicePickerDismissed; ////Set the Appearence of the picker /*picker.Appearance.BackgroundColor = Colors.Black; * picker.Appearance.ForegroundColor = Colors.White; * picker.Appearance.AccentColor = Colors.White; * picker.Appearance.SelectedAccentColor = Colors.White; * picker.Appearance.SelectedForegroundColor = Colors.White; * picker.Appearance.SelectedBackgroundColor = Colors.Black;*/ }
protected async override void OnNavigatedTo(NavigationEventArgs e) { rootPage = MainPage.Current; //Subscribe to player events player.MediaOpened += Player_MediaOpened; player.MediaFailed += Player_MediaFailed; player.CurrentStateChanged += Player_CurrentStateChanged; player.MediaEnded += Player_MediaEnded; if (e.Parameter is DialReceiverActivatedEventArgs) { DialReceiverActivatedEventArgs activationArgs = (DialReceiverActivatedEventArgs)e.Parameter; //Parse the DIAL arguments from the activation arguments DialLaunchArguments dialArgs = DialLaunchArguments.Parse(activationArgs.Arguments); // Get the list of available Azure videos. AzureDataProvider dataProvider = new AzureDataProvider(); // Get the vide that is playing video = dataProvider.GetFromID(dialArgs.VideoId); //Set the source on the player rootPage.NotifyUser(string.Format("Opening '{0}'", video.Title), NotifyType.StatusMessage); this.player.Source = video.VideoLink; this.LicenseText.Text = "License: " + video.License; player.Position = dialArgs.Position; } else { StorageFile localVideo = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/casting.mp4")); var stream = await localVideo.OpenAsync(FileAccessMode.Read); this.player.SetSource(stream, localVideo.FileType); } }