0

Invoked device native player to play audio file, it opens android native player on top of the application but when selecting to back out or return to the application, device automatically stops playing the current media.

Sample code:

Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"audio/*");
startActivity(intent);

How can I implement so that Device should continue to play audio in the background when selecting to back out or return to the application

Thanks in Advance.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
AndDev
  • 11
  • 2

2 Answers2

1

You can start player without starting the native app. See example here: MediaPlayer.setDataSource() and prepare() not working - android

Community
  • 1
  • 1
Konstantin Burov
  • 68,980
  • 16
  • 115
  • 93
0

Native player cant play video when leave the screen its the behaviour of native Player.However you can implement MediaPlayer Api that will complete your requirments.

user1576593
  • 121
  • 1
  • 1
  • 5