Exemple #1
0
        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);
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            // 轉換參數爲 DialReceiverActivatedEventArgs
            DialReceiverActivatedEventArgs args = e.Parameter as DialReceiverActivatedEventArgs;

            if (args == null)
            {
                txtArgument.Text = "not from dial sender.";
            }
            else
            {
                txtArgument.Text = args.Arguments;
            }
        }
        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);
            }
        }
Exemple #4
0
 protected virtual Task HandleActivation(DialReceiverActivatedEventArgs args)
 {
     return(Task.CompletedTask);
 }