Bug 474432 - Kasts starts auto-playing after laptop is resumed from suspend
Summary: Kasts starts auto-playing after laptop is resumed from suspend
Status: RESOLVED FIXED
Alias: None
Product: kasts
Classification: Applications
Component: general (other bugs)
Version First Reported In: 23.08.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: bart
URL:
Keywords:
: 479795 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-09-12 03:45 UTC by fabinho17
Modified: 2024-01-23 21:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fabinho17 2023-09-12 03:45:42 UTC
SUMMARY
If I pause a podcast, suspend my laptop, and then wake my laptop, Kasts starts auto-playing the podcast. I would expect it to only play when I manually do it.


STEPS TO REPRODUCE
1. Pause a padcast playing in Kasts
2. Suspend laptop (ASUS in my case)
3. Wake laptop from suspend

OBSERVED RESULT
Kasts auto-plays the paused podcast on wake.

EXPECTED RESULT
Kasts does nothing. Podcast only plays when it is manually done.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 6.5.2 on EndeavourOS
(available in About System)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Installed from the Arch "extra" repository
Comment 1 bart 2023-09-19 12:31:45 UTC
Could it be that you have this plasma setting enabled?
hardware -> power management -> advanced -> pause media players when suspending

I don't know for sure, but it could be that it actually toggles the play/pause state rather than actually putting it in pause state?  If you've paused it before suspending, it might then actually toggle it to playing again.
Comment 2 fabinho17 2023-10-16 13:01:35 UTC
(In reply to bart from comment #1)
> Could it be that you have this plasma setting enabled?
> hardware -> power management -> advanced -> pause media players when
> suspending
> 
> I don't know for sure, but it could be that it actually toggles the
> play/pause state rather than actually putting it in pause state?  If you've
> paused it before suspending, it might then actually toggle it to playing
> again.

Sorry for the delay. Tried it now and it does toggle it instead of just pausing. Strange.
Closing the issue and thanks for the help.
Comment 3 bart 2024-01-14 14:07:14 UTC
*** Bug 479795 has been marked as a duplicate of this bug. ***
Comment 4 bart 2024-01-23 21:20:58 UTC
After further digging, I found out that the underlying VLC audio backend was responsible for toggling pause instead of really pausing the audio (i.e. the audio would actually start playing when calling the pause() method if the stream was already in the paused state).

I've solved this now on the master branch, so the fix should be in 24.05.
Comment 5 bart 2024-01-23 21:23:50 UTC
I'll actually also port it back to 24.02.
Comment 6 bart 2024-01-23 21:24:21 UTC
Git commit 973a5b7ac93cf27022df1d2af03ce5b7d9860628 by Bart De Vries.
Committed on 23/01/2024 at 22:16.
Pushed by bdevries into branch 'master'.

Fix the pause() method toggling pause state for VLC backend

This method should pause the audio. Instead, the VLC backend would
toggle the pause state, i.e. it would start playing again if the audio
stream was already paused.  This caused issues with already paused
streams incorrectly resuming playback after the system woke up from
suspend.

M  +6    -1    src/kmediasession/mediabackends/vlcmediabackend.cpp

https://invent.kde.org/multimedia/kasts/-/commit/973a5b7ac93cf27022df1d2af03ce5b7d9860628
Comment 7 bart 2024-01-23 21:25:18 UTC
Git commit 2c6c74aa0c08a18283bc96bc42fa3f7a1697f43a by Bart De Vries.
Committed on 23/01/2024 at 22:24.
Pushed by bdevries into branch 'release/24.02'.

Fix the pause() method toggling pause state for VLC backend

This method should pause the audio. Instead, the VLC backend would
toggle the pause state, i.e. it would start playing again if the audio
stream was already paused.  This caused issues with already paused
streams incorrectly resuming playback after the system woke up from
suspend.

M  +6    -1    src/kmediasession/mediabackends/vlcmediabackend.cpp

https://invent.kde.org/multimedia/kasts/-/commit/2c6c74aa0c08a18283bc96bc42fa3f7a1697f43a