私は InteropServices の使用に慣れていませんがWMPLib
、コンソール アプリケーションから曲を再生するために使用しています。Visual Studio からデバッグすると、アプリケーションは期待どおりに動作します。しかし、クラッシュして次の例外が発生します。
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
コマンドラインから実行すると:
C:\Users\Ibrahim\Desktop\Console.Mp3\Console.Mp3\bin\Debug>ConsoleMP3Player play
play
コマンド
の簡単なコードは次のとおりです。
var _player = new WindowsMediaPlayer();
_player.URL = "Full path to a mp3 file";
_player.controls.play();
どんな助けでも大歓迎です。