![](/img/trans.png)
[英]Google Play Music no longer supports media_play_from_search
[英]How to access media from Google Play Music?
我使用内容提供程序URI content://com.google.android.music.MusicContent/audio使用以下代码获取条目列表(在设备上和离线):
String[] proj = { MediaStore.Audio.AudioColumns.TITLE, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID };
Uri gMusicUri = Uri.parse("content://com.google.android.music.MusicContent/audio");
Ln.d("onCreate(): XX gMusicUri = %s", gMusicUri);
Cursor cursor = getApplicationContext().getContentResolver().query(gMusicUri, proj, null, null, null);
if (cursor == null) {
// query failed, handle error.
Ln.w("onCreate(): XX cursor is null, query failed");
} else if (!cursor.moveToFirst()) {
// no media on the device
Ln.w("onCreate(): XX cursor cannot move to 1st element, no media on device");
} else {
int idColumn = cursor.getColumnIndex(MediaStore.Audio.Media._ID);
int titleColumn = cursor.getColumnIndex(MediaStore.Audio.Media.TITLE);
int artistColumn = cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST);
do {
long id = cursor.getLong(idColumn);
String title = cursor.getString(titleColumn);
String artist = cursor.getString(artistColumn);
// ...process entry...
Ln.i("onCreate(): XX id = %d, title = %s, artist = %s", id, title, artist);
} while (cursor.moveToNext());
}
cursor.close();
我需要流媒体,想知道是否有可能?
我的非官方Google音乐api通过使用网站上的相同调用来执行此操作:目前,这是https://play.google.com/music/play
。 songid
是相关参数。 响应模式在这里 。
如果您使用的是Android,则可以使用AccountManager
和Google Music sj
服务简化身份验证过程。
这是另一种可能更简单的方法: http : //dpogue.ca/gmusic.html 。 我没有写这个,所以我不确定它是否是最新的。
如果您最终想知道如何从该uri进行流式传输,请创建一个答案-我很想知道!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.