c# - BackgroundWorker process for Windows Media Player -


I need some help setting up a backgroundworking process for Windows Media Player Audio. I am not from the main thread, Audio from the background worker (WP) is required to run directly, and that background process needs to be opened by the end of the audio file, but even if the normal play on the audio play starts playing, the background worker stops, and Slia I do not think that the audio is actually running on the other thread or background worker as already closed.

I have a question, will I be open with the Windows Media Player (WMPLB) background which will be open till the end of the working song?

  using WMPLB; Namespace Media Player {Public Partial Class Main Window: Window {Background Worker m_audioProcessingWorker; Public Manvindo () {Initialization (); } string filename = @ "C: \ audio \ song1.mp3" Private Zero Button _play_click (Object Sender, EventArgse E) {// Create Audio Processing Worker (Thread) m_audioProcessingWorker = New Backgroundwalker (); M_audioProcessingWorker.DoWork + = new DoWorkEventHandler (audio processingWorker); m_audioProcessingWorker.RunWorkerAsync (); M_audioProcessingWorker.RunWorkerCompleted + = new RunWorkerDocumentHandler (audio processingWorker_free); } Private Zero Audio processingWorker_DoWork (Object Sender, DoWorkEventArgs e) {try {axWindowsMediaPlayer1.URL = filename; AxWindowsMediaPlayer1.Ctlcontrols.play (); } Hold (Exception pre) {Message Box. Show (ex.Message); }} Private Zero Audioprocessing Worker Complete (Object Sender, Runwalker Comprehensive Avantges E) {Message Box. Show ("Audio is finished"); } Private Zero button_stop_link (object sender, eventAgds E) {axWindowsMediaPlayer1.Ctlcontrols.stop (); m_audioProcessingWorker.CancelAsync (); } Private Zero button_pause_click (object sender, eventAgds E) {Aquindomediaplayer 1. CTL Control Pause (); }}}   

Thanks.

UI lets me freeze audio playback while loading large portions of data in thread UI Stalls are getting, and I would love to run that audio process on a different thread, so I though BackgroundWorker .

To maximize you, use BackgroundWorker (or better yet, Task.Run or naturally async IO APIs) should do. Keep the amount of data in the background and main UI threads free from intervals. Then build and use WMP control on UI thread.

If you can not reactivate the code in this way and want to use a background thread for WPM, keep in mind that such thread is to pump Windows messages, otherwise the WPM control works properly Will not For this purpose, you can use your ThreadWithAffinityContext from .

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -