Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleep Timer Improvements: fade out 5s before pausing playback #1629

Merged
merged 10 commits into from
Apr 19, 2024

Conversation

leandroalonso
Copy link
Member

When a Sleep Timer is 5s from finishing, the audio has faded out.

I did some research and found that for human hearing a logarithmic fade-out (instead of an exponential one) sounds more natural, so I went ahead and implemented it.

To test

Go to SleepTimerViewController.swift and change fiveMinutesTapped to 10.seconds, so it's easier to test.

DefaultPlayer

  1. Go to PlaybackManager and comment lines 1155 to 1157 (to ensure EffectsPlayer is not used)
  2. Run the app
  3. Play any episode
  4. Open the full player, tap the sleep timer icon (zZz), tap "5 minutes"
  5. ✅ On the 5s mark the audio should start to fade out until it's paused
  6. Play the episode again
  7. When it starts fading, pause the playback
  8. Resume it
  9. ✅ The remaining time should play without fade out

EffectsPlayer

  1. Remove the changes you made on PlaybackManager
  2. Download an episode
  3. Play the downloaded episode
  4. Open the full player, tap the sleep timer icon (zZz), tap "5 minutes"
  5. ✅ On the 5s mark the audio should start to fade out until it's paused
  6. Play the episode again
  7. When it starts fading, pause the playback
  8. Resume it
  9. ✅ The remaining time should play without fade-out

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@leandroalonso leandroalonso added this to the 7.63 milestone Apr 18, 2024
@leandroalonso leandroalonso requested a review from a team as a code owner April 18, 2024 18:05
@leandroalonso leandroalonso requested review from SergioEstevao and removed request for a team April 18, 2024 18:05
@@ -0,0 +1,47 @@
import Foundation

class FadeOutManager {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this name at all, but couldn't think of something better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky one maybe:VolumeControl or FaderMixer

Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great! Tested with the DefaultPlayer and EffectsPlayer and the fade out is pretty smooth.

Base automatically changed from sleep-timer/shake-device-restart-timer to trunk April 19, 2024 14:11
@leandroalonso leandroalonso merged commit a6516fc into trunk Apr 19, 2024
6 checks passed
@leandroalonso leandroalonso deleted the sleep-timer/fade-out-when-finishing branch April 19, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants