Closed DomainFlag closed 5 years ago
I don't think just controlling the view would be enough, since PlayerView
isn't a passive UI component. Wouldn't you also need to have the view control the playback of the streaming service for this to make sense (e.g. when the user presses the play button).
Either way, PlayerView
operates on a Player
instance. So the only reliable way to do what you're trying to do is to implement the Player
interface. Digging around using findViewById
doesn't sound like a good idea to me.
So if I were you I'd see if it's possible to build one or more Player
implementations that wrap the streaming services you're using. I'd then have all of the UI components (including your own custom UI components such as the tool bar) operate on a Player
. This means you can easily redirect them from operating on a local ExoPlayer
instance and the streaming services. If that's not possible then I'd probably not use PlayerView
at all, and implement an entirely custom UI (possibly forking PlayerView
as a starting point).
I am developing an app that uses multiple streaming services like Spotify & Deezer. I am also giving a fallback option for the users that don't have an account to be able to play at least local stored music on their devices in offline mode, thus I am using ExoPlayer for that.
At the moment, I designed a ToolBar where the user is able to control the pause/resume state over the playback of content through streaming services(hardcoded), where my app is constantly notified over the current state of the remote player & I am able to notify back, but I would like to extend that by also being able to control the state(seeking, next, shuffle...) by using the already available PlayerView which works perfectly fine with the local music.
The issue, is that I don't which option would be a reliable and a good way of solving this issue. I thought about 2 several options:
One, would be to extend the Player class but that seems a bit overkill. I also thought about using findViewById method of PlayerView and do everything by myself.
But, I am not sure which seems a good option overall and I hopefully ask for some guidance if that's possible on what path is most suitable for the current situation?