I am not used to using InteropServices but what I am doing is using WMPLib
to play songs from a console application. The application works as expected when I debug it from Visual Studio. But it crashes and gives me the following exception:
Unhandled Exception: System.Runtime.InteropServices.COMException: The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
at WMPLib.IWMPPlayer4.get_controls()
at ConsoleMP3Player.Program.Main(String[] args) in C:\Users\Ibrahim\Desktop\Console.Mp3\Console.Mp3\Program.cs:line 67
When I run it from command line:
C:\Users\Ibrahim\Desktop\Console.Mp3\Console.Mp3\bin\Debug>ConsoleMP3Player play
Following is the simple code for play
command:
var _player = new WindowsMediaPlayer();
_player.URL = "Full path to a mp3 file";
_player.controls.play();
Any help is greatly appreciated.