Android Question Exoplayer truncates .mp3 playback

Rusty

Well-Known Member
Licensed User
Longtime User
I have an MP3 file that plays for about 1.5 seconds (it's a voice command).
When I use player1.play after having
B4X:
If FirstTime Then
        Activity.LoadLayout("Main")
        player1.Initialize("player")
        Dim sources As List
        sources.Initialize
        sources.Add(player1.CreateFileSource(File.DirAssets, "voicefile.mp3"))
        player1.Prepare(player1.CreateListSource(sources))
        ExoPlayerView.Player = player1
    End If
...
B4X:
    player1.Position = 0
    player1.Play
It plays the first 90 to 95% and then stops without finishing the last word(s).
Is there something I need to do to force it to complete?
When I play the mp3 file with any player, it plays the complete file accurately.
Thanks,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
Here is the mp3 file.
Thanks Erel,
Rusty
 

Attachments

  • voiceexample.zip
    7.1 KB · Views: 389
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
I used your code verbatim and it still truncates the last word. I even used the Release mode(s), just in case Debug had a problem with it.
I'm running it on a Samsung S7 Android version 7
I created a brand new program that only does your code and has no other libraries.
Any ideas?
Rusty
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
... I added 300ms of silence to the end and it is working.
This will mean all the mp3's will require this, I guess.
Thanks for all of your help :)
Rusty
 
Upvote 0
Top