Android 流媒体播放器开发实现
2010-05-26 15:38:00 来源:WEB开发网核心提示:try {// if (url.startsWith("content://")) {// mPlayer.setDataSource(MediaPlayService.this, Uri// .parse(url));// } else {mPlayer.setDataSource(url);//
try {
// if (url.startsWith("content://")) {
// mPlayer.setDataSource(MediaPlayService.this, Uri
// .parse(url));
// } else {
mPlayer.setDataSource(url);
// }
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
setVolume(0f);
mPlayer.prepare();
mPlayer.start();
} catch (IllegalArgumentException e) {
Log.e(TAG, e.toString());
} catch (IllegalStateException e) {
Log.e(TAG, e.toString());
} catch (IOException e) {
Log.e(TAG, e.toString());
}
} else {
playFromNet(url, 0, UNKNOWN_LENGTH);
}
}
}
}
[]
更多精彩
赞助商链接