How do I keep music playing on external player?

Thank you TIMAI2

Part of this exercise app I designed is to put it in Airplane Mode so that there will be no interruptions during workout. The notification channel wont work in this case but thanks for the very good idea

This is not something you can configure from within your app but from the music player app...

You could try several music player apps and probably you can find a player, which does not pause...

If you program a music player in App Inventor there is the event OtherPlayerStarted, which can be used to pause the music or not

Taifun

1 Like

Thank you Taifun. I rather expected that to be the answer but I am disappointed that it is.
I was fairly sure if anyone knew the answer it would be you. This question requires a knowledge of the OS.

It also requires an understanding of what "external" means I have learned :grinning:

OOPS! OS means Operating System

For me it is still completely unclear what you are talking about here. And I'm actually pretty familiar with audio apps.

Is it really that difficult to clearly describe the problem?

Like this:

  1. Start app X and play sound1.
  2. Open app Y and play sound2.
    Expected result ... ?

:question:

Pretty sure OP's saying that they're playing music from the phone through an app, but when they start the Player component, the audio being played from outside the app pauses. It does seem pretty difficult to explain tbh...

1 Like

Okay.

No, not at all, as you have shown.

This is not possible with the Player component or the TaifunPlayer extension (that is based on the MediaPlayer). But it is possible with the ExoPlayer and with another Player extension that I recieved for testing purpose (not published yet). The ExoPlayer component is only avialable in Kodular. But there are extensions for it.

1 Like

I have just run a test on a Google Pixel 4a Android 12

An AppInventor app that plays music (from /Music directory)

Another AppInventor app that plays a sound, after a clock timer interval

Music playing in the music app was NOT paused when the sound in the second app was played.

Yes, but I think we are talking about the default player of an Android phone.

See here:

And this default player is paused when another app (is opened and) plays a sound (regardless of whether it is an AI2 app or not).

1 Like

Exactly... :wink:

Thank you TIMA12
Not the same situation:

  1. Playing music from an AppInventor music app
  2. Playing a timed sound from a seperate AppInventor app
    Result: no interruption

My situation:

  1. Playing music from default android system music player
  2. Playing a timed short sound from my app
    Result: auto-pause default android music player

AGAIN: TaiFun had it right when he stated:
This is not something you can configure from within your app but from the music player app...
You could try several music player apps and probably you can find a player, which does not pause...
If you program a music player in App Inventor there is the event OtherPlayerStarted, which can be used to pause the music or not

This problem of mine is an OS (operating system) problem . The default player chose to use the option of OtherPlayerStarted. The Android OS has this option built in. There are multiple old articals on Inet discussing this and:

  1. Some claim there is a setting somewhere to override this (no luck finding it on mine)
  2. A few claim there once was an app to change the system setting but the app has disappeared long ago

As I said and fully agree with TaiFun, this is an operating system problem. I would love to know how to override it but do not know how or IF

Thank You ALL

1 Like

but instead, a method that works....

"a bend in the road is not the end of the road, unless you fail to make the turn"

to get started go here:

and scroll down to the Jukebox example

1 Like

@Wes_Savage, You could use a text to speech component, and when it hears the text to speech, set player stop

TIM you have great insight and I like this "bend" attitude. I would like to ask a bending question :slight_smile: I perfected playing sounds, while at the same time, playing music. Next problem I would like to conquer is changing the volume of the "sound" separately from the "music".

What would be ideal is to be able to lower music volume (which I easily do with Taifun's extension, while at the same time raising the volume of the "sound". There seems to be no way of doing this.

Q: Is there some way to play a sound in the ringer channel so that I can cause this to happen? Any ideas very much appreciated.

Thank You

Thank you Brady. I did think of that but for my application text-2-speech is not "coherant" enough. Sometimes real human speech is necessary.

It may be worth increasing the amplitude of the "sound" file using audacity (or another sound manager) so that it just plays louder....?

1 Like

Yes I already did that but the separation between the two still is not enough. The ringer channel volume is seperately adjustable using Taifun's settings

If you have your player and your sound in the same app you could do this:

1 Like

sigh I am so close to perfection :frowning:

I cant use the player because it will stop my external music app.
Another solution would be if there was a way to pause external music players and then resume them from within my app.

Forgive me? I am also a "bender" of many years and perhaps a far too determined person.

I assume there is no way to force my sounds into the ringer :frowning:

I assumed you had made the turn and either moved to using a separate AI2 app as your audio player, or better still combined the two apps into one!

You could try with activity starter ? You may need an external audio player that accept commands using the activity starter. (This will require digging around in lots of android developer documentation!)

1 Like

:frowning: thought of that too but this is for several people who are not all using the same player.

Thank You very much... at least I got to bounce this off a very knowledgeable person.

Also I did design a perfect sound player that works pretty much the same as the AI music player. "playing" individual words sounds great and can be a very good way to create a language teacher.

Thanks again TIM