gpt4 book ai didi

机器人 : use of media

转载 作者:行者123 更新时间:2023-11-29 00:49:54 26 4
gpt4 key购买 nike

我想制作一个应用程序,为我提供我的 SDCard 中可用的音频文件列表,然后我应该能够从我的应用程序播放该音频文件。甚至暂停恢复音频播放等功能..

有什么帮助吗?

最佳答案

您可以看到以下用于从 URL 流式传输音频的代码

        private void playVideo() {
try {
final String path = "http://www.a1freesoundeffects.com/animals12557/catmeow.wav";

// If the path has not changed, just start the media player
if (path.equals(current) && mp != null) {
mp.start();
return;
}
current = path;

// Create a new media player and set the listeners
mp = new MediaPlayer();
mp.setDataSource(path);
mp.prepare();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);


} catch (Exception e) {
if (mp != null) {
mp.stop();
mp.release();
}
}
}

关于机器人 : use of media,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3697921/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com