Player - Device Audio, Loop - Play Streaming

Thanks for your Work and no, I don't need itoo extension to play audiostream in background. Your extension is enough.

1 Like

I've removed some background methods that seem unnecessary, if something fails, let me know.

Are you sure?

How long does the music play without interfering with the device? Doesn't the Doze Mode switch off the screen at some point?

:pray:

Lito

@>-->---

Yes, after the time-out the screen is locked (device is in idle mode) and Doze mode kicks in. This gradually shuts down/throttles many functions (including WiFi connection). As a result, since Android 6 audio streams are stopped after a few minutes (exactly how many there are depends on the device).

Therefore a Foreground service is required to prevent Doze.

Thanks for the work but it does not work. Sorry sharing a part of my code in French language :

This code use 2 players. One to play a short notification sound when Play and Stop Button are pressed and your player for playing the audio stream. The problem is that the Stop function does not stop anything : The smartphone is still playing the audio stream...

I don't see any blocks of this extension.

It seems that you are using the native App Inventor player.

In Bouton_Stop I don't see the stop block to stop the player.


I think I know where the error is, you are using the player of this extension and in Bouton_Stop you are using the app inventor one, passing a stop.mp3 as a parameter.

You must put the block of this stop extension instead.


I don't know if I'm wrong.
Could you change the language to English in your project and show me the blocks with that language? To understand you better.

Here is the English version of a part of my code (I've renamed the "JoeDevPlayer" to "Web_Stram_Player") :

As I have 6 buttons to play different audio stream, each time the user press a button, I stop the player then I change the source and finally, the player is restarted.

The stock player that I renamed "Player_Notifications" is used to play the short notification sound when a button is pressed.

I hope all is more clean to you.

Thanks

In about 6 hours I will have access on the computer and I will check that, the stream should stop.

Is the extension you have installed Version 1.0.1?

OK. When @David_76 says 'I don't need itoo extension to play audiostream in background' this means that the sound is reproduced, yes, but only for a few minutes... because if the Itoo extension has not been installed there is no Foreground Service keeping the Wavelock active and fatally the device will enter Doze Mode at some point... right? :pray:

Lito

@>-->---

I have an option to disable screen saver so for now, this is not a problem for me. But thanks to tell me about that, I will work on it later with itoo.

As there are no radio operator online every time, to check the stop problem, you should use another stream more popular to get a chance to ear someone more often like https://live.f4ipa.fr :

I thought I updated the extension but it was not the case. I didn't want to uninstall it to avoid losing my code so I tried to install the new version over the old and it seems the process did not end as expected. Now I have the last version installed.

Well, I now have the 1.1 extension installed and then I upload my app to the smartphone, I have this error : Unable to load file : https//ai2.appinverntor.mit;edu/......../assets/external_comps/joejsanz.player.joedevplayer/classes.jar.

The upload progress stop at 48%:
Sending assets/external/xyz.kumaraswamy.itoo/classes.jar to companion....

But for your users. I sure most users will not be amused if the screen stays on all the time and the battery drains quickly.

Yes, you're right, but we'll take it one step at a time. I first have to solve my "Stop" Problem then I will use itoo to keep the audio streaming when the smartphone is in IDLE mode. For now, I can't upload my code because of an error with the last version of the extension.

The upload progress stop at 48% (Sending assets/external/xyz.kumaraswamy.itoo/classes.jar to companion....) and on the smartphone, this error is displayed:

error : Unable to load file : https//ai2.appinverntor.mit;edu/......../assets/external_comps/joejsanz.player.joedevplayer/classes.jar.

It seems that now, we need to install itoo if we want to use this extension but I'm waiting for Joe feedback.

You will need to install the app to try it out, as Companion is currently having issues with that error.

That's a general companion app issue currently...

See AI companion error - #2 by Taifun

Taifun

Thank you Taifun, I will try the companion version 2.73d1u.

Try this Radio app (works also in idle mode):

Blocks

Thanks for sharing Anke but not interesting for me. I don't want to play radio but ear some radio operators using network to communicate. It's not for fun but for HAM purposes.

Well the companion version 2.73d1u that I picked up on Taifun post is not working. So I have to build the apk... it takes more time to test but it seems I have no choice.