Esempio n. 1
0
 private void TryStartPlaybackAsync()// async added
 {
     ThreadPool.QueueUserWorkItem((WaitCallback)(async x =>
     {
         try
         {
             this.ReleaseResources();
             if (this.mediaPlayer != null)
             {
                 this.mediaPlayer.StopVideo();
             }
             if (!string.IsNullOrEmpty(this.videoPath))
             {
                 DxMediaElement dxMediaElement = this;
                 IRandomAccessStream irandomAccessStream = dxMediaElement.videoStream;
                 IRandomAccessStream videoStream = await this.GetVideoStream();
                 dxMediaElement.videoStream = videoStream;
                 dxMediaElement = null;
             }
             if (this.videoStream == null || this.context != null)
             {
                 return;
             }
             this.InitializeContext();
         }
         catch (Exception ex)
         {
             Logger.Instance.Error("DxMediaElement.TryStartPlaybackAsync failed", ex);
         }
     }));
 }
Esempio n. 2
0
 private void UpdateActiveElement()
 {
     if (string.IsNullOrEmpty(this.videoPath) || DxMediaElement.activeElement == this)
     {
         return;
     }
     if (DxMediaElement.activeElement != null)
     {
         DxMediaElement.activeElement.VideoPath = null;
     }
     DxMediaElement.activeElement = this;
 }