Create AudioFile using already opened file

Issue #341 new
Former user created an issue

Hi, I have a music app in android which uses jaudiotagger to read the tags of mp3 files on the device. It works perfect, but recently I updated my phone to android 11, and since then loading the tags (I have about 600 songs) takes about 20 seconds instead of about 2 seconds. I did some researching and I found out it's because of the scoped storage that's enforces since android 11. I don't really need to get into that, but basically what happens is they improved the security of the filesystem so it takes longer to access a file (because they spend more time checking permissions). Now they recommend opening a file with MediaStore instead of File. The problem is, MediaStore can give me an InputStream object, but jaudiotagger only accepts File objects and it reads them itselves and it takes a lot of time. All I need is a way for me to get an AudioFile object from an InputStream, or from a file in bytes, or whatever, but just not have jaudiotagger open the file on its own I need to read it using MediaStore. It should really be a small addition but it will help me and other android developers a lot, thank you!

Comments (1)

  1. IJabz repo owner

    Actually its not trivial, originally all formats used the AudioFileReader interface and this works with RandomFile, most have now been moved to AudioFileReader2 and this uses File. Once we have moved all formats to AudioFileReader2 we can then modify this to allow use of stream rather than File but we are not at that point yet, need to do for Wma, Ogg and Mp3.

  2. Log in to comment