Android:如何使用默认播放器播放音乐?

Bas*_*ous 3 streaming android

我想使用默认媒体播放器流式播放mp3歌曲.

我使用MIME类型"audio/*".

Intent musicIntent = new Intent(android.content.Intent.ACTION_VIEW);
musicIntent.setType("audio/*");
startActivity(musicIntent);
Run Code Online (Sandbox Code Playgroud)

那么如何通过默认音乐播放器播放音乐?

提前致谢

And*_*lva 9

您可以像这样简单地将网址传递给Media Player,

Uri myUri = Uri.parse("your url here");
Intent intent = new Intent(android.content.Intent.ACTION_VIEW); 
intent.setDataAndType(myUri, "audio/*"); 
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)