You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom player built on top of SimpleBasePlayer. From this player, I want to send frequent time-accurate metadata to attached controllers (especially the UI controller). It seems like setTimedMetadata would be an appropriate solution. So within the simple base player I update and invalidate the state as follows.
private var state = State.Builder().......build()
private fun sendTimedMetadata(metadataEntry: Metadata.Entry) {
val time = 1000L
state = state.buildUpon()
.setTimedMetadata(Metadata(time, metadataEntry))
.build()
invalidateState()
}
where sendTimedMetadata is called, when I want to share the metadata.
When I attach an Player.Listener to the directly to the player, this it receives the metadata on the onMetadata-callback as expected.
However, when I use the regular setup with MediaSession and MediaSessionService and trying to connect a MediaController from an activity, the onMetadata is not called for the controller. Other state changes like isPlaying are working fine.
Am I missing something here or is this not expected to work? Maybe there are alternatives or better ways to send regular events (could be 10 events per second) to an activity? There seems to be broadcastCustomCommand of a MediaSession but currently I did not find a way to listen to such commands by controllers.
The text was updated successfully, but these errors were encountered:
Thanks a lot for taking the time and answering my question. Good to know, that things are working as expected (even though it would have been nice for me if it worked :-).
I guess my case is rather exotic, so I don't know if I want to take your time for finding a solution. Still, I will quickly give a description:
My player is not playing regular media, but it is a metronome, which plays sounds at regular time intervals (like a "clicking" sound 4 times a second). When the app is at the foregound, visual feedback for the "clicks" is required. The player implemention is able to emit the corresponding information shortly before the click starts and I am looking for a way to bring this information to the UI.
Timed metadata seemed like something which would exactly fit the needs, but besides of not being transferred to the controller, I am unsure, if it would able to deliver information reliable within a small enough latency (say 0.1s).
I have a custom player built on top of
SimpleBasePlayer
. From this player, I want to send frequent time-accurate metadata to attached controllers (especially the UI controller). It seems likesetTimedMetadata
would be an appropriate solution. So within the simple base player I update and invalidate the state as follows.where
sendTimedMetadata
is called, when I want to share the metadata.When I attach an
Player.Listener
to the directly to the player, this it receives the metadata on theonMetadata
-callback as expected.However, when I use the regular setup with
MediaSession
andMediaSessionService
and trying to connect aMediaController
from an activity, theonMetadata
is not called for the controller. Other state changes likeisPlaying
are working fine.Am I missing something here or is this not expected to work? Maybe there are alternatives or better ways to send regular events (could be 10 events per second) to an activity? There seems to be
broadcastCustomCommand
of aMediaSession
but currently I did not find a way to listen to such commands by controllers.The text was updated successfully, but these errors were encountered: