如何获得音乐曲目播放Android设备上的信息?

编程入门 行业动态 更新时间:2024-10-26 12:33:15
本文介绍了如何获得音乐曲目播放Android设备上的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想要得到的音乐曲目播放Android设备上的信息? 有没有搭载Android API可用于此?

I want to get the Information of the Music track playing on a android device? Is there any android powered api available for this?

还是我必须写一个插件各自的Andr​​oid媒体播放器?

Or do I have to write a plugin for respective android media players?

推荐答案

这在技术上是一个黑客。只有用音乐应用程序,它捆绑了Android的工作。

This is technically a hack. And works only with the Music App that comes bundled with Android.

复制此 IMediaPlaybackService.aidl 到您的项目...请参照的这个的帖子访问MediaPlayer的服务。然后,您可以访问所有这些功能。

Copy this IMediaPlaybackService.aidl into your Project...Refer this Post to access the MediaPlayer Service. You can then access all these functions.

package com.android.music; import android.graphics.Bitmap; interface IMediaPlaybackService { void openFile(String path, boolean oneShot); void openFileAsync(String path); void open(in long [] list, int position); int getQueuePosition(); boolean isPlaying(); void stop(); void pause(); void play(); void prev(); void next(); long duration(); long position(); long seek(long pos); String getTrackName(); String getAlbumName(); long getAlbumId(); String getArtistName(); long getArtistId(); void enqueue(in long [] list, int action); long [] getQueue(); void moveQueueItem(int from, int to); void setQueuePosition(int index); String getPath(); long getAudioId(); void setShuffleMode(int shufflemode); int getShuffleMode(); int removeTracks(int first, int last); int removeTrack(long id); void setRepeatMode(int repeatmode); int getRepeatMode(); int getMediaMountedCount(); }

有关其他球员,你需要检查,如果他们暴露自己的服务,其它应用程序。

For other players, you'll need to check if they expose their service to other applications.

更多推荐

如何获得音乐曲目播放Android设备上的信息?

本文发布于:2023-07-11 09:28:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093582.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:曲目   如何获得   设备   音乐   信息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!