Play音乐中播放mp3

Play音乐中播放mp3

本文介绍了在Google Play音乐中播放mp3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Google Play音乐播放mp3歌曲。

How can I play a mp3 song using Google Play Music.

我试图在Google Play音乐中播放,暂停播放,下一首等。

I am trying to play, pause, next etc in Google Play Music.

我已将音乐播放器设置为默认音乐播放器。

I have set the music player as default.

我可以使用以下命令播放下一个和上一个。 / p>

I am able to broadcast the Next and previous by using the below commands.

    public static final String CMD_NAME = "CMD_NAME";
    public static final String CMD_PAUSE = "CMD_PAUSE";

    public static final String CMDTOGGLEPAUSE = "togglepause";
    public static final String CMDPAUSE = "pause";
    public static final String CMDPLAY = "play";
    public static final String CMDPREVIOUS = "previous";
    public static final String CMDNEXT = "next";
    public static final String SERVICECMD = "com.android.music.musicservicecommand";


AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

        if(mAudioManager.isMusicActive()) {
            Intent i = new Intent(SERVICECMD);
            i.putExtra(CMDNAME , CMDNEXT);
            this.sendBroadcast(i);
        }

如何播放特定mp3文件的歌曲mp3文件名)。

How can I broadcast for play a song for a particular mp3 file (input as mp3 file name) .

推荐答案

没有测试过这个,但我相信你可以从你想要的文件创建一个Uri玩这个Uri并发送一个共享意图...

Haven't tested this but I believe you can create a Uri from the file that you want to play and send a share intent with this Uri...

之后,系统对话框会询问用户他们想用什么应用程序来接收该意图。如果配置正确,音乐播放器应该能够处理该意图并播放歌曲。

After that a system dialog will ask the user what app they want to use to receive that intent. If configured correctly the music player should be able to handle the intent and play the song.

如果用户选择始终使用此应用程序来实现此目的,则下一次对话框不会显示,玩家将自动处理该意图。

If the user selects to always use this app for this intent then the next times the dialog wont show and the player will handle the intent automatically.

希望这可以帮助您

这篇关于在Google Play音乐中播放mp3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 23:27