feat(sdk): add configurable media3 player builder - #127
Conversation
|
Excited to take a look at this! Hopefully will get a chance by EOW |
|
I did a quick pass and I know @brunoro is doing the same since he's kinda owning the audio stuff. I've just got a few little API suggestions that I put up here: 5d073d2 Basically just made a base |
|
Hi @jonathancaudill, thanks for the contribution! I'm glad that you already did some work on Phono, since it's a great real life tool use case that will allow us to properly tune the I think that the approach your proposed is a good compromise between providing a full Light SDK-wrapped layer for general use cases and leaking Android media objects for advanced usage. Me and @dupontgu both agree it flows well with our thoughts of building an straightforward and opinionated audio library (vs building a even more opinionated audio engine). I'll expand a bit on the next comments on what I see as the two open questions we need cover before merging the PR. |
|
What it would take to support the proposed API changes on detached audio mode? This is the trickier part since it involves many aspects of the API. The architecture we're working on for detached (background) audio is to have an SDK-owned foreground service per tool that would own the player instance. That raises some issues:
|
|
Are the proposed changes enough for a Phono Tidal MVP? Now I'm getting more on speculative territory because I only scratched the surface on the Phono codebase, so please help me expand the list. I noticed that the Phono Tidal backend uses some features that aren't supported by LightAudio atm:
|
Yes. will definitely need to dedupe this when phono migrates to SDK.
Yeah, this one is tricky. My plan was to just run in foreground when tool is open, then ship off as
I would actually push back on this a little bit--Guy had mentioned that it would be good to put these in the SDK, and I definitely agree. And in the short term if we migrate to the SDK before those are implemented, your idea could definitely work. The main issue is stream quality, since phono will bump stream quality up/down to speed up the caching process per-song. This could probably be replicated with a pretty simple "speed test" of sorts where if caching is moving unusually slow we bump stream quality down. I do need to work on making this more stable for phono as well, so I'm sure the caching will improve and change over time. I do think that the best solution will probably involve some kind of access to these events, though. This also applies to automatically-detected offline mode. |
Yeah, I think this would be a good solution. |
Okie-dokie!
First draft of some more advanced audio capabilities. I can edit the description later as needed before merge.
So as it turns out, I forgot a crucial detail in #119 . The SDK sandbox blocks most stuff regarding Context. So a straight-up handoff isn't really feasible. Below is what I think will work pretty well, and it still honors the split.
SDK's default audio behavior and simple building of LightAudioPlayer instances is unchanged.
SDK will allow more advanced specs to be given when building an ExoPlayer instance via the configure argument. SDK will also allow tools to change aspects of the media3 pipeline live--queueing, etc. Which is good, because streaming requires a lot of small changes to be made as cell service comes and goes, as the user queues up tracks, etc.
SDK will also enforce one LightMediaEnv per tool & one SimpleCache object per directory.