SPIKE: "sticky" audio player - #562
Open
floehopper wants to merge 1 commit into
Open
floehopper wants to merge 1 commit into
floehopper wants to merge 1 commit into
Conversation
This adds an extra "play" button below the "Buy" button on the album page. Clicking the new "play" button reveals an unstyled "sticky" player at the bottom of the page with "previous", "play", "pause" & "next" controls and displaying the title of each track and the percentage played. This "sticky" player persists when the user navigates away from the album page until the "close" button is clicked. The "sticky" player is implemented in `app/views/layouts/_permanent_player.html.erb` and rendered as part of the application layout with the JS behaviour implemented in `app/javascript/controllers/permanent_player_controller.js`. The new play button is implemented in `app/views/albums/_play_button.html.erb` and rendered as part of the album show page with the JS behaviour implemented in `app/javascript/controllers/play_button_controller.js`. The `click` function in this Stimulus controller calls the `load` function in `app/javascript/controllers/permanent_player_controller.js` using a Stimulus outlet [1]. TODO: * Decide whether to keep any of the existing player behaviour on the album page. * Remove duplication of track data in album show page (JSON & HTML) * Style the "sticky" player. * Consider displaying the track duration. * Decide whether/how to handle tracks with no file/preview. * Add tests. [1]: https://stimulus.hotwired.dev/reference/outlets
This branch has not been deployed
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.
This adds an extra "play" button below the "Buy" button on the album page. Clicking the new "play" button reveals an unstyled "sticky" player at the bottom of the page with "previous", "play", "pause" & "next" controls and displaying the title of each track and the percentage played. This "sticky" player persists when the user navigates away from the album page until the "close" button is clicked.
The "sticky" player is implemented in
app/views/layouts/_permanent_player.html.erband rendered as part of the application layout with the JS behaviour implemented inapp/javascript/controllers/permanent_player_controller.js.The new play button is implemented in
app/views/albums/_play_button.html.erband rendered as part of the album show page with the JS behaviour implemented inapp/javascript/controllers/play_button_controller.js. Theclickfunction in this Stimulus controller calls theloadfunction inapp/javascript/controllers/permanent_player_controller.jsusing a Stimulus outlet.TODO:
Note that I wrote all the above many months after I did the bulk of the implementation, so I may have forgotten stuff!