mediaplayerstream w/ shoutcast & android 2.1

exjey

Member
Licensed User
Longtime User
I 'm coming back because after tons of tests with this equipment:

Android 2.1 emulator (i want this api level because my clients using 2.1 version, by making 2.2+ apps will abandon them so its not an option for me)

B4A - The TOOL !

Audio library 1.32 & MediaPlayerStream object

SHOUTCAST server running locally at "localhost:8000"

-Tried Shoutcast DSP plugin and Winamp, all the encoder settings which exists in the plugin, the only thing that appeared on screen was "media_error_unknown -1"

The reason for my post is that i 've tried VLC to stream to SHOUTCAST server (both programs running locally).

VLC has many more encoding options, all seems to bring the same error message, but right now i've tested RTP: // encoding and reencoding to MPEG-TS MPEG Audio etc subformat, the MediaPlayerStream shows again "media_error_unknown" but with error code -4 instead of -1.

Am i getting close? LOL , i hope someone can help me in this step, maybe we are close to a solution.. :)

Edit: What is the difference of error codes -1 and -4 ? Is there any error tutorial ?
 

exjey

Member
Licensed User
Longtime User
I am sorry Erel, how do i find "unfiltered logs". Looking so desperate for a solution on this. To get audio via streaming from my company's pc, for android 2.1 platform. I have the control of the streaming PC, meaning i can encode whatever i want, needed for this case. Just cant figure out what settings i have to use.

You are mentioned "Media Player" logs, i am using "MediaPlayerStream" object.
 
Upvote 0

exjey

Member
Licensed User
Longtime User
Thanks NJDude, Erel.

This is part of the log while getting "media_error_unknown -1"

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Displayed activity b4a.example/.main: 1646 ms (total 1646 ms)
generated scanline__00000077:03545404_00000A04_00000000 [ 29 ipp] (51 ins) at [0x471900:0x4719cc] in 704610 ns
info/warning (1, 26)
Info (1,26)
Command PLAYER_INIT completed with an error or info PVMFErrCorrupt
error (1, -10)
Error (1,-10)


Error: MEDIA_ERROR_UNKNOWN, -10
PVMFInfoErrorHandlingComplete
enqueueToast pkg=b4a.example callback=android.app.ITransientNotification$Stub$Proxy@43c48e58 duration=1
GC freed 2701 objects / 154368 bytes in 182ms
info/warning (1, 26)
Info (1,26)
Command PLAYER_INIT completed with an error or info PVMFErrCorrupt
error (1, -10)
Error (1,-10)
Error: MEDIA_ERROR_UNKNOWN, -10

(i have it retry every 5 seconds while i am testing other encodings to the stream, but no change).

I've found this when googling: "Shoutcast streams are nativelly supported only on 2.2. For earlier versions you must create local proxy that changes the response protocol from ICY (shoutcast) to HTTP, which the mediaplayer will support."

This is too SAD. OK, not a suicide thing yet, but lets say to forget Shoutcast, why not. I have the control, i have VLC. I want only this to use a streaming server. It supports everything. I am creating new VLC profile for audio streaming: HTTP , MPEG-TS container , MPEG Audio , listening to port 8080 , path "stream". So on the same computer which runs B4A and runs the project, i have VLC that streams the audio and listens to address "http://localhost:8080/stream" or "http://192.168.1.100:8080/stream". Nothing, i cant get it to work. MediaPlayerStream always showing "media_error_unknown" . Anybody did it.... i mean with Android 2.1 api level. I dont want Android 2.2+ stuff.

Added: I am changing the encodings in VLC, i am getting the same error but with different negative number (-1, -4, -10 etc\)
 
Last edited:
Upvote 0

exjey

Member
Licensed User
Longtime User
I was doing something wrong or its the new updated version of VLC i've just downloaded. Just selected :

1) Network streaming
2) HTTP method
3) Audio-MP3 profile
4) RAW container
5) MP3 encoding, 32k 44100

And thats it. It works. MediaPlayerStream and Android 2.1 emulator with so clear sound!
 
Last edited:
Upvote 0

exjey

Member
Licensed User
Longtime User
I have 2 android 2.1 devices (1 phone, 1 tablet) , 1 android 2.2 minibook , 1 android 4.0.1 tablet.

