private void PlayVideoFile(string file) { if (ReplaySDK.PlayM4_GetPort(ref _port)) { ReplaySDK.PlayM4_OpenFile(_port, file); double totalseconds = (double)ReplaySDK.PlayM4_GetFileTime(_port); this.replayerSlider.Maximum = totalseconds; TBTotalTime.Text = TimeSpan.FromSeconds(totalseconds).ToString(); isPlaying = ReplaySDK.PlayM4_Play(_port, this.pbReplay.Handle); timer.Start(); } }
private void DownloadAndPlayVideoFile(Uri address, string file) { WebClient wc = new WebClient(); wc.DownloadDataCompleted += delegate(object client, DownloadDataCompletedEventArgs we) { FileStream fileStream = new System.IO.FileStream(file, FileMode.Create, FileAccess.Write); // Writes a block of bytes to this stream using data from a byte array. fileStream.Write(we.Result, 0, we.Result.Length); // close file stream fileStream.Close(); if (ReplaySDK.PlayM4_GetPort(ref _port)) { ReplaySDK.PlayM4_OpenFile(_port, file); double totalseconds = (double)ReplaySDK.PlayM4_GetFileTime(_port); this.replayerSlider.Maximum = totalseconds; TBTotalTime.Text = TimeSpan.FromSeconds(totalseconds).ToString(); isPlaying = ReplaySDK.PlayM4_Play(_port, this.pbReplay.Handle); timer.Start(); } }; wc.DownloadDataAsync(address); }