Android Question Exoplayer - Filenotfound error with audio files

XMan2012

Member
Licensed User
Longtime User
Hi,

I am using the exoplayer in order play OGG or MP3 files (tried both), but I keep getting a filenotfound error.. It does work with Mediaplayer.
The reason I wanted to use Exoplayer was to have a nice loop feature. Mediaplayer has 1/10th pause when looping files.

Reference: https://www.b4x.com/android/forum/threads/exoplayer-mediaplayer-videoview-alternative.72652/#content

Note: URL streaming works

B4X:
Sub Process_Globals
    Private player1 As SimpleExoPlayer
End Sub

Sub Globals
    Private SimpleExoPlayerView1 As SimpleExoPlayerView

End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        player1.Initialize("player")
'        player1.CreateFileSource(File.DirAssets, "w4.mp3")
        player1.Prepare(player1.CreateFileSource(File.DirAssets,"w4.ogg"))
'        Also tried with File.DirInternal

    End If
    Activity.LoadLayout("1")
    SimpleExoPlayerView1.Player = player1
    player1.Play
End Sub

Sub Player_Ready
    Log("Ready")
End Sub

Sub Player_Error (Message As String)
    Log("Error: " & Message)
End Sub

Sub Player_Complete
    Log("complete")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Error I am getting:
Error: com.google.android.exoplayer2.upstream.AssetDataSource$AssetDataSourceException: java.io.FileNotFoundException:

Build tool version: android-23
B4A version : 6.3.1
Phone : Nexus 6P
Emulator : Nougat / Intel

Thanks
 
Last edited:

XMan2012

Member
Licensed User
Longtime User
I managed to make it work, but in debug (which I never really do honestly). In release, it seems to fail to play most of the time. If that helps.
I tested this on my Nexus 6p (Android 7) and my Intel based Dell 8 (Android 5). Same behavior. Debug mode plays the file, not with release.
Note: I deinstalled evertime.

Thanks
 
Upvote 0
Top