I administer the site where I publish audio recordings of various events. Usually it is 10-20 mp3 files.
Users have a choice - to listen to audio directly from the site using a Flash player, or download the archive to your computer.
The problem is that none of these methods work if you open the site in the browser on Android: Flash either does not work at all (on older phones) or stops playback as soon as another application opens, or even a new browser window. And download the archive to your phone, unpack, and then launch the player - too many hemorrhoids.
One could use HTML5 with the new AUDIO tag. But firstly, this tag is not supported on Android version 2.2 or lower, as there is a
bug in their tracker. Secondly, in those versions where it is supported, it works unstably: I tried to run
jPlayer , and on my Android, their demo never started. And thirdly, there is the same problem as with Flash - as soon as you go to another page or application - the audio stops.
')
So how do you start playing multiple mp3 files in the background?
I did this using m3u lists. But not without crutches ... But first things first.
What is m3u list (playlist)
According to the
Wiki , in the simplest version, the m3u file is a plain text file that contains a list of audio files. The list may point to local files (absolute or relative path), or URL links. We are interested in the option with URL links.
In the extended version, you can specify additional information, such as the duration of the track, the name of the track and the name of the album.
If you use Russian letters in the names, the file must be in the utf8 encoding and have the extension m3u8.
Android m3u support
Android supports m3u crooked. By default, they use the application "Music", which comes with Android. There m3u seems to be supported, but if the URL is in the list, then the list does not open, but the error “Sorry, the player doesn’t support this type of audio file” pops up. This is also a
bug . It has been hanging for a long time, so if you follow the link to the bug, and click on the star, your vote will be counted, as an
expression of the will of the people, please fix this bug and maybe someone will pay attention to it.
The problem is solved by installing an additional application. I searched the market and found only one application that normally opens m3u lists with URL links. This is a free
Just Playlists app.
The m3u8 format is not supported by Android (that is, the player that is included by default in the system), and I have not found any applications that support this format.
How it all works
- On the site you need to ask the user to install Just Playlists. When the above-mentioned bug is fixed in Android, this step will not be necessary.
- Generate m3u list with URL links to our MP3 files, make a regular link to this m3u file on our web site. To generate m3u, I use
VLC Player , although I can use the usual Windows Media Player. VLC can correctly prescribe the length of the tracks. They allow you to save a list of files with local file links. Then in Notepad I do a “Replace” of the local path to the URL.
- The user clicks on the link that points to the m3u file. Android launches the player (in our case Just Playlists), which plays all the tracks from the m3u list in the background.
iOS
Support for m3u seems to have been promised on iOS. Unfortunately, I do not have an iPhone or an iPad, so I spent a few quick experiments on opening m3u links on someone else's iPad and found out that everything works, but it’s also crooked:
- m3u links open, and an iOS application starts, which starts playing files from the m3u playlist in the background, but:
- There is no ability to navigate through the list of tracks, that is, you can not go to the next / previous track, or rewind forward / backward;
- Quick search for existing applications in the App Store did not find free applications that would somehow improve this functionality;
Conclusion
I agree that the proposed solution is not the best (requires installation of the application on the user's side).
However, one of the purposes of publishing this article was to highlight this question, so that those who set such a goal in front of them would know about existing pitfalls.