Add the watch's own playback service and controller (issue #276) - #282
Merged
Merged
Conversation
Step 5 of Wear OS phase 1: the watch can now actually stream and play an episode from its own local (synced) queue, independent of the phone. - WearPlaybackUrlResolver always resolves to FeedItem.enclosureUrl -- no downloaded-file branch, since phase 1 is streaming-only (regression guard for phase 2/#277's eventual file-transfer support). - WearPlaybackMediaItemFactory builds a Media3 MediaItem from a FeedItem, trimmed from :app's PlaybackMediaItemFactory: no mobile- data gating, per-feed speed, or volume boost, since none of that settings state is part of what WearQueueSyncApplier syncs onto the watch. - WearPlaybackService (a MediaSessionService) owns the ExoPlayer instance, auto-advances through the local queue on episode completion, and pushes its position-save loop through WearSyncClient the same way :app's PlaybackService does -- trimmed from it: no preload manager/timeline lookahead, no Android Auto browse tree. - WearPlaybackController is a thin MediaController wrapper exposing WearPlaybackUiState, mirroring :app's PlaybackController's shape, trimmed to what the watch UI (step 6, not this step) will need. Verified: full assembleDebug/testDebugUnitTest/lintDebug across all three modules, installed and launched both debug builds with no crash. WearPlaybackController isn't called from anywhere yet -- no UI exists to trigger play() until step 6 replaces the placeholder MainActivity screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step 5 of #276 (see #278-281 for steps 1-4). The watch can now actually stream and play an episode from its own local (synced) queue, independent of the phone.
WearPlaybackUrlResolveralways resolves toFeedItem.enclosureUrl— no downloaded-file branch, since phase 1 is streaming-only (regression guard for phase 2/Send downloaded episodes to Wear OS for offline playback (phase 2) #277's eventual file-transfer support).WearPlaybackMediaItemFactorybuilds a Media3MediaItemfrom aFeedItem, trimmed from:app'sPlaybackMediaItemFactory: no mobile-data gating, per-feed speed, or volume boost, since none of that settings state is part of whatWearQueueSyncAppliersyncs onto the watch.WearPlaybackService(aMediaSessionService) owns the ExoPlayer instance, auto-advances through the local queue on episode completion, and pushes its position-save loop throughWearSyncClientthe same way:app'sPlaybackServicedoes — trimmed from it: no preload manager/timeline lookahead, no Android Auto browse tree.WearPlaybackControlleris a thinMediaControllerwrapper exposingWearPlaybackUiState, mirroring:app'sPlaybackController's shape, trimmed to what the watch UI (step 6, not this step) will need.Test plan
./gradlew assembleDebug testDebugUnitTest lintDebugpasses across:app/:core/:wearWearPlaybackUrlResolverTest(regression guard — alwaysenclosureUrl, never a downloaded file),WearPlaybackMediaItemFactoryTest(MediaItem construction, artwork fallback, resume position)WearPlaybackControllerisn't called from anywhere yet — no UI exists to triggerplay()until step 6 replaces the placeholderMainActivityscreen, so there's nothing to manually play-test on-device in this PR