XilinJia / Podcini

Open source podcast instrument for Android supporting contents from YouTube and YT Music as well as normal podcasts.
GNU General Public License v3.0
207 stars 8 forks source link

Allow playback of URL streams #73

Open summersab opened 4 months ago

summersab commented 4 months ago

Checklist

App version

6.1.0

Where did you get the app from

F-Droid

Problem you may be having, or feature you want

Podcini cannot play m3u files URL media streams. Sometimes (like when I am at the gym), I play all of the podcasts I have in the queue, and I need to stop what I am doing, open my radio app (I use RadioDroid), and play a station.

Suggested solution

It would be nice if Podcini could open and play streams stored in m3u files URL media streams. True, this is a bit out of the wheelhouse of what Podcini is designed to do (it is a podcast player, not a media or radio player), but it would be a handy addition to add to the end of queues. This may need to have some limitations (only one stream per m3u file, for example).

Screenshots / Drawings / Technical details

No response

XilinJia commented 4 months ago

Hum, not sure. Can you provide a sample file?

summersab commented 4 months ago

I changed the subject and content of this feature request. Opening m3u files might be beyond the scope of Podcini because these files store multiple URL streams, and you would need to include a m3u parser. However, it MIGHT be a viable and elegant solution (see point 2 a the end of this comment).

Instead, perhaps Podcini could simply open URL media streams that are added as episodes. These could then be added to queues and played just like a normal podcast episode.

From a technical perspective, I am not sure of the best way to implement this. Here are a few ideas for how to add URL streams (maybe you can think of a better alternative):

  1. Under the "Add podcast" > "Advanced" section, add a "Add URL Stream" option. This would open a popup (similar to the "Add Podcast by RSS address" popup) for the user to add the stream's URL. The stream would then be accessible in one of two ways:
    • Add all streams to a single subscription called "Streams." Each stream would be a separate "episode." (This would probably be easiest approach).
    • Add each stream as a separate subscription. A single episode would be created under the subscription to play the stream.
  2. Parse m3u files stored in local folders (my original idea). When a m3u file is detected in a local folder:

    • Parse the contents of the file
    • Add each stream in the file as a separate episode inside the local folder episode view
    • Do not actually show the *.m3u file in the local folder episode view

    This would probably be the most elegant solution, but it would require a parser and handling the details of the file format.

Below is an example m3u file I created by exporting my stations from RadioDroid. You can find more documentation of this format online - Wikipedia has an article with some examples. Also, I found a m3u parser written in Kotlin if you wanted to go that direction: https://github.com/BjoernPetersen/m3u-parser

#EXTM3U

#EXTINF:-1,http://natrix.sugarrivermedia.com:8000/wntk
http://natrix.sugarrivermedia.com:8000/wntk
sugarrivermedia.com:8000/wntk

#RADIOBROWSERUUID:8b78046f-2a55-4a50-a210-e6706669ff0b
#EXTINF:-1,105.9 FM WMAL
https://playerservices.streamtheworld.com/api/livestream-redirect/WMALFMAAC.aac

#RADIOBROWSERUUID:e62e1b9a-6d33-4c3f-9ea3-2626816f621e
#EXTINF:-1,WBAP News Talk
http://playerservices.streamtheworld.com/pls/WBAPAMAAC.pls

#RADIOBROWSERUUID:c6cfe25d-6f18-4b61-90a4-c74b941f440b
#EXTINF:-1,WRKO-AM 680
https://stream.revma.ihrhls.com/zc7750

#RADIOBROWSERUUID:0ade1609-b619-42e4-920d-b4bda670708d
#EXTINF:-1,WKIP 1450 & 98.5 FM Newstalk
http://stream.revma.ihrhls.com/zc5877/hls.m3u8

Let me know if you have questions or if my explanations didn't make sense. I am happy to provide more details!

summersab commented 3 months ago

I thought of a really cool way to add this functionality to Podcini. It would be a massive addition to the app, so this is a long-term idea that will require a lot of thought and planning (fixing bugs in 6.x is obviously more important, right now).

I listen to a lot of podcasts and radio shows. For podcasts, I use Podcini; for radio, I use RadioDroid. A lot of podcasts are in fact radio shows - they are simply rebroadcasts of the show in podcast form. I wish I could treat URL streams in RadioDroid like they were podcast episodes, seamlessly switch stations once one show stops and another starts (usually at the top of the hour), or switch to a radio stream from a podcast (or vice versa).

I think a case could be made for adding radio streaming support to Podcini. Here are a few use cases I have:

If I am at the gym, have my hands dirty from working on my car, am in the kitchen cooking, etc, accessing my phone may be difficult. It would be great if I could create a queue that contains both podcasts and radio stations (URL streams).

However, since URL radio streams are continuous, there is no way to automatically switch playback once a show stops and another one starts. To solve this, any item in the queue could have a "automatically advance to next episode" setting where the user can add a time (either exact time or a countdown) allowing the playback to automatically advance once the time is reached. This way, I can treat radio shows as if they were podcast episodes, have them automatically advance once the show ends based on a timer, and listen to both radio streams and podcasts from a single queue.

At the very minimum, the following two features would provide Podcini with this capability:

Much later down the road, perhaps the following could be added:

Again, this is a pretty radical idea that will take a lot of work, but I don't know of another app that can do this sort of thing. It would really make Podcini unique and help it stand out from other podcast apps out there.

dyeray commented 3 months ago

Hmm, I'm intrigued by this, but I don't see how your use case could make sense on a podcasts app. My logic tells me that if you add radio support it would go on a different section and not on the queue. Seems a bit confusing for a user to mix episodes of podcasts, which by definition end at some point and playback go to the next item, with streams, which never end. Would all radios be on the queue forever? A radio station would be a podcast or an episode of a podcast?