Example #1
0
 /// <summary>
 /// 播放xef视频
 /// </summary>
 /// <param name="filePath">xef视频路径</param>
 public void PlaybackClip(object filePath)
 {
     ///以前的方法,不能加骨骼上去
     #region
     using (KStudioClient PlayClient = KStudio.CreateClient())
     {
         PlayClient.ConnectToService();
         using (KStudioPlayback playback = PlayClient.CreatePlayback((string)filePath))
         {
             playback.LoopCount = 0;
             playback.Start();
             Flag2 = 0;
             while (playback.State == KStudioPlaybackState.Playing)
             {
             }
             if (playback.State == KStudioPlaybackState.Error)
             {
                 Flag2 = 1;
                 throw new InvalidOperationException("Error: Playback failed!");
             }
             Flag2 = 1;
             playback.Stop();
             playback.Dispose();
         }
         PlayClient.DisconnectFromService();
         System.Windows.Forms.MessageBox.Show("回放结束");
     }
     #endregion
 }
Example #2
0
        public void CloseRecording()
        {
            OnRecordingStopped();

            if (playback != null)
            {
                playback.Stop();
                playback.Dispose();
                playback = null;
            }
            if (client != null)
            {
                client.DisconnectFromService();
                client.Dispose();
                client = null;
            }

            LogConsole.WriteLine("Recording stopped");
        }
Example #3
0
        public void startPlayback(string filePath)
        {
            uint loopCount = 100;

            new System.Threading.Thread(() =>
            {
                using (_client = KStudio.CreateClient())
                {
                    _client.ConnectToService();

                    try
                    {
                        using (_playback = _client.CreatePlayback(filePath))
                        {
                            _playback.LoopCount = loopCount;
                            _playback.Start();

                            while (_playback.State == KStudioPlaybackState.Playing || _playback.State == KStudioPlaybackState.Paused)
                            {
                                System.Threading.Thread.Sleep(500);
                            }
                            _playback.Dispose();
                            _playback = null;
                        }
                        _client.DisconnectFromService();
                    }
                    catch (NullReferenceException)
                    {
                        Debug.WriteLine("Don't know why");
                    }
                    catch (ArgumentException)
                    {
                        Debug.WriteLine("Don't know why");
                    }
                    catch (InvalidOperationException)
                    {
                        Debug.WriteLine("Same video can't be loaded at the same time");
                    }
                }
            }).Start();
        }