Inheritance: FrameworkElement, IMediaElement
Ejemplo n.º 1
0
        protected GameViewModel()
            : base()
        {
           CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                MediaPlayer = new MediaElement();
            });

            lock (locker)
            {
                if (StopwatchFile == null || AlarmFile == null)
                {
                    LoadFileTask = Task.Run(async () =>
                {
                    StorageFolder folder = await (await Package.Current.InstalledLocation.GetFolderAsync("Assets")).GetFolderAsync("Sounds");
                    StopwatchFile = await folder.GetFileAsync("Stopwatch.wav");
                    AlarmFile = await folder.GetFileAsync("Alarm.wav");
                    CheerFile = await folder.GetFileAsync("Cheer.wav");
                    AwwFile = await folder.GetFileAsync("Aww.wav");
                    VictoryFile = await folder.GetFileAsync("Victory.wav");

                    (await StopwatchFile.OpenAsync(FileAccessMode.Read)).AsStream().CopyTo(StopwatchStream);
                    (await AlarmFile.OpenAsync(FileAccessMode.Read)).AsStream().CopyTo(AlarmStream);
                    (await CheerFile.OpenAsync(FileAccessMode.Read)).AsStream().CopyTo(CheerStream);
                    (await AwwFile.OpenAsync(FileAccessMode.Read)).AsStream().CopyTo(AwwStream);
                    (await VictoryFile.OpenAsync(FileAccessMode.Read)).AsStream().CopyTo(VictoryStream);

                });
                }
            }
        }
        /// <summary>
        /// A view model class for the IndivReactive Scenario.
        /// </summary>
        public ProactiveViewModel(MediaElement mediaElement)
        {
            /// The ProtectionManager provides communication between the player and PlayReady DRM. 
            /// The helper class will configure the protection manager for PlayReady and assign an
            /// event handler for Service requests.
            this.ProtectionManager = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            mediaElement.ProtectionManager = this.ProtectionManager;
            /// The PlayReadyInfoViewModel is used in this sample app to show PlayReadyStatistics such as 
            /// SecurityLevel and hardware support within the UI.
            PlayReadyInfo = new PlayReadyInfoViewModel();
            PlayReadyInfo.RefreshStatics();            

            mediaElement.CurrentStateChanged += (s, a) => {
                ViewModelBase.Log("Media State::" + mediaElement.CurrentState);
            };

            mediaElement.MediaFailed += (s, a) => {
                ViewModelBase.Log("Media Failed::" + a.ErrorMessage);
            };

            /// Proactive license acqusition will ensure a license is available
            /// prior to playback
            CmdGetLicense = new RelayCommand(() => { GetLicense(new Guid(this.KeyId)); }, () => { return PlayReadyHelpers.IsIndividualized; });

            /// Play is enabled once a license is available
            CmdPlayMovie = new RelayCommand(() => { mediaElement.Source = new Uri(moviePath); SetPlaybackEnabled(true); }, 
                                            () => IsLicenseAvailable(new Guid(KeyId)));
            CmdStopMovie = new RelayCommand(() => { mediaElement.Stop(); SetPlaybackEnabled(false); }, 
                                            () => IsLicenseAvailable(new Guid(KeyId))); 

            /// Proactive individualization will ensure PlayReady have been configured
            /// to begin making license requests
            IndividualizeIfNeeded();
        }
Ejemplo n.º 3
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            progbar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("progbar");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
            PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
            itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
            mediaPlayer = (Windows.UI.Xaml.Controls.MediaElement)this.FindName("mediaPlayer");
            TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
            TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
            PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
            VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
            TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
            RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
        }
Ejemplo n.º 4
0
        public MainPage()
        {
            this.DataContext = App.s_bike;

            this.InitializeComponent();

            _speech = new SpeechSynthesizer();
            _audio  = new MediaElement();
            _audio.Volume = 1;

            
            App.s_bike.iFitLED = C7ZL.OnOff.On;

            App.s_bike.HeartRateChanged += m_bike_HeartRateChanged;
            App.s_bike.RpmChanged += m_bike_RpmChanged;
            App.s_bike.DifficultyChanged += m_bike_DifficultyChanged;

            App.s_bike.ButtonDownPressed += S_bike_ButtonDownPressed;
            App.s_bike.ButtonUpPressed += S_bike_ButtonUpPressed;

            App.s_bike.ButtonEnterPressed += S_bike_ButtonEnterPressed;

            App.s_bike.DialClickedClockwise += m_bike_DialClickedClockwise;
            App.s_bike.DialClickedAnticlockwise += m_bike_DialClickedAnticlockwise;

            tbDifficulty_value.Text = App.s_bike.Difficulty.ToString();


        }