Both 2.1 devices are starting the stream fair quick, almost in 5 secs max. The 2.2 minibook delays about 20 secs to start the stream and the 4.0 android takes about a minute to play it.

Is there an explanation for this? The stream quality is very poor, only 24kbps at 44100 Mhz.

Edit: The 2.1 devices have 600mhz processor, the 4.0 have 1.3Ghz processor. So someone could expect the opposite behavior...
 
Last edited:
Upvote 0

Ratna Fang

Member
Licensed User
Longtime User
hi,

about playing webradio using shoutcast, is it sufficient to use mediaplayerstream and audio lib?
i use b4a 3.2, audio lib 1.5.5.

my code is simply like this:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim Media As MediaPlayerStream
    Dim Audio As AudioStreamer
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   
    Media.Initialize("Media")
    Audio.Initialize("Audio", 44100, False, 16, Audio.VOLUME_MUSIC)
   
    Media.Load("http://localhost:7777/")
    Media.Play
End Sub

the audio is audio/mpeg and the stream is up at 48 kbps.

i don't mind if it's even has to force users to use sdk level 14 or above because android 4.0 (ICS) is common device here.

i got error like this from the log (unfilter):
B4X:
** Activity (main) Create, isFirst = false **
setDataSource_l(URL suppressed)
start called in state 4
error (-38, 0)
** Activity (main) Resume **
out_write() limiting sleep time 32199 to 23219


Error (-38,0)
Tagging socket 48 with tag 3f500000000(1013) for uid 10074 failed errno=-13


Displayed com.webclip.radio/.main: +146ms
Untagging socket 48 failed errno=-13


ERROR_END_OF_STREAM


Failed to open libwvm.so


error (1, -2147483648)
Error (1,-2147483648)
 
Upvote 0

Ratna Fang

Member
Licensed User
Longtime User
sorry... just found a solution NJDude here

so i change my code like this:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim Media As MediaPlayerStream
    Dim Audio As AudioStreamer
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Media.Initialize("Media")
    Audio.Initialize("Audio", 44100, False, 16, Audio.VOLUME_MUSIC)
   
    Media.Load("http://localhost:7777/")
   
End Sub

Sub Media_StreamReady
    Media.Play
End Sub

thanks for providing well documentation/wiki for us :)
now it's getting easier for me
 
Upvote 0

MetalOS

Member
Licensed User
Longtime User
Hello, sorry in advance for my english. I used the method of Ratna Fang and it works very well but after about 5 minutes the flow this cup. Do you have an idea of the problem? Thank you in advance for your help.

Here is the unfiltered log if it can help.

B4X:
Logger connecté à :  samsung GT-I9505
--------- beginning of main
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
info/warning (703, 127)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:694): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:694): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-2/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
Initialized EGL, version 1.4
Swap behavior 1
type=1400 audit(0.0:699): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:699): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-2/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
Initialized EGL, version 1.4
Swap behavior 1
type=1400 audit(0.0:702): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:702): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
Starting remote logger. Port: 43878
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:706): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:706): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
*** Debugger waiting for connection (0) ***
After accept
*** Debugger waiting for connection (1) ***
Copying updated assets files (12)
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
Skipped 77 frames!  The application may be doing too much work on its main thread.
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
Remote logger timeout: 1
writer error
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2010)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)
    at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:358)
    at anywheresoftware.b4a.remotelogger.Connector$Writer.run(Connector.java:160)
    at java.lang.Thread.run(Thread.java:761)
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:151)
    at java.net.SocketInputStream.read(SocketInputStream.java:120)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
    at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
    at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
    at java.lang.Thread.run(Thread.java:761)
Starting remote logger. Port: 43878
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
Starting remote logger. Port: 43878
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:707): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:707): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
*** Debugger waiting for connection (0) ***
*** Debugger waiting for connection (1) ***
After accept
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
Skipped 61 frames!  The application may be doing too much work on its main thread.
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Thank you in advance for your help.
1. This is the WRONG Thread for your problem! It is an 5 years old thread.
2. You NEVER should post to existing threads; always create a NEW thread for ANY question you have.
 
Upvote 0
Top