Android Question MediaPlayerStream not working on Android 9


With my project I found, that MediaPlayerStream not working on Android 9. It not play online radio at all.

I check it both with mp3 and AAC streams. After launching (mp.Play) - after exact 30s, error event occurs:
Error: "MEDIA_ERROR_UNKNOWN", Extra data: -2147483648

Brian Dean

Active Member
Licensed User
Longtime User
... MediaPlayerStream not working on Android 9.
This is not much information to go on. Do you mean that it is working on Android 8 and Android 10? Everything else that you have told us suggests a setup error in the coding.

Post your code.
Upvote 0


It is standard code. It working normal on Huawei Y6-2 (Android 6.0) and Bluestacks emulator. But does not work on Xiaomi A1 (Android 9.0).
TargetSDK is set to 29

Playing Online Radio code:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim MP As MediaPlayerStream
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime then MP.Initialize("mp")
End Sub

Sub Button1_Click
    MP.Load("") 'AAC+ stream
    'MP.Load("") 'MP3 stream
    Log("Load stream URL into RADIO")
End Sub

Sub mp_StreamReady
    Log("RADIO ready to playing")
End Sub

Sub mp_StreamError (ErrorCode As String, ExtraData As Int)
    Log("Error: " & ErrorCode & ", " & ExtraData)
    ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
End Sub

Sub mp_StreamBuffer(Percentage As Int)
End Sub
Upvote 0


28 - Non-ssl (non-https) communication is not permitted by default. It can be enabled in B4A v9+ by adding this line to the manifest editor:
CreateResourceFromFile(Macro, Core.NetworkClearText)

This modification to manifest really help. Thanks Erel
Upvote 0