Ejemplo n.º 5
0
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Frame> e)
    {
      base.OnElementChanged(e);
      if (Element == null)
        return;

      player = new MediaElement();
      player.AutoPlay = true;
      player.MediaOpened += (sender, args) =>
      {

        timer.Start();

      };
      this.Control.Child = player;

      timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) };
      timer.Tick += timer_Tick;

      if (string.IsNullOrWhiteSpace(Player.Url))
        return;

      InitPlayer();
      
    }
Ejemplo n.º 6
0
        /// <summary>
        /// have MediaElement defined in your XAML and pass it here
        /// </summary>
        /// <param name="_media"></param>
        public Speaker(MediaElement _media)
        {
            media = _media;
            media.MediaEnded += MediaElement_SpeakEnded;

            synthesizer = new SpeechSynthesizer();
        }
        private async void StartMediaElement()
        {
            // To use AudioCategory.BackgroundCapableMedia:
            // * OnWindows 8 set MediaControl.PlayPressed, MediaControl.PausePressed,
            //   MediaControl.PlayPauseTogglePressed and MediaControl.StopPressed.
            // * On Windows 8.1 set SystemMediaTransportControls.ButtonPressed.
            systemControls = SystemMediaTransportControls.GetForCurrentView();
            systemControls.ButtonPressed += OnButtonPressed;
            systemControls.IsPlayEnabled = true;
            systemControls.IsPauseEnabled = true;
            systemControls.PlaybackStatus = MediaPlaybackStatus.Playing;

            mediaPlayer = new MediaElement();
            mediaPlayer.AudioCategory = AudioCategory.BackgroundCapableMedia;
            mediaPlayer.AutoPlay = true;
            mediaPlayer.CurrentStateChanged += OnCurrentStateChanged;
            this.Content = mediaPlayer;

            HttpClient client = new HttpClient();

            // Add custom headers or credentials.
            client.DefaultRequestHeaders.Add("Foo", "Bar");

            //Uri uri = new Uri("http://localhost/song.mp3?slow=1000&?bufferlength=100000&lastModified=true");
            Uri uri = new Uri("http://video.ch9.ms/ch9/70cc/83e17e76-8be8-441b-b469-87cf0e6a70cc/ASPNETwithScottHunter_high.mp4");

            HttpRandomAccessStream stream = await HttpRandomAccessStream.CreateAsync(client, uri);

            // If you need to use HttpClient, use MediaElement.SetSource() instead of MediaElement.Source.
            mediaPlayer.SetSource(stream, stream.ContentType);
        }
Ejemplo n.º 8
0
        public async Task Play(Song a, MediaElement m)
        {
            if (Songs.Count != 0)
            {
                if (Songs.Contains(a))
                {
                    NowIndex = Songs.IndexOf(a);
                }
                else
                {
                    Songs.Add(a);
                    NowIndex = Songs.IndexOf(a);
                }
            }
            else
            {
                Songs.Add(a);
                NowIndex = 0;
            }
            await Task.Run(() =>
            {
                a.PlayOnce();
            });

            var stream = await a.AudioFile.OpenAsync(Windows.Storage.FileAccessMode.Read);
            m.SetSource(stream, a.AudioFile.ContentType);
            OnNotifyPlayBackEvent(a);
        }
