Android Question MediaPlayerStream load LAN?

Heppy

Active Member
Licensed User
have a PC with a shared folder and within this an mp3 file.
How do I use MediaPlayerStream to load the file?
I've tried with m.load ("http: //Nombrepc/folder/file.mp3")
or m.load ("http://192.168.1.6/folder/file.mp3")
It does not work for me any ideas?

Android 7.1
B4X:
Region  Project Attributes
    #ApplicationLabel: DLNA
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #BridgeLogger: True
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim media As MediaPlayerStream

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
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")
    media.Load("http://192.168.1.6/PlayAudioFile/SoundSample.mp3")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub media_StreamReady
    Log("media")
    media.play
 
End Sub

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

Sub media_StreamBuffer(Percentage As Int)
    Log(Percentage)
End Sub
Thanks
 
Last edited:

Heppy

Active Member
Licensed User
Hi. Thanks Erel.

For legal requirements I have to play audio hosted on a PC remotely and without user interaction.
I can not use SMB to store it locally.
By means of a UDP broadcast it would send buffering and send playback simultaneously.
I do not know if you can give me an example of protocols with HTTPServer.
That's why I tried Streaming Audio library.
Regards

Sorry for my poor english
 
Upvote 0
Top