Ejemplo n.º 9
0
        protected override async void OnNavigatedTo(NavigationEventArgs navArgs)
        {
            MakePinWebAPICall();

            try
            {
                //Create a new object for the color sensor class
                colorSensor = new TCS34725();
                //Initialize the sensor
                await colorSensor.Initialize();

                //Create a new SpeechSynthesizer
                synthesizer = new SpeechSynthesizer();

                //Create a new MediaElement
                audio = new MediaElement();

                //Initialize the GPIO pin for the pushbutton
                InitializeGpio();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
Ejemplo n.º 10
0
 public MediaElementOut(MediaElement mediaElement)
 {
     this.mediaElement = mediaElement;
     mediaElement.MediaFailed += mediaElement_MediaFailed;
     mediaElement.MediaOpened += MediaElementOnMediaOpened;
     mediaElement.CurrentStateChanged += MediaElementOnCurrentStateChanged;
 }
Ejemplo n.º 11
0
        public MainPage()
        {
            this.InitializeComponent();

            if (!CheckForInternetAccess())
            {
                string msg1 = "An Internet connection is required for this app and it appears that you are not connected." + Environment.NewLine + Environment.NewLine;
                string msg2 = "Make sure that you have an active Internet connection and try again.";
                UpdateStatus("You are not connected to the Internet", true);

                new MessageDialog(msg1 + msg2, "No Internet").ShowAsync();
            }
            else
            {
                InitNotificationsAsync();
            }
            mediaplayer = new MediaElement();

// On Windows, the Send button must be made visible since the Command Bar is not always
// visible and we don't want to force the user to swipe up every time they want to chat.
#if WINDOWS_APP
            btnWinSend.Visibility = Windows.UI.Xaml.Visibility.Visible;
            TextInput.Height = btnWinSend.Height;
#endif
        }
Ejemplo n.º 12
0
        public NowPlayingPageViewModel()
        {
            App.Current.Suspending += Current_Suspending;
            App.Current.Resuming += Current_Resuming;
            SongHistory = new ObservableCollection<ShoutcastSongHistoryItem>();

            mediaElement = ((App)App.Current).MediaElement;

            PlayCommand = CommandManager.CreateCommand(() =>
            {
                if (mediaElement != null)
                    if (mediaElement.CurrentState != MediaElementState.Playing)
                    {
                        mediaElement.Play();
                        MediaControl.IsPlaying = true;
                    }
            });

            PauseCommand = CommandManager.CreateCommand(() =>
                {
                    if (mediaElement != null)
                        if (mediaElement.CurrentState != MediaElementState.Paused)
                        {
                            mediaElement.Pause();
                            MediaControl.IsPlaying = false;
                        }
                });
        }
 public VolumeControl()
 {
     InitializeComponent();
     MediaPlayer = App.Main.MediaPlayer;
     CheckMuteState();
     CheckVolumeState();
 }
        /// <summary>
        /// Initialize VideoPlayer.
        /// </summary>
        private static void Initialize(VideoStretch stretch)
        {
#if NETFX_CORE

            if (_videoPopup == null)
            {
                _videoPopup = new Popup();
            }
            _videoPopup.VerticalOffset = 0;
            _videoPopup.HorizontalOffset = 0;

            if (_videoElement == null)
            {
                _videoElement = new MediaElement();
            }
            _videoPopup.Child = _videoElement;

            _videoElement.MediaEnded += _videoElement_MediaEnded;
            _videoElement.MediaOpened += _videoElement_MediaOpened;

            _videoPopup.Height = Window.Current.Bounds.Height;
            _videoPopup.Width = Window.Current.Bounds.Width;

            _videoElement.Tapped += _videoElement_Tapped;
            _videoElement.Stretch = (Stretch)stretch;

            _videoElement.AutoPlay = false;

            _videoElement.Height = _videoPopup.Height;
            _videoElement.Width = _videoPopup.Width;

            _videoPopup.IsOpen = true;
#endif
        }
Ejemplo n.º 15
0
        static public async Task StartTextToSpeech(string text)
        {
            if (!string.IsNullOrEmpty(text))
            {
                try
                {
                    if (_speech != null)
                    {
                        StopTextToSpeech();
                    }

                    var voice = GetSpeechVoice();
                    if (voice != null)
                    {
                        _speech = new SpeechSynthesizer();
                        _speech.Voice = voice;

                        SpeechSynthesisStream speechStream = await _speech.SynthesizeTextToStreamAsync(Utility.DecodeHtml(text));
                        _soundPlayer = new MediaElement();
                        _soundPlayer.SetSource(speechStream, speechStream.ContentType);
                        _soundPlayer.Play();
                    }
                }
                catch (Exception ex)
                {
                    AppLogs.WriteError("SpeechServices", ex);
                }
            }
        }
        /// <summary>
        /// A view model class for the ReactiveRequest Scenario.
        /// The ViewModel takes a UI MediaElement in the contructor to wire up commands and events to simplify the sample.
        /// Decoupling the MediaElement from the ViewModel would require addtional MVVM infrastucture.
        /// </summary>
        public ReactiveViewModel(MediaElement mediaElement)
        {

            /// The ProtectionManager provides communication between the player and PlayReady DRM. 
            /// The helper class will configure the protection manager for PlayReady and assign an
            /// event handler for Service requests.
            this.ProtectionManager = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            mediaElement.ProtectionManager = this.ProtectionManager;
            /// The PlayReadyInfoViewModel is used in this sample app to show PlayReadyStatistics such as 
            /// SecurityLevel and hardware support in the UI.
            PlayReadyInfo = new PlayReadyInfoViewModel();
            PlayReadyInfo.RefreshStatics();

            /// Reactive license acqusition will happen automatically when setting the source of 
            /// a MediaElement to protected content. 
            CmdPlayMovie = new RelayCommand( () => { mediaElement.Source = new Uri(moviePath); SetPlaybackEnabled(true); });
            /// The licenseUrl in the sample is set to return a non-peristent license. When there is a 
            /// hard Stop() on the playback, a new license will be requested on Play(). 
            CmdStopMovie = new RelayCommand(() => { mediaElement.Stop(); SetPlaybackEnabled(false); });

            mediaElement.CurrentStateChanged += (s, a) => {
                ViewModelBase.Log("Media State::" + mediaElement.CurrentState);
            };

            mediaElement.MediaFailed += (s, a) => {
                ViewModelBase.Log("Err::" + a.ErrorMessage);
            };
        }
 public async Task SetSourceAsync(MediaElement mediaElement, StorageFile file)
 {
     if (file != null)
     {
         mediaElement.Stop();
         mediaElement.SetPlaybackSource(MediaSource.CreateFromStorageFile(file));
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Initializes the singleton Application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            synth = new SpeechSynthesizer();
            media = new MediaElement();

        }
 public async Task GetMediaElement()
 {
     var element = new MediaElement();
     var elm = GetRandomElement();
     var stream = await elm.OpenAsync(FileAccessMode.Read);
     element.SetSource(stream, elm.ContentType);
     await PlayElement(element);
 }
Ejemplo n.º 20
0
        private void SetVideoPresenters()
        {
            var boolToVisConverter = new BooleanToVisibilityConverter();

#if WIN10
            var peerSwapChainPanel = new WebRTCSwapChainPanel.WebRTCSwapChainPanel();

            var peerHandleBinding = new Binding
            {
                Source = DataContext,
                Path = new PropertyPath("RemoteSwapChainPanelHandle"),
                Mode = BindingMode.OneWay
            };
            peerSwapChainPanel.SetBinding(
                WebRTCSwapChainPanel.WebRTCSwapChainPanel.SwapChainPanelHandleProperty,
                peerHandleBinding);

            PeerVideoPresenter.Content = peerSwapChainPanel;

            var selfSwapChainPanel = new WebRTCSwapChainPanel.WebRTCSwapChainPanel();

            var selfHandleBinding = new Binding
            {
                Source = DataContext,
                Path = new PropertyPath("LocalSwapChainPanelHandle"),
                Mode = BindingMode.OneWay
            };
            selfSwapChainPanel.SetBinding(
                WebRTCSwapChainPanel.WebRTCSwapChainPanel.SwapChainPanelHandleProperty,
                selfHandleBinding);

            var selfSizeBinding = new Binding
            {
                Source = DataContext,
                Path = new PropertyPath("LocalNativeVideoSize"),
            };
            selfSwapChainPanel.SetBinding(
                WebRTCSwapChainPanel.WebRTCSwapChainPanel.SizeProperty,
                selfSizeBinding);

            SelfVideoPresenter.Content = selfSwapChainPanel;
#endif

#if WIN81
            _peerMediaElement = new MediaElement
            {
                RealTimePlayback = true
            };
            PeerVideoPresenter.Content = _peerMediaElement;

            _selfMediaElement = new MediaElement
            {
                RealTimePlayback = true
            };
            SelfVideoPresenter.Content = _selfMediaElement;            
#endif
        }
        public async void Speak(string text)
        {
            var mediaElement = new Windows.UI.Xaml.Controls.MediaElement();
            var synth        = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
            var stream       = await synth.SynthesizeTextToStreamAsync(text);

            mediaElement.SetSource(stream, stream.ContentType);
            mediaElement.Play();
        }
Ejemplo n.º 22
0
 public count94()
 {
     this.InitializeComponent();
     this.navigationHelper = new NavigationHelper(this);
     this.navigationHelper.LoadState += navigationHelper_LoadState;
     this.navigationHelper.SaveState += navigationHelper_SaveState;
     synth = new SpeechSynthesizer();
     media = new MediaElement();
 }
Ejemplo n.º 23
0
 private async void SongsList_Tapped(object sender, TappedRoutedEventArgs e)
 {
     MediaElement PlayMusic = new MediaElement();
     var _list = SongsList as ListView;
     var _song = (StorageFile)_list.SelectedItem;
     var stream = await _song.OpenAsync(FileAccessMode.Read);
     PlayMusic.SetSource(stream, _song.ContentType);
     PlayMusic.Play();
 }
Ejemplo n.º 24
0
        // TODO: Add documentation.
        // TODO: Add logging.
        public TextSpeaker(ILogger logger, IApplicationSettingsHelper applicationSettingsHelper, IPlaybackManager playbackManager)
        {
            this.playbackManager = playbackManager;
            this.logger = logger;
            this.applicationSettingsHelper = applicationSettingsHelper;

            mediaElement = new MediaElement { Visibility = Visibility.Collapsed };
            attachMediElement();
        }
        public static void InitialiseSpeechSynthesis(MediaElement MediaElement)
        {
            // The media object for controlling and playing audio.
            mediaElement = MediaElement;

            // The object for controlling the speech synthesis engine (voice).
            synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();

        }
Ejemplo n.º 26
0
        public async void Speak(string text)
        {
            var mediaElement = new MediaElement();
            var synth = new SpeechSynthesizer();
            var stream = await synth.SynthesizeTextToStreamAsync(text);

            mediaElement.SetSource(stream, stream.ContentType);
            mediaElement.Play();
        }
Ejemplo n.º 27
0
    /// <summary>
    /// Initialization
    /// </summary>
    public void Init()
    {
      if(speechSynthesizer == null)
        speechSynthesizer = new SpeechSynthesizer();

#if NETFX_CORE
      if (element == null)
        element = new MediaElement();
#endif
    }
Ejemplo n.º 28
0
        private async void SpeakText(MediaElement audioPlayer, string textToSpeak)
        {

            using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
            {
                SpeechSynthesisStream ttsStream = await synthesizer.SynthesizeTextToStreamAsync(textToSpeak);
                audioPlayer.SetSource(ttsStream, ""); // This starts the player because AutoPlay="True"

            }
        }
Ejemplo n.º 29
0
 private async void Fortune_Text_Click(object sender, TappedRoutedEventArgs e)
 {
     MediaElement media = new MediaElement();
     string text = textBlockFortune.Text;
     SpeechSynthesizer synthesizer = new SpeechSynthesizer();
     SpeechSynthesisStream stream = await synthesizer.SynthesizeTextToStreamAsync(text + ", God bless America");
     media.SetSource(stream, stream.ContentType);
     media.IsLooping = true;
     media.Play();
 }
Ejemplo n.º 30
0
        public PPTVMediaPlayer()
        {
            this.InitializeComponent();

            _mediaPlaying = xMedia1;
            _mediaDowning = xMedia2;

            _playManage = new PlaySegmentManage();
            _playManage.Play += Play;
        }
Ejemplo n.º 31
0
 public async void Speak(MediaElement audioPlayer, SpeechMessage speech)
 {
     var synth = new SpeechSynthesizer();
     var ttsStream = await synth.SynthesizeTextToStreamAsync(speech.Message);
     audioPlayer.SetSource(ttsStream, "");
     audioPlayer.CurrentStateChanged += async (object sender, Windows.UI.Xaml.RoutedEventArgs e) =>
     {
         await MainPage.Instance.SendResult(new ResultMessage(speech) { ResultId = (int)audioPlayer.CurrentState, Result = Enum.GetName(typeof(MediaElementState), audioPlayer.CurrentState) });
     };
 }
Ejemplo n.º 32
0
        public UWPVideoViewer(VideoPlayer view)
        {
            View = view;
            view.Buffered.HandleOn(Thread.UI, BufferVideo);
            View.PathChanged.HandleOn(Thread.UI, LoadVideo);
            View.Started.HandleOn(Thread.UI, () => Result.Play());
            View.Paused.HandleOn(Thread.UI, () => Result.Pause());
            View.Resumed.HandleOn(Thread.UI, () => Result.Play());
            View.Stopped.HandleOn(Thread.UI, () => Result.Stop());
            View.SoughtBeginning.HandleOn(Thread.UI, () => Result.Position = 0.Milliseconds());
            view.Muted.HandleOn(Thread.UI, () => Result.IsMuted            = view.IsMuted);

            Result = new controls.MediaElement {
                Stretch = media.Stretch.UniformToFill
            };
            Result.MediaEnded += (e, args) => View.FinishedPlaying.RaiseOn(Thread.UI);
        }
Ejemplo n.º 33
0
 public Data()
 {
     music = new MediaElement();
     LoadMediaAsync();
     LoadJsonAsync().GetAwaiter().GetResult();
